Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix: LTI grade passback #1464

Merged
merged 3 commits into from
Aug 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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