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

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 29 Apr 2006 18:00:20 -0000


albertel		Sat Apr 29 14:00:20 2006 EDT

  Modified files:              
    /loncom/interface	loncoursedata.pm 
  Log:
  - adding task support to the cached data tables for response level data
  
  
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.164 loncom/interface/loncoursedata.pm:1.165
--- loncom/interface/loncoursedata.pm:1.164	Fri Apr 28 17:58:37 2006
+++ loncom/interface/loncoursedata.pm	Sat Apr 29 14:00:17 2006
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursedata.pm,v 1.164 2006/04/28 21:58:37 albertel Exp $
+# $Id: loncoursedata.pm,v 1.165 2006/04/29 18:00:17 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1002,7 +1002,60 @@
             next;
         } elsif ($parameter eq 'version') {
             next;
-        } elsif ($parameter =~ /^resource\.(.*)\.(tries|
+	} elsif (&symb_is_for_task($symb)) {
+	    next if ($parameter !~ /^resource\.(.*)\.(award|
+						      awarded|
+						      solved|
+						      submission|
+						      portfiles|
+						      status|
+						      version|
+						      regrader)\s*$/x);
+	    my ($version_and_part_id, $field) = ($1,$2);
+
+	    next if ($version_and_part_id !~ /\./ 
+		     && $field ne 'regrader' && $field ne 'version');
+
+	    my ($version, $part, $instance) = 
+		split(/\./,$version_and_part_id);
+
+	    #skip and instance dimension or criteria specific data
+	    next if (defined($instance) 
+		     && $instance ne $field
+		     && $instance ne 'bridgetask');
+	    
+	    if (!defined($part)) {
+		$part = $version;
+	    }
+	    my $resp_id = &get_part_id('0');
+	    my $part_id = &get_part_id($part);
+	    
+	    if ($field eq 'version') {
+		# for tasks each version is an attempt at it thus
+		#     version -> tries
+		$partdata->{$symb_id}{$part_id}{$transaction}{'tries'}=
+		    $value;
+		# at new version time the record gets reset thus adding a
+		# virtual response awarddetail of 'new_version'
+		$respdata->{$symb_id}{$part_id}{$resp_id}{$transaction}{'response_specific'}='status';
+		$respdata->{$symb_id}{$part_id}{$resp_id}{$transaction}{'response_specific_value'}='new_version';
+
+	    } elsif ($field eq 'award' || $field eq 'awarded' 
+		     || $field eq 'solved') {
+		$partdata->{$symb_id}{$part_id}{$transaction}{$field}=
+		    $value;
+	    } elsif ($field eq 'portfiles') {
+		# tasks only accepts portfolio submissions
+		$value = $dbh->quote($value);
+		$respdata->{$symb_id}{$part_id}{$resp_id}{$transaction}{'submission'}=$value;
+	    } elsif ($field eq 'status') {
+		$respdata->{$symb_id}{$part_id}{$resp_id}{$transaction}{'response_specific'}=$field;
+		$respdata->{$symb_id}{$part_id}{$resp_id}{$transaction}{'response_specific_value'}=$value;
+	    } elsif ($field eq 'regrader') {
+		$respdata->{$symb_id}{$part_id}{$resp_id}{$transaction}{'response_specific_2'}=$field;
+		$respdata->{$symb_id}{$part_id}{$resp_id}{$transaction}{'response_specific_value_2'}=$value;
+	    }
+	} elsif ($parameter =~ /^resource\.(.*)\.(tries|
                                                   award|
                                                   awarded|
                                                   previous|