--- loncom/homework/grades.pm 2024/12/09 02:46:01 1.798 +++ loncom/homework/grades.pm 2024/12/09 22:22:57 1.801 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.798 2024/12/09 02:46:01 raeburn Exp $ +# $Id: grades.pm,v 1.801 2024/12/09 22:22:57 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1458,7 +1458,7 @@ sub do_passback { 'format' => $scoretype, 'scope' => $scope, 'clientip' => $pb{'clientip'}, - 'linkprot' => $linkprotector, + 'linkprot' => $linkprotector.':'.$linkuri, 'total' => $total, 'possible' => $possible, 'score' => $score, @@ -1836,11 +1836,11 @@ sub process_passbacks { 'format' => $pb{'scoretype'}, 'scope' => $pb{'scope'}, 'clientip' => $pb{'clientip'}, - 'linkprot' => $pb{'linkprotector'}, + 'linkprot' => $pb{'linkprotector'}.':'.$pb{'linkuri'}, 'total_s' => \%total_by_symb, 'possible_s' => \%possible_by_symb, }; - push(@Apache::lonhomework::ltipassback,$ltigrade); + push(@Apache::grades::ltipassback,$ltigrade); next; } my ($total,$possible); @@ -1908,7 +1908,7 @@ sub process_passbacks { 'format' => $pb{'scoretype'}, 'scope' => $pb{'scope'}, 'clientip' => $pb{'clientip'}, - 'linkprot' => $pb{'linkprotector'}, + 'linkprot' => $pb{'linkprotector'}.':'.$pb{'linkuri'}, 'total' => $total, 'possible' => $possible, 'score' => $score, @@ -4249,16 +4249,17 @@ sub processHandGrade { } else { $pbcollab{$collaborator}{$part} = [$pts,$wgt]; if ($message ne '') { - my ($baseurl,$showsymb) = - &get_feedurl_and_symb($symb,$collaborator, - $udom); - if ($env{'form.withgrades'.$ctr}) { - $messagetail = " for $restitle"; + my ($baseurl,$showsymb) = + &get_feedurl_and_symb($symb,$collaborator, + $udom); + if ($env{'form.withgrades'.$ctr}) { + $messagetail = " for $restitle"; + } + $msgstatus = + &Apache::lonmsg::user_normal_msg($collaborator,$udom,$subject,$message.$messagetail,undef,$baseurl,undef,undef,undef,$showsymb,$restitle); } - $msgstatus = - &Apache::lonmsg::user_normal_msg($collaborator,$udom,$subject,$message.$messagetail,undef,$baseurl,undef,undef,undef,$showsymb,$restitle); - } + } } } } @@ -6178,7 +6179,7 @@ sub csvuploadassign { $request->print('.'); # Remove from grading queue &Apache::bridgetask::remove_from_queue('gradingqueue',$symb,$cdom,$cnum, - $domain,$username); + $domain,$username); $countdone++; if ($passback) { my @parts_in_upload; @@ -6951,7 +6952,6 @@ sub updateGradeByPage { $request->print($hidemsg.$grademsg.$studentTable); if (@updates) { - undef(@Apache::lonhomework::ltipassback); my (@allsymbs,$mapsymb,@recurseup,%parentmapsymbs,%possmappb,%possrespb); @allsymbs = @updates; if (ref($map)) { @@ -7011,11 +7011,12 @@ sub updateGradeByPage { my @symbs = keys(%uniqsymbs); &process_passbacks('updatebypage',\@symbs,$cdom,$cnum,$udom,$uname,\%weights, \%awardeds,\%excuseds,\%needpb,\%skip_passback,\%pbsave,\%pbids); - if (@Apache::lonhomework::ltipassback) { + if (@Apache::grades::ltipassback) { unless ($registered_cleanup) { my $handlers = $request->get_handlers('PerlCleanupHandler'); $request->set_handlers('PerlCleanupHandler' => - [\&Apache::lonhomework::do_ltipassback,@{$handlers}]); + [\&Apache::grades::make_passback,@{$handlers}]); + $registered_cleanup=1; } } } @@ -7023,6 +7024,17 @@ sub updateGradeByPage { return ''; } +sub make_passback { + if (@Apache::grades::ltipassback) { + my $lonhost = $Apache::lonnet::perlvar{'lonHostID'}; + my $ip = &Apache::lonnet::get_host_ip($lonhost); + foreach my $item (@Apache::grades::ltipassback) { + &Apache::lonhomework::run_passback($item,$lonhost,$ip); + } + undef(@Apache::grades::ltipassback); + } +} + #-------- end of section for handling grading by page/sequence --------- # #------------------------------------------------------------------- @@ -12807,6 +12819,10 @@ sub handler { &Apache::lonnet::logthis("grades got multiple commands ".join(':',@commands)); } +# -------------------------------------- Flag and buffer for registered cleanup + $registered_cleanup=0; + undef(@Apache::grades::ltipassback); + # see what the symb is my $symb=$env{'form.symb'};