[LON-CAPA-cvs] cvs: loncom /homework structuretags.pm
raeburn
raeburn at source.lon-capa.org
Wed Dec 26 14:40:04 EST 2018
raeburn Wed Dec 26 19:40:04 2018 EDT
Modified files:
/loncom/homework structuretags.pm
Log:
- Bug 6754 LON-CAPA as LTI Provider
- Only call routine to pass grades back to the LTI Consumer which launched
the LTI session, if the user received a score.
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.561 loncom/homework/structuretags.pm:1.562
--- loncom/homework/structuretags.pm:1.561 Fri Oct 19 22:04:07 2018
+++ loncom/homework/structuretags.pm Wed Dec 26 19:40:04 2018
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.561 2018/10/19 22:04:07 raeburn Exp $
+# $Id: structuretags.pm,v 1.562 2018/12/26 19:40:04 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1117,7 +1117,7 @@
delete(@Apache::lonhomework::results{@remove});
my ($symb,$courseid,$domain,$name) =
&Apache::lonnet::whichuser($given_symb);
- my ($passback,$ltiscope,$ltimap,$ltisymb,$ltiref,$total,$possible);
+ my ($passback,$ltiscope,$ltimap,$ltisymb,$ltiref,$total,$possible,$dopassback);
if ($env{'request.state'} eq 'construct'
|| $symb eq ''
|| $Apache::lonhomework::type eq 'practice') {
@@ -1219,7 +1219,20 @@
}
}
}
- if (($passback) && ($ltiscope eq 'resource') && ($ltisymb eq $symb)) {
+ if ($passback) {
+ foreach my $key (keys(%Apache::lonhomework::results)) {
+ if ($key =~ /^resource\.([^\.]+)\.solved$/) {
+ my $part = $1;
+ if ((($Apache::lonhomework::results{$key} =~ /^correct_/) ||
+ ($Apache::lonhomework::results{$key} eq 'incorrect_attempted')) &&
+ ($Apache::lonhomework::results{"resource.$part.tries"})) {
+ $dopassback = 1;
+ last;
+ }
+ }
+ }
+ }
+ if (($dopassback) && ($ltiscope eq 'resource') && ($ltisymb eq $symb)) {
$total = 0;
$possible = 0;
my $navmap = Apache::lonnavmaps::navmap->new();
@@ -1258,7 +1271,7 @@
}
&Apache::lonxml::debug('Store return message:'.$result);
&store_aggregates($symb,$courseid);
- if ($passback) {
+ if ($dopassback) {
my $scoreformat = 'decimal';
if (ref($ltiref) eq 'HASH') {
if ($ltiref->{'scoreformat'} =~ /^(decimal|ratio|percentage)$/) {
More information about the LON-CAPA-cvs
mailing list