Skip to content

Commit

Permalink
Add notifyReadyToGrade() method to result for instructor graded tools.
Browse files Browse the repository at this point in the history
  • Loading branch information
csev committed Jun 23, 2024
1 parent 8b51484 commit ce77c67
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/Core/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ public function gradeSendDueDate($gradetosend, $oldgrade=false, $dueDate=false)
}
if ( $dueDate && $dueDate->penalty > 0 ) {
$gradetosend = $gradetosend * (1.0 - $dueDate->penalty);
$scorestr = "Effective Score = ".($gradetosend*100.0)."% after ".$dueDate->penalty*100.0." percent late penalty";
$scorestr = "Effective Score = ".($gradetosend*100.0)."% after ".($dueDate->penalty*100.0)." percent late penalty";
}
if ( $oldgrade && $oldgrade > $gradetosend ) {
$scorestr = "New score of ".($gradetosend*100.0)."% is < than previous grade of ".($oldgrade*100.0)."%, previous grade kept";
Expand All @@ -446,6 +446,35 @@ public function gradeSendDueDate($gradetosend, $oldgrade=false, $dueDate=false)
}
}

/**
* Notify the LMS that this result is ready for grading
*
* For LTI13, we set the values and send a null grade. For LTI11, we send a grade
* of 0.0 with a comment as long as a grade has not already been sent.
*
* @param $debug_log An (optional) array (by reference) that returns the
* steps that were taken.
*/
public function notifyReadyToGrade(&$debug_log=false) {

$extra13 = array(
LTI13::ACTIVITY_PROGRESS => LTI13::ACTIVITY_PROGRESS_SUBMITTED,
LTI13::GRADING_PROGRESS => LTI13::GRADING_PROGRESS_PENDINGMANUAL,
);
$row = false;

if ( $this->launch->isLTI13() ) {
$grade = is_numeric($this->grade) ? $this->grade : null;
$this->gradeSend($grade, $row, $debug_log, $extra13);
} else {
// For LTI 1.1 if there is already a grade, we re-send it or send 0.0
$grade = is_numeric($this->grade) ? $this->grade : 0.0;
$this->gradeSend($grade, $row, $debug_log, $extra13);
}


}

/**
* Get a JSON for a different user
*
Expand Down

0 comments on commit ce77c67

Please sign in to comment.