Skip to content

Commit

Permalink
Add notifyReadyToGrade() 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 a227d15 commit fad261c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 14 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"react/dns" : ">=1.12.0",
"react/socket" : ">=1.15.0",

"tsugi/lib": "dev-master#8b5148497114bd3c5f174dc54eece0a383c47ff0",
"tsugi/lib": "dev-master#ce77c67f93f736a8bc9c7a3b77963ebe3ec2a021",
"koseu/lib": "dev-master#b9a31b7875108196dbdf284e685b813d424f2def"
},
"config": {
Expand Down
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -7708,12 +7708,12 @@
"source": {
"type": "git",
"url": "https://github.com/tsugiproject/tsugi-php.git",
"reference": "8b5148497114bd3c5f174dc54eece0a383c47ff0"
"reference": "ce77c67f93f736a8bc9c7a3b77963ebe3ec2a021"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tsugiproject/tsugi-php/zipball/8b5148497114bd3c5f174dc54eece0a383c47ff0",
"reference": "8b5148497114bd3c5f174dc54eece0a383c47ff0",
"url": "https://api.github.com/repos/tsugiproject/tsugi-php/zipball/ce77c67f93f736a8bc9c7a3b77963ebe3ec2a021",
"reference": "ce77c67f93f736a8bc9c7a3b77963ebe3ec2a021",
"shasum": ""
},
"require": {
Expand All @@ -7727,7 +7727,7 @@
"phpunit/php-timer": "v5.0.3",
"phpunit/phpunit": "9.*"
},
"time": "2024-06-10T13:47:13+00:00",
"time": "2024-06-23T19:29:21+00:00",
"default-branch": true,
"type": "library",
"installation-source": "dist",
Expand Down
6 changes: 3 additions & 3 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'eb0f398d07b416d3f5581bf65d2e6c6e2df822a1',
'reference' => 'a227d15d03420df5519f0ca78671e3ad7358a8d7',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand All @@ -13,7 +13,7 @@
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'eb0f398d07b416d3f5581bf65d2e6c6e2df822a1',
'reference' => 'a227d15d03420df5519f0ca78671e3ad7358a8d7',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down Expand Up @@ -1078,7 +1078,7 @@
'tsugi/lib' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '8b5148497114bd3c5f174dc54eece0a383c47ff0',
'reference' => 'ce77c67f93f736a8bc9c7a3b77963ebe3ec2a021',
'type' => 'library',
'install_path' => __DIR__ . '/../tsugi/lib',
'aliases' => array(
Expand Down
31 changes: 30 additions & 1 deletion vendor/tsugi/lib/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 fad261c

Please sign in to comment.