@@ -122,9 +122,10 @@ async sub submit_course_grade ($self, $userID) {
122122 my $user = $db -> getUser($userID );
123123 return 0 unless $user ;
124124
125- $self -> warning(" submitting all grades for user: $userID " ) if $ce -> {debug_lti_grade_passback };
125+ $self -> warning(" submitting all grades for user: $userID " )
126+ if $ce -> {debug_lti_grade_passback } || $self -> {post_processing_mode };
126127 $self -> warning(" lis_source_did is not available for user: $userID " )
127- if !$user -> lis_source_did && $ce -> {debug_lti_grade_passback };
128+ if !$user -> lis_source_did && ( $ce -> {debug_lti_grade_passback } || $self -> { post_processing_mode }) ;
128129
129130 return await $self -> submit_grade($user -> lis_source_did, scalar (grade_all_sets($db , $userID )));
130131}
@@ -140,9 +141,10 @@ async sub submit_set_grade ($self, $userID, $setID) {
140141
141142 my $userSet = $db -> getMergedSet($userID , $setID );
142143
143- $self -> warning(" Submitting grade for user $userID and set $setID ." ) if $ce -> {debug_lti_grade_passback };
144+ $self -> warning(" Submitting grade for user $userID and set $setID ." )
145+ if $ce -> {debug_lti_grade_passback } || $self -> {post_processing_mode };
144146 $self -> warning(' lis_source_did is not available for this set.' )
145- if !$userSet -> lis_source_did && $ce -> {debug_lti_grade_passback };
147+ if !$userSet -> lis_source_did && ( $ce -> {debug_lti_grade_passback } || $self -> { post_processing_mode }) ;
146148
147149 return await $self -> submit_grade(
148150 $userSet -> lis_source_did,
229231 $bodyhash .= ' =' ;
230232 }
231233
232- $self -> warning(" Retrieving prior grade using sourcedid: $sourcedid " ) if $ce -> {debug_lti_parameters };
234+ $self -> warning(" Retrieving prior grade using sourcedid: $sourcedid " )
235+ if $ce -> {debug_lti_parameters } || $self -> {post_processing_mode };
233236
234237 my $requestGen = Net::OAuth-> request(' consumer' );
235238
303306 if $ce -> {debug_lti_grade_passback };
304307 $self -> warning(' LMS grade will NOT be updated - grade unchanged. '
305308 . " Old score: $oldScore ; New score: $score " )
306- if ( $ce -> {debug_lti_grade_passback }) ;
309+ if $ce -> {debug_lti_grade_passback } || $self -> { post_processing_mode } ;
307310 return 1;
308311 } else {
309312 debug(" LMS grade will be updated. sourcedid: $sourcedid ; Old score: $oldScore ; New score: $score " )
314317 $self -> warning(' Unable to retrieve prior grade from LMS. Note that if your server time is not correct, '
315318 . ' this may fail for reasons which are less than obvious from the error messages. Error: '
316319 . $response -> message)
317- if ( $ce -> {debug_lti_grade_passback }) ;
320+ if $ce -> {debug_lti_grade_passback } || $self -> { post_processing_mode } ;
318321 debug(' Unable to retrieve prior grade from LMS. Note that if your server time is not correct, '
319322 . ' this may fail for reasons which are less than obvious from the error messages. Error: '
320323 . $response -> message);
@@ -412,17 +415,23 @@ EOS
412415 my $message = $1 ;
413416 $self -> warning(" result is: $message " ) if $ce -> {debug_lti_grade_passback };
414417 if ($message ne ' success' ) {
415- debug(" Unable to update LMS grade $sourcedid . LMS responded with message: $message " );
418+ $self -> warning(" Unable to update LMS grade $sourcedid . LMS responded with message: $message " )
419+ if $self -> {post_processing_mode };
420+ debug(" Unable to update LMS grade $sourcedid . LMS responded with message: $message " );
416421 return 0;
417422 } else {
418423 # If we got here, we got successes from both the post and the lms.
419424 debug(" Successfully updated LMS grade $sourcedid . LMS responded with message: $message " );
420425 }
421426 } else {
427+ $self -> warning(" Unable to update LMS grade $sourcedid . Error: " . $response -> message)
428+ if $self -> {post_processing_mode };
422429 debug(" Unable to update LMS grade $sourcedid . Error: " . $response -> message);
423430 debug($response -> body);
424431 return 0;
425432 }
433+ $self -> warning(" Success submitting grade using sourcedid: $sourcedid and score: $score " )
434+ if $self -> {post_processing_mode };
426435 debug(" Success submitting grade using sourcedid: $sourcedid and score: $score " );
427436
428437 return 1;
0 commit comments