diff --git a/src/Core/Result.php b/src/Core/Result.php index 631c67d..14123a3 100644 --- a/src/Core/Result.php +++ b/src/Core/Result.php @@ -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"; @@ -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 *