From d3935df6cbfe8db7d19472a34d3584107269173a Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Tue, 3 Sep 2024 12:34:24 -0700 Subject: [PATCH] initialize grade columns in the LMS according to the grade passback mode and the nature of the LTI link --- lib/WeBWorK/ContentGenerator/LTIAdvanced.pm | 31 +++++++++++++++----- lib/WeBWorK/ContentGenerator/LTIAdvantage.pm | 9 ++++-- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/lib/WeBWorK/ContentGenerator/LTIAdvanced.pm b/lib/WeBWorK/ContentGenerator/LTIAdvanced.pm index beb9f65f7c..2010c3d9a4 100644 --- a/lib/WeBWorK/ContentGenerator/LTIAdvanced.pm +++ b/lib/WeBWorK/ContentGenerator/LTIAdvanced.pm @@ -129,8 +129,19 @@ sub content_selection ($c) { ? { '@type' => 'LtiLinkItem', mediaType => 'application/vnd.ims.lti.v1.ltilink', - title => $c->maketext('Assignments'), - url => $c->url_for('set_list', courseID => $c->stash->{courseID})->to_abs->to_string + title => $c->maketext('WeBWorK Assignments'), + url => $c->url_for('set_list', courseID => $c->stash->{courseID})->to_abs->to_string, + $c->ce->{LTIGradeMode} eq 'course' + ? ( + lineItem => { + '@type' => 'LineItem', + scoreConstraints => { + '@type' => 'NumericLimits', + normalMaximum => 100 + } + } + ) + : () } : (), map { { @@ -141,13 +152,17 @@ sub content_selection ($c) { url => $c->url_for('problem_list', courseID => $c->stash->{courseID}, setID => $_->set_id) ->to_abs->to_string, - lineItem => { - '@type' => 'LineItem', - scoreConstraints => { - '@type' => 'NumericLimits', - normalMaximum => $setMaxScores{ $_->set_id } + $c->ce->{LTIGradeMode} eq 'homework' + ? ( + lineItem => { + '@type' => 'LineItem', + scoreConstraints => { + '@type' => 'NumericLimits', + normalMaximum => $setMaxScores{ $_->set_id } + } } - } + ) + : () } } @selectedSets ] }) diff --git a/lib/WeBWorK/ContentGenerator/LTIAdvantage.pm b/lib/WeBWorK/ContentGenerator/LTIAdvantage.pm index 6256193eb8..f250ed008e 100644 --- a/lib/WeBWorK/ContentGenerator/LTIAdvantage.pm +++ b/lib/WeBWorK/ContentGenerator/LTIAdvantage.pm @@ -266,8 +266,9 @@ sub content_selection ($c) { $c->param('course_home_link') ? { type => 'ltiResourceLink', - title => $c->maketext('Assignments'), - url => $c->url_for('set_list', courseID => $c->stash->{courseID})->to_abs->to_string + title => $c->maketext('WeBWorK Assignments'), + url => $c->url_for('set_list', courseID => $c->stash->{courseID})->to_abs->to_string, + $c->ce->{LTIGradeMode} eq 'course' ? (lineItem => { scoreMaximum => 100 }) : () } : (), map { { @@ -277,7 +278,9 @@ sub content_selection ($c) { url => $c->url_for('problem_list', courseID => $c->stash->{courseID}, setID => $_->set_id) ->to_abs->to_string, - lineItem => { scoreMaximum => $setMaxScores{ $_->set_id } } + $c->ce->{LTIGradeMode} eq 'homework' + ? (lineItem => { scoreMaximum => $setMaxScores{ $_->set_id } }) + : () } } @selectedSets ] )