From b5d80a31f6f0c5468441fc317adfe17694f0d8a1 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 | 21 ++++++++++++-------- lib/WeBWorK/ContentGenerator/LTIAdvantage.pm | 9 ++++++--- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/lib/WeBWorK/ContentGenerator/LTIAdvanced.pm b/lib/WeBWorK/ContentGenerator/LTIAdvanced.pm index 743c6c8531..b4583128b7 100644 --- a/lib/WeBWorK/ContentGenerator/LTIAdvanced.pm +++ b/lib/WeBWorK/ContentGenerator/LTIAdvanced.pm @@ -129,8 +129,11 @@ 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 => {scoreMaximum => 100}) + : () } : (), map { { @@ -141,12 +144,14 @@ 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 ] )