[LON-CAPA-cvs] cvs: loncom /homework grades.pm

www www at source.lon-capa.org
Fri Dec 2 20:16:39 EST 2011


www		Sat Dec  3 01:16:39 2011 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  Turning Technologies clicker support
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.665 loncom/homework/grades.pm:1.666
--- loncom/homework/grades.pm:1.665	Wed Nov 30 23:24:49 2011
+++ loncom/homework/grades.pm	Sat Dec  3 01:16:39 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.665 2011/11/30 23:24:49 raeburn Exp $
+# $Id: grades.pm,v 1.666 2011/12/03 01:16:39 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -8913,7 +8913,8 @@
     my $pincorrect=&mt("Percentage points for incorrect solution");
     my $selectform=&Apache::loncommon::select_form($env{'form.upfiletype'},'upfiletype',
 						   {'iclicker' => 'i>clicker',
-                                                    'interwrite' => 'interwrite PRS'});
+                                                    'interwrite' => 'interwrite PRS',
+                                                    'turning' => 'Turning Technologies'});
     $symb = &Apache::lonenc::check_encrypt($symb);
     $result.= &Apache::lonhtmlcommon::scripttag(<<ENDUPFORM);
 function sanitycheck() {
@@ -9087,6 +9088,9 @@
     if ($env{'form.upfiletype'} eq 'interwrite') {
         ($errormsg,$number)=&interwrite_eval(\@questiontitles,\%responses);
     }
+    if ($env{'form.upfiletype'} eq 'turning') {
+        ($errormsg,$number)=&turning_eval(\@questiontitles,\%responses);
+    }
     $result.='<br />'.&mt('Found [_1] question(s)',$number).'<br />'.
              '<input type="hidden" name="number" value="'.$number.'" />'.
              &mt('Awarding [_1] percent for correct and [_2] percent for incorrect responses',
@@ -9223,6 +9227,32 @@
     return ($errormsg,$number);
 }
 
+sub turning_eval {
+    my ($questiontitles,$responses)=@_;
+    my $number=0;
+    my $errormsg='';
+    foreach my $line (split(/[\n\r]/,$env{'form.upfile'})) {
+        my %components=&Apache::loncommon::record_sep($line);
+        my @entries=map {$components{$_}} (sort(keys(%components)));
+        if ($#entries>$number) { $number=$#entries; }
+        my $id=$entries[0];
+        my @idresponses;
+        $id=~s/^[\#0]+//;
+        unless ($id) { next; }
+        for (my $idx=1;$idx<=$#entries;$idx++) {
+            $entries[$idx]=~s/\,/\;/g;
+            $entries[$idx]=~s/[^a-zA-Z0-9\.\*\-\+\;]+//g;
+            push(@idresponses,$entries[$idx]);
+        }
+        $$responses{$id}=join(',', at idresponses);
+    }
+    for (my $i=1; $i<=$number; $i++) {
+        $$questiontitles[$i]=&mt('Question [_1]',$i);
+    }
+    return ($errormsg,$number);
+}
+
+
 sub assign_clicker_grades {
     my ($r,$symb)=@_;
     if (!$symb) {return '';}




More information about the LON-CAPA-cvs mailing list