[LON-CAPA-cvs] cvs: modules /gerd/discussions eval.pl

www lon-capa-cvs@mail.lon-capa.org
Thu, 31 Mar 2005 14:59:49 -0000


www		Thu Mar 31 09:59:49 2005 EDT

  Modified files:              
    /modules/gerd/discussions	eval.pl 
  Log:
  Cleanup
  
  
Index: modules/gerd/discussions/eval.pl
diff -u modules/gerd/discussions/eval.pl:1.5 modules/gerd/discussions/eval.pl:1.6
--- modules/gerd/discussions/eval.pl:1.5	Tue Mar 29 10:50:48 2005
+++ modules/gerd/discussions/eval.pl	Thu Mar 31 09:59:49 2005
@@ -1,6 +1,38 @@
 use strict;
+#
+# Questions:
+# 1: multiple choice
+# 2: textual
+# 3: numerical
+# 4: formula
+# 5: multi-multi
+# 6: rank
+# 7: click
+# a: conv
+# b: rep-trans
+# c: context
+# 
+# Discussions:
+# 1: emotional pos
+# 2: emotional neg
+# 3: surface ques
+# 4: surface answ
+# 5: proc ques
+# 6: proc answ
+# 7: concept ques
+# 8: concept answ
+# a: unrel
+# b: solution
+# c: math
+# d: physics
+#
+
 my @q=();
+
+
+
 # index into the array
+
 my $course=0;
 my $type=1;
 my $diff=2;
@@ -65,55 +97,12 @@
 #
 # Analysis
 #
-# Difficulty versus type
-my @difficultycount=();
-my %typebydiff=();
-my %typecount=();
-my %typebytype=();
-foreach (@q) {
-   my @entries=split(/\,/,$_);
-   my $diffidx=int($entries[$diff]*10+0.5);
-   my $thistype=$entries[$type];
-   my $allcount=&allcount(@entries);
-   my $procedural=&procedural(@entries);
-   my $concept=&concept(@entries);
-   my $physics=&physics(@entries);
-   my $emotion=&emotion(@entries);
-   $difficultycount[$diffidx]+=$allcount;
-   $typebydiff{$diffidx.'_procedural'}+=$procedural;
-   $typebydiff{$diffidx.'_concept'}+=$concept;
-   $typebydiff{$diffidx.'_physics'}+=$physics;
-   $typebydiff{$diffidx.'_emotion'}+=$emotion;
-   $typecount{$thistype}+=$allcount;
-   $typebytype{$thistype.'_procedural'}+=$procedural;
-   $typebytype{$thistype.'_concept'}+=$concept;
-   $typebytype{$thistype.'_physics'}+=$physics;
-   $typebytype{$thistype.'_emotion'}+=$emotion;
-}
-
-print "\n==== Difficulty";
-for (my $i=0;$i<=10;$i++) {
-    print "\n$i,$difficultycount[$i],".
-    &twodec($typebydiff{$i.'_procedural'},$difficultycount[$i]).",".
-    &twodec($typebydiff{$i.'_concept'},$difficultycount[$i]).",".
-    &twodec($typebydiff{$i.'_physics'},$difficultycount[$i]).",".
-    &twodec($typebydiff{$i.'_emotion'},$difficultycount[$i]);
-}
-print "\n==== By Type";
-for (my $i=1;$i<=7;$i++) {
-   print "\n$i"."a,".$typecount{$i.'a'}.",".
-   &twodec($typebytype{$i.'a_procedural'},$typecount{$i.'a'}).",".
-   &twodec($typebytype{$i.'a_concept'},$typecount{$i.'a'}).",".
-   &twodec($typebytype{$i.'a_physics'},$typecount{$i.'a'}).",".
-   &twodec($typebytype{$i.'a_emotion'},$typecount{$i.'a'});
-   print "\n$i"."b,".$typecount{$i.'b'}.",".
-   &twodec($typebytype{$i.'b_procedural'},$typecount{$i.'b'}).",".
-   &twodec($typebytype{$i.'b_concept'},$typecount{$i.'b'}).",".
-   &twodec($typebytype{$i.'b_physics'},$typecount{$i.'b'}).",".
-   &twodec($typebytype{$i.'b_emotion'},$typecount{$i.'b'});
-}
+
 print "\n";
 
+
+# ======== End analysis, subroutines
+
 sub twodec {
    my ($val,$count)=@_;
    unless ($count) { return ''; }
@@ -131,51 +120,90 @@
 
 sub procedural {
    my @entries=@_;
-   return $entries[$disc{'5a'}]
-         +$entries[$disc{'5b'}]
+   return &procedural_question(@entries)
+         +&procedural_answer(@entries);
+}
+
+sub procedural_question {
+   my @entries=@_;
+   return $entries[$disc{'5b'}]
          +$entries[$disc{'5c'}]
-         +$entries[$disc{'5d'}]
-         +$entries[$disc{'6a'}]
-         +$entries[$disc{'6b'}]
+         +$entries[$disc{'5d'}];
+}
+
+sub procedural_answer {
+   my @entries=@_;
+   return $entries[$disc{'6b'}]
          +$entries[$disc{'6c'}]
          +$entries[$disc{'6d'}];
 }
 
+sub conceptual {
+   my @entries=@_;
+   return &conceptual_question(@entries)
+         +&conceptual_answer(@entries);
+}
 
-sub concept {
+sub conceptual_question {
    my @entries=@_;
-   return $entries[$disc{'7a'}]
-         +$entries[$disc{'7b'}]
+   return $entries[$disc{'7b'}]
          +$entries[$disc{'7c'}]
-         +$entries[$disc{'7d'}]
-         +$entries[$disc{'8a'}]
-         +$entries[$disc{'8b'}]
+         +$entries[$disc{'7d'}];
+}
+
+sub conceptual_answer {
+   my @entries=@_;
+   return $entries[$disc{'8b'}]
          +$entries[$disc{'8c'}]
          +$entries[$disc{'8d'}];
 }
 
 sub physics {
    my @entries=@_;
-   return
-          $entries[$disc{'3d'}]
-         +$entries[$disc{'4d'}]
+   return &physics_question(@entries)
+         +&physics_answer(@entries);
+}        
+
+sub physics_question {
+   my @entries=@_;
+   return $entries[$disc{'3d'}]
          +$entries[$disc{'5d'}]
+         +$entries[$disc{'7d'}];
+}        
+
+sub physics_answer {
+   my @entries=@_;
+   return $entries[$disc{'4d'}]
          +$entries[$disc{'6d'}]
-         +$entries[$disc{'7d'}]
          +$entries[$disc{'8d'}];
 }        
 
+sub math {
+   my @entries=@_;
+   return &math_question(@entries)
+         +&math_answer(@entries);
+}        
+
+sub math_question {
+   my @entries=@_;
+   return $entries[$disc{'3c'}]
+         +$entries[$disc{'5c'}]
+         +$entries[$disc{'7c'}];
+}        
+
+sub math_answer {
+   my @entries=@_;
+   return $entries[$disc{'4c'}]
+         +$entries[$disc{'6c'}]
+         +$entries[$disc{'8c'}];
+}        
+
 sub emotion {
    my @entries=@_;
-   return 
-          $entries[$disc{'1b'}]
+   return $entries[$disc{'1b'}]
          +$entries[$disc{'1c'}]
          +$entries[$disc{'1d'}]
          -$entries[$disc{'2b'}]
          -$entries[$disc{'2c'}]
          -$entries[$disc{'2d'}];
 }        
-
-
-
-