Skip to content

Commit

Permalink
Merge pull request #652 from turnitin/develop
Browse files Browse the repository at this point in the history
Release v2023033001
  • Loading branch information
ixiongtii authored Mar 31, 2023
2 parents ba1632e + 931a176 commit fdc37df
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 5 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
### Date: 2023-March-30
### Release: v2023033001

#### Students that have previously rejected the EULA can now resubmit

We have fixed an issue that was preventing students from being able to resubmit to Turnitin for an assignment where they had previously rejected the EULA. Now if a student accepts the EULA, they will be able to successfully resubmit to any assignments where they previously rejected the EULA.

#### Inbox now displays the highest score when Translated Matching is enabled

We have fixed an issue with the similarity score value in the Moodle Plagiarism Plugin inbox. Previously it wasn't updating with the highest score when translated matching was enabled, and instead the inbox continued to display the first score, even if it was the lower of the two.

#### Duplicate quiz responses are now handled separately

We have fixed an issue where if a student submitted the same response multiple times on a quiz, all duplicate responses would be linked to same report, which would not allow them to be reviewed by an instructor as separate responses. Each response now generates a separate report.

---

### Date: 2022-September-21
### Release: v2022092101

Expand Down
2 changes: 1 addition & 1 deletion classes/modules/turnitin_quiz.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function update_mark($attemptid, $identifier, $userid, $grade, $quizgrade
foreach ($attempt->get_slots() as $slot) {
$answer = $attempt->get_question_attempt($slot)->get_response_summary();
// Check if this is the slot the mark is for by matching content.
if (sha1($answer) == $identifier) {
if (sha1($answer.$slot) == $identifier) {
// Translate the TFS grade to a mark for the question.
$questionmaxmark = $attempt->get_question_attempt($slot)->get_max_mark();

Expand Down
15 changes: 12 additions & 3 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ public function get_links($linkarray) {
$submissiontype = 'quiz_answer';
}
$content = $moduleobject->set_content($linkarray, $cm);
$identifier = sha1($content);
$identifier = ($submissiontype === 'quiz_answer') ? sha1($content.$linkarray["itemid"]) : sha1($content);
}

// Group submissions where all students have to submit sets userid to 0.
Expand Down Expand Up @@ -2303,6 +2303,14 @@ public function queue_submission_to_turnitin($cm, $author, $submitter, $identifi
$attempt = 0;
$tiisubmissionid = null;

// If the EULA hasn't been accepted, don't save submission and don't submit to Tii
$coursedata = $this->get_course_data($cm->id, $cm->course);
$user = new turnitin_user($author, "Learner");
$user->join_user_to_class($coursedata->turnitin_cid);
$eula_accepted = ($user->useragreementaccepted == 0) ? $user->get_accepted_user_agreement() : $user->useragreementaccepted;
if ($eula_accepted != 1) {
return true;
}
// Check if file has been submitted before.
$plagiarismfiles = plagiarism_turnitin_retrieve_successful_submissions($author, $cm->id, $identifier);
if (count($plagiarismfiles) > 0) {
Expand Down Expand Up @@ -2582,7 +2590,8 @@ public function event_handler($eventdata) {
$eventdata['other']['content'] = $qa->get_response_summary();

// Queue text content.
$identifier = sha1($eventdata['other']['content']);
// adding slot to sha hash to create unique assignments for duplicate text based on it's id
$identifier = sha1($eventdata['other']['content'].$slot);
$result = $this->queue_submission_to_turnitin(
$cm, $author, $submitter, $identifier, 'quiz_answer',
$eventdata['objectid'], $eventdata['eventtype']);
Expand Down Expand Up @@ -3155,7 +3164,7 @@ function plagiarism_turnitin_send_queued_submissions() {
}
foreach ($attempt->get_slots() as $slot) {
$qa = $attempt->get_question_attempt($slot);
if ($queueditem->identifier == sha1($qa->get_response_summary())) {
if ($queueditem->identifier == sha1($qa->get_response_summary().$slot)) {
$textcontent = $qa->get_response_summary();
break;
}
Expand Down
23 changes: 23 additions & 0 deletions vendor/Integrations/phpsdk-package/src/SubmissionSoap.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,17 @@ public function readSubmission($submission)
);
} else {
$tiiSubmission = new TiiSubmission();
$translatedScore = null;
$tiiSubmission->setSubmissionId($soap->resultRecord->sourcedGUID->sourcedId);
$tiiSubmission->setTitle($soap->resultRecord->result->resultValue->label);
$tiiSubmission->setAssignmentId($soap->resultRecord->result->lineItemSourcedId);
$tiiSubmission->setAuthorUserId($soap->resultRecord->result->personSourcedId);
$tiiSubmission->setDate($soap->resultRecord->result->date);
$tiiSubmission->setOverallSimilarity($soap->resultRecord->result->resultScore->textString);
$translatedScore = $this->checkForTranslatedSimScore($soap->resultRecord->result->extension->extensionField);
if (!is_null($translatedScore)) {
$tiiSubmission->setTranslatedOverallSimilarity($translatedScore);
}
foreach ($soap->resultRecord->result->extension->extensionField as $field) {
$name = $field->fieldName;
$method = 'set'.$name;
Expand Down Expand Up @@ -89,6 +94,7 @@ public function readSubmissions($submission)
);
} else {
$submissions = array();
$translatedScore = null;
if (isset($soap->resultRecordSet->resultRecord)) {
if (!is_array($soap->resultRecordSet->resultRecord)) {
$soap->resultRecordSet->resultRecord = array($soap->resultRecordSet->resultRecord);
Expand All @@ -101,6 +107,10 @@ public function readSubmissions($submission)
$tiiSubmission->setAuthorUserId($submission->result->personSourcedId);
$tiiSubmission->setDate($submission->result->date);
$tiiSubmission->setOverallSimilarity($submission->result->resultScore->textString);
$translatedScore = $this->checkForTranslatedSimScore($submission->result->extension->extensionField);
if (!is_null($translatedScore)) {
$tiiSubmission->setTranslatedOverallSimilarity($translatedScore);
}
foreach ($submission->result->extension->extensionField as $field) {
$name = $field->fieldName;
$method = 'set'.$name;
Expand Down Expand Up @@ -359,4 +369,17 @@ private function buildSubmissionRequest($submission)

return $request;
}

/**
* @param $array
* @return string
*/
private function checkForTranslatedSimScore($array) {
foreach ($array as $object) {
if ( ($object->fieldName == "TranslatedOverallSimilarity") && (!is_null($object->fieldValue)) ) {
return $object->fieldValue;
}
}
return null;
}
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @copyright 2012 iParadigms LLC
*/

$plugin->version = 2022092101;
$plugin->version = 2023033001;

$plugin->release = "3.5+";
$plugin->requires = 2018051700;
Expand Down

0 comments on commit fdc37df

Please sign in to comment.