Diff for /loncom/interface/lonnavmaps.pm between versions 1.576 and 1.577

version 1.576, 2025/06/28 14:34:46 version 1.577, 2025/06/28 17:34:00
Line 425  Convenience function, so others can use Line 425  Convenience function, so others can use
 Convenience function, so others can use it: Is there only one try remaining for the  Convenience function, so others can use it: Is there only one try remaining for the
 part, with more than one try to begin with, not due yet and still can be done?  part, with more than one try to begin with, not due yet and still can be done?
   
   =item graceEndsUnder24Hours()
   
   Convenience function, so others can use it: Is the problem past-due with a grace period
   which ends in less than 24 hours, and still can be done?
   
 =item advancedUser()  =item advancedUser()
   
 This puts a human-readable name on the env variable.  This puts a human-readable name on the env variable.
Line 759  sub getDescription { Line 764  sub getDescription {
             }              }
         }          }
         if ($due) {          if ($due) {
             return &mt("Due [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($due,'end'),$res->symb(),'duedate',$part)) .              my $now = time;
                 " $triesString";              if (($now >= $due) && ($overdue) && ($now < $overdue)) {
                   return &mt("Grace period ends [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($overdue,'end'),$res->symb(),'grace',$part)).
          " $triesString";
               } else {
                   return &mt("Due [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($due,'end'),$res->symb(),'duedate',$part)) .
                          " $triesString";
               }
         } else {          } else {
             return &Apache::lonhtmlcommon::direct_parm_link(&mt("No due date"),$res->symb(),'duedate',$part)." $triesString";              return &Apache::lonhtmlcommon::direct_parm_link(&mt("No due date"),$res->symb(),'duedate',$part)." $triesString";
         }          }
Line 794  sub lastTry { Line 805  sub lastTry {
         $res->duedate($part) > time();          $res->duedate($part) > time();
 }  }
   
   sub graceEndsUnder24Hours {
       my $res = shift;
       my $part = shift;
       my $status = $res->status($part);
       my $now = time();
   
       return ($status == $res->OPEN() ||
               $status == $res->TRIES_LEFT()) &&
               $res->duedate($part) && $res->duedate($part) < $now &&
               $res->overduedate($part) && $res->overduedate($part) < time()+(24*60*60) &&
               $res->duedate($part) && $res->duedate($part) < $now+(24*60*60) &&
               $res->overduedate($part) > $now;
   }
   
 sub advancedUser {  sub advancedUser {
     return $env{'request.role.adv'};      return $env{'request.role.adv'};
Line 1264  sub render_long_status { Line 1288  sub render_long_status {
         if (dueInLessThan24Hours($resource, $part)) {          if (dueInLessThan24Hours($resource, $part)) {
             $color = $hurryUpColor;              $color = $hurryUpColor;
             $info = ' title="'.&mt('Due in less than 24 hours!').'"';              $info = ' title="'.&mt('Due in less than 24 hours!').'"';
           } elsif (graceEndsUnder24Hours($resource, $part)) {
               $color = $hurryUpColor;
               $info = ' title="'.&mt('Grace period ends in less than 24 hours!').'"';
         } elsif (lastTry($resource, $part)) {          } elsif (lastTry($resource, $part)) {
             unless (($resource->problemstatus($part) eq 'no') ||              unless (($resource->problemstatus($part) eq 'no') ||
                     ($resource->problemstatus($part) eq 'no_feedback_ever')) {                      ($resource->problemstatus($part) eq 'no_feedback_ever')) {

Removed from v.1.576  
changed lines
  Added in v.1.577


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>