TII new and undesirable behaviour

TII new and undesirable behaviour

by Paolo Oprandi -
Number of replies: 6
Hi Dan and all,

Something very odd is happening to our TII installation. Basically when I submit a file to TII I am quickly returned a similarity score of 0%. When I click on the report I am offered the error:

Originality report not generated yet in fid 6, fcmd 1

After a little time the similarity report with a TII score is generated, but the Moodle database is already populated with a TII score of 0% and TII code "success". It seems to me the following function in lib/turnitinlib.php is returning a TII score when before it wasn't:

$tiiscore = tii_post_to_api ( $tii, 61, 'GET', $tiifile, false );

This triggers the TII submission to be set to successful on Moodle and for the wrong TII score to be set.

if (isset ( $tiiscore )) {
$tiifile->tiiscore = $tiiscore;
$tiifile->tiicode = 'success';
$count ++;
if (! update_record ( 'tii_files', $tiifile )) {
error ( "update tii score failed" );
}

I have added some code so users can manually refresh their TII score, but this isn't the solution.

Has anyone else experienced this or have any leads as to the solution?

Thanks a lot,
Paolo
Average of ratings: -
In reply to Paolo Oprandi

Re: TII new and undesirable behaviour

by Jason Cashel -
Hi Paolo,

I have seen this problem too and I suspect that it is a problem with libxml2 (I have not proven this).

On the server that I am seeing this I am also seeing this bug:
http://tracker.moodle.org/browse/MDL-16759

Other links:
http://bugs.php.net/bug.php?id=45996&thanks=6
http://bugzilla.gnome.org/show_bug.cgi?id=554124

Regards,
Jason
In reply to Jason Cashel

Re: Turnitin new and undesirable behaviour

by Paolo Oprandi -
Hi Jason, Dan, others,

Thanks for this, but actually we haven't upgraded libxml2 to 2.7. The problem is that when

$tiiscore = tii_post_to_api ( $tii, 61, 'GET', $tiifile, false );

...returns with the boolean FALSE the if statement

if (isset(tiiscore))

...returns true.

To complicate things when a score is returned, despite it appearing numeric, it is actually an object. The return value of the function is

return $tiixml->originalityscore[0];

I will have to ask a more knowledgeable PHP expert shortly about how the returned variable is both an object and a number. However, changing the if statement to:

if (is_object(tiiscore)) {

...works.

My final question then is: why was it working before and, presumably, still does for other people?

Best wishes,
Paolo
In reply to Paolo Oprandi

Re: Turnitin new and undesirable behaviour

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
good spotting! - I just had a look at the 1.9 version

that line:
if (isset($tiiscore)) {

should read:
if (isset($tiiscore) && $tiiscore) {

I'll push that up to the contrib CVS branch of Moodle 1.6 tomorrow.

not sure why it was working previously but not recently....maybe Turnitin are taking longer to process the files at the moment? - end of year, maybe there's a higher load on their servers?
In reply to Dan Marsden

Re: Turnitin new and undesirable behaviour

by Paolo Oprandi -
By the way, the ability for a tutor to refresh the TII score seems pretty good to me. Basically if a tutor wants to exclude matches with certain papers, exclude references and so on they do so in TII, but without this functionality the changes in score can't be reflected in Moodle.

Ciao,
Paolo
In reply to Dan Marsden

Re: Turnitin new and undesirable behaviour

by Paolo Oprandi -
Is the best solution would be to return the score as an integer

return (int)$tiixml->originalityscore[0];

...and then check if (is_numeric($tiiscore)) ?

All the best,
Paolo
In reply to Paolo Oprandi

Re: Turnitin new and undesirable behaviour

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
not a bad suggestion! - will look at making a similar patch at some point.

regarding the settings to exclude references etc, the API documentation from Turnitin doesn't give any detail on how I can do this, but I've recently been in touch with the turnitin guys to see what "hidden" parts of the API I can start to leverge - we might have a client with funding to get me started on some of this in the next month or so.