From fad261c5e9a0ee2b5f6bd34f8e4bd8a7adf8bfb2 Mon Sep 17 00:00:00 2001 From: Charles Severance Date: Sun, 23 Jun 2024 20:35:11 +0100 Subject: [PATCH] Add notifyReadyToGrade() for instructor graded tools --- composer.json | 2 +- composer.lock | 10 ++++----- vendor/composer/installed.json | 8 +++---- vendor/composer/installed.php | 6 +++--- vendor/tsugi/lib/src/Core/Result.php | 31 +++++++++++++++++++++++++++- 5 files changed, 43 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index 42c962a8e..b6fe4a799 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/composer.lock b/composer.lock index 5345abe72..1beedf664 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9ec0aee93e2c1899ce0d7727a0484229", + "content-hash": "9bc77acfae72b987d1d93e7fe0671fc3", "packages": [ { "name": "brick/math", @@ -7392,12 +7392,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": { @@ -7441,7 +7441,7 @@ "issues": "https://github.com/tsugiproject/tsugi-php/issues", "source": "https://github.com/tsugiproject/tsugi-php/tree/master" }, - "time": "2024-06-10T13:47:13+00:00" + "time": "2024-06-23T19:29:21+00:00" }, { "name": "vlucas/phpdotenv", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 63ad10962..40bcc9150 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -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": { @@ -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", diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index af0f24b8a..3626752f5 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'eb0f398d07b416d3f5581bf65d2e6c6e2df822a1', + 'reference' => 'a227d15d03420df5519f0ca78671e3ad7358a8d7', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ '__root__' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'eb0f398d07b416d3f5581bf65d2e6c6e2df822a1', + 'reference' => 'a227d15d03420df5519f0ca78671e3ad7358a8d7', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -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( diff --git a/vendor/tsugi/lib/src/Core/Result.php b/vendor/tsugi/lib/src/Core/Result.php index 631c67d48..14123a390 100644 --- a/vendor/tsugi/lib/src/Core/Result.php +++ b/vendor/tsugi/lib/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 *