Skip to content

Commit

Permalink
Merge pull request #1464 from taniwallach/lti-submit-bug-fix
Browse files Browse the repository at this point in the history
Hotfix: LTI grade passback
  • Loading branch information
drgrice1 committed Aug 9, 2021
2 parents ea8118c + a25cb79 commit 4e195c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
5 changes: 1 addition & 4 deletions lib/WeBWorK/Authen/LTIAdvanced.pm
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ use URI::Escape;
use Net::OAuth;
use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and $ENV{MOD_PERL_API_VERSION} >= 2 );

use constant TIME_DIFF_THRESHOLD => 5; # seconds, threshold to report different between system time and oauth_timestamp time

$Net::OAuth::PROTOCOL_VERSION = Net::OAuth::PROTOCOL_VERSION_1_0A;

BEGIN {
Expand Down Expand Up @@ -149,8 +147,7 @@ sub get_credentials {
my $curr_time = time();
my $delta_time = $curr_time - $oauth_time;
my $delta_min = (0.0 + $delta_time) / (60.0);
if ( $ce->{debug_lti_parameters} ||
( abs($delta_time) > TIME_DIFF_THRESHOLD ) ) {
if ( $ce->{debug_lti_parameters} ) {
warn join("\n",
"============================",
"===== timestamp info =======",
Expand Down
8 changes: 3 additions & 5 deletions lib/WeBWorK/Authen/LTIAdvanced/SubmitGrade.pm
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ sub submit_grade {
# which should be dependent on the student + the assignment if a
# "homework" level sourcedid. This part can be used twice
my $uuid_p1 = create_uuid_as_string(UUID_SHA1, UUID_NS_URL, $sourcedid);
my $uuid_p2;

# Second part is a time dependent portion
my $uuid_p2 = create_uuid_as_string(UUID_TIME);

my $lti_check_prior = $ce->{lti_check_prior} // 0; # Should we first poll the LMS for the current grade

Expand Down Expand Up @@ -296,14 +298,10 @@ EOS
warn("Retrieving prior grade using sourcedid: $sourcedid") if
$ce->{debug_lti_parameters};


$requestGen = Net::OAuth->request("consumer");

$requestGen->add_required_message_params('body_hash');

# Generate a better nonce, second part is a time dependent portion
$uuid_p2 = create_uuid_as_string(UUID_TIME);

$gradeRequest = $requestGen->new(
request_url => $request_url,
request_method => "POST",
Expand Down

0 comments on commit 4e195c9

Please sign in to comment.