[LON-CAPA-cvs] cvs: loncom /interface lonwhatsnew.pm

raeburn raeburn at source.lon-capa.org
Tue Sep 1 18:25:27 EDT 2020


raeburn		Tue Sep  1 22:25:27 2020 EDT

  Modified files:              
    /loncom/interface	lonwhatsnew.pm 
  Log:
  - Look for essayresponse items when checking for handgraded problems for
    consistency with grades.pm
  - Retain use of resource->handgrade(part) when checking for tasks.
  - For ungraded tasks, link should be to resource not to /adm/grades    
  
  
Index: loncom/interface/lonwhatsnew.pm
diff -u loncom/interface/lonwhatsnew.pm:1.127 loncom/interface/lonwhatsnew.pm:1.128
--- loncom/interface/lonwhatsnew.pm:1.127	Mon Mar 30 16:26:46 2020
+++ loncom/interface/lonwhatsnew.pm	Tue Sep  1 22:25:27 2020
@@ -1,5 +1,7 @@
+# The LearningOnline Network
+# What's New in a course
 #
-# $Id: lonwhatsnew.pm,v 1.127 2020/03/30 16:26:46 raeburn Exp $
+# $Id: lonwhatsnew.pm,v 1.128 2020/09/01 22:25:27 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1121,12 +1123,23 @@
 sub check_handgraded {
     my ($resource,$symb,$title,$cdom,$cnum,$ungraded,$tograde) = @_;
     if ($resource->is_problem()) {
-        my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);
+        my ($handgradeable,$is_task);
         my $partlist=$resource->parts();
-        my $handgradeable;
-        foreach my $part (@$partlist) {
-            if ($resource->handgrade($part) eq 'yes') {
-                $handgradeable=1; last;
+        if ($resource->is_task()) {
+            $is_task = 1;
+            foreach my $part (@$partlist) {
+                if ($resource->handgrade($part) eq 'yes') {
+                    $handgradeable=1;
+                    last;
+                }
+            }
+        } else {
+            foreach my $part (@$partlist) {
+                my @types = $resource->responseType($part);
+                if (grep(/^essay$/, at types)) {
+                    $handgradeable=1;
+                    last;
+                }
             }
         }
         if ($handgradeable) {
@@ -1135,6 +1148,7 @@
             if (@ungraded > 0) {
                 $$ungraded{$symb}{count} = scalar(@ungraded);
                 $$ungraded{$symb}{title} = $title;
+                $$ungraded{$symb}{is_task} = $is_task;
                 if ($resource->encrypted()) {
                     $$ungraded{$symb}{'enclink'} = $resource->link();
                     $$ungraded{$symb}{'encsymb'} = $resource->shown_symb();
@@ -1800,13 +1814,24 @@
         foreach my $res (@{$tograde}) {
             $rowNum ++;
             my $css_class = $rowNum%2?' class="LC_odd_row"':'';
-            my $linkurl='/adm/grades';
-            if ($$ungraded{$res}{'enclink'}) {
-                $linkurl.='?symb='.$$ungraded{$res}{'encsymb'};
+            my $linkurl;
+            if ($$ungraded{$res}{'is_task'}) {
+                my ($map,$id,$url)=&Apache::lonnet::decode_symb($res);
+                $linkurl=&Apache::lonnet::clutter($url);
+                $linkurl .= '?symb='.&escape($res);
+                if ($$ungraded{$res}{'enclink'}) {
+                    $linkurl =
+                        $$ungraded{$res}{'enclink'}.'?symb='.$$ungraded{$res}{'encsymb'};
+                }
             } else {
-                $linkurl.='?symb='.&escape($res);
+                $linkurl='/adm/grades';
+                if ($$ungraded{$res}{'enclink'}) {
+                    $linkurl.='?symb='.$$ungraded{$res}{'encsymb'};
+                } else {
+                    $linkurl.='?symb='.&escape($res);
+                }
+                $linkurl.='&command=ungraded';
             }
-            $linkurl.='&command=ungraded';
             $r->print('<tr'.$css_class.'><td><a href="'.$linkurl.'">'.$$ungraded{$res}{title}.'</a></td><td class="LC_right_item">'.$$ungraded{$res}{count}.'</td></tr>');
         }
     } elsif ($itemserror) {




More information about the LON-CAPA-cvs mailing list