Diff for /loncom/homework/structuretags.pm between versions 1.284 and 1.285

version 1.284, 2005/04/07 06:56:22 version 1.285, 2005/04/18 21:10:41
Line 317  sub initialize_storage { Line 317  sub initialize_storage {
 # Stores away the result has to a student's environment  # Stores away the result has to a student's environment
 # checks form.grade_ for specific values, other wises stores  # checks form.grade_ for specific values, other wises stores
 # to the running users environment  # to the running users environment
   # Will increment totals for attempts, students, and corrects
   # if running user has student role.  
 sub finalize_storage {  sub finalize_storage {
     my $result;      my $result;
     my ($temp) = keys %Apache::lonhomework::results;      my ($temp) = keys %Apache::lonhomework::results;
Line 331  sub finalize_storage { Line 333  sub finalize_storage {
     $result=&Apache::lonnet::cstore(\%Apache::lonhomework::results,      $result=&Apache::lonnet::cstore(\%Apache::lonhomework::results,
     $symb,$courseid,$domain,$name);      $symb,$courseid,$domain,$name);
     &Apache::lonxml::debug('Store return message:'.$result);      &Apache::lonxml::debug('Store return message:'.$result);
               if ($env{'request.role'} =~/^st/) {
                   &store_aggregates($symb,$courseid);
               }
  }   }
     }      }
     return $result;      return $result;
 }  }
   
   # -------------------------------------------------------------store_aggregates
   # Sends hash of values to be incremented in nohist_resourcetracker.db
   # for the course. Increments total number of attempts, unique students 
   # and corrects for each part for an instance of a problem, as appropriate.
   sub store_aggregates {
       my ($symb,$courseid) = @_;
       my %aggregate = ();
       my @parts = ();
       my ($cdomain,$cname) = split/_/,$courseid;
       foreach my $key (keys %Apache::lonhomework::results) {
           if ($key =~ /resource\.(\d+)\.tries/) {
               push @parts, $1;
           }
       }
       foreach (@parts) {
           if ($Apache::lonhomework::results{'resource.'.$_.'.award'} eq 'APPROX_ANS' || $Apache::lonhomework::results{'resource.'.$_.'.award'} eq 'EXACT_ANS') {
               $aggregate{$symb.'_'.$_.'_correct'} = 1;
           }
           if ($Apache::lonhomework::results{'resource.'.$_.'.tries'} == 1) {
               $aggregate{$symb.'_'.$_.'_users'} = 1;
           }
           $aggregate{$symb.'_'.$_.'_attempts'} = 1;
       }
       &Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,$cdomain,$cname); 
   }
   
 sub checkout_msg {  sub checkout_msg {
     my %lt=&Apache::lonlocal::texthash(       my %lt=&Apache::lonlocal::texthash( 
  'resource'=>'The resource needs to be checked out',   'resource'=>'The resource needs to be checked out',

Removed from v.1.284  
changed lines
  Added in v.1.285


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