Diff for /loncom/homework/functionplotresponse.pm between versions 1.35 and 1.36

version 1.35, 2010/11/12 02:16:20 version 1.36, 2010/11/12 22:23:40
Line 31  use strict; Line 31  use strict;
 use Apache::response();  use Apache::response();
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::lonnet;  use Apache::lonnet;
    
 BEGIN {  BEGIN {
   &Apache::lonxml::register('Apache::functionplotresponse',('functionplotresponse','backgroundplot','spline','functionplotrule'));    &Apache::lonxml::register('Apache::functionplotresponse',('functionplotresponse','backgroundplot','spline','functionplotrule'));
 }  }
Line 396  sub start_functionplotrule { Line 396  sub start_functionplotrule {
           )));            )));
    } elsif ($target eq 'edit') {     } elsif ($target eq 'edit') {
         $result=&Apache::edit::tag_start($target,$token,'Function Plot Evaluation Rule').          $result=&Apache::edit::tag_start($target,$token,'Function Plot Evaluation Rule').
              &Apache::edit::text_arg('Index:','index',               &Apache::edit::text_arg('Index/Name:','index',
                                      $token,'4').' '.                                       $token,'10').' '.
              &Apache::edit::select_arg(&mt('Function:'),'derivativeorder',               &Apache::edit::select_arg(&mt('Function:'),'derivativeorder',
                                   [['0','Function itself'],                                    [['0','Function itself'],
                                    ['1','First derivative'],                                     ['1','First derivative'],
Line 784  sub start_functionplotresponse { Line 784  sub start_functionplotresponse {
   
 sub compare_rel {  sub compare_rel {
    my ($relationship,$value,$realval,$tol)=@_;     my ($relationship,$value,$realval,$tol)=@_;
 # is the real value defined?  # is the real value undefined?
    unless (defined($realval)) {     unless (defined($realval)) {
   # the real value is not defined
       if ($relationship eq 'eq') {        if ($relationship eq 'eq') {
          if ($value eq 'undef') {           if ($value eq 'undef') {
             return 1;              return 1;
Line 803  sub compare_rel { Line 804  sub compare_rel {
       }        }
    }     }
   
 # it is defined.  # is the expected value undefined?
      if ($value eq 'undef') {
   # but by now we know that the real value is defined
         return 0;
      }
   
   # both are defined.
    if ($relationship eq 'gt') {     if ($relationship eq 'gt') {
       return ($realval>$value);        return ($realval>$value);
    } elsif ($relationship eq 'ge') {     } elsif ($relationship eq 'ge') {
Line 905  sub functionplotrulecheck { Line 912  sub functionplotrulecheck {
         } else {          } else {
            $val=$Apache::functionplotresponse::func[$i];             $val=$Apache::functionplotresponse::func[$i];
         }          }
           &addlog("Actual value ".(defined($val)?$val:'undef').", expected $value, tolerance $tol");
         unless (&compare_rel($relationship,$value,$val,$tol)) {           unless (&compare_rel($relationship,$value,$val,$tol)) { 
            &addlog("Condition not fulfilled at x=".&actualval($i,$xmin,$xmax)." (".$Apache::functionplotresponse::actualxval[$i]."; index $i)");             &addlog("Condition not fulfilled at x=".&actualval($i,$xmin,$xmax)." (".$Apache::functionplotresponse::actualxval[$i]."; index $i)");
            &addlog("Actual value ".(defined($val)?$val:'undef').", expected $value, tolerance $tol");  
            if (($findupper) && ($i>$li)) {             if (($findupper) && ($i>$li)) {
 # check for minimum and maximum lengths  # check for minimum and maximum lengths
               my $length=&actualval($i,$xmin,$xmax)-&actualval($li,$xmin,$xmax);                my $length=&actualval($i,$xmin,$xmax)-&actualval($li,$xmin,$xmax);
Line 945  sub end_functionplotresponse { Line 952  sub end_functionplotresponse {
   my $partid=$Apache::inputtags::part;    my $partid=$Apache::inputtags::part;
   my $internalid = $partid.'_'.$id;    my $internalid = $partid.'_'.$id;
   
   
     if ($target eq 'edit') { $result=&Apache::edit::end_table(); }      if ($target eq 'edit') { $result=&Apache::edit::end_table(); }
     if ($target eq 'grade'      if ($target eq 'grade'
          && &Apache::response::submitted()           && &Apache::response::submitted()

Removed from v.1.35  
changed lines
  Added in v.1.36


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