Diff for /loncom/publisher/testbankimport.pm between versions 1.1 and 1.4

version 1.1, 2004/02/17 23:03:34 version 1.4, 2004/04/23 22:42:05
Line 1 Line 1
   # Handler for parsing text upload problem descriptions into .problems
   # $Id$
   #
   # Copyright Michigan State University Board of Trustees
   #
   # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
   #
   # LON-CAPA is free software; you can redistribute it and/or modify
   # it under the terms of the GNU General Public License as published by
   # the Free Software Foundation; either version 2 of the License, or
   # (at your option) any later version.
   #
   # LON-CAPA is distributed in the hope that it will be useful,
   # but WITHOUT ANY WARRANTY; without even the implied warranty of
   # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   # GNU General Public License for more details.
   #
   # You should have received a copy of the GNU General Public License
   # along with LON-CAPA; if not, write to the Free Software
   # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   #
   # /home/httpd/html/adm/gpl.txt
   #
   # http://www.lon-capa.org/
   #
   
 package Apache::testbankimport;  package Apache::testbankimport;
   
     use strict;  use strict;
     use Apache::Constants qw(:common :http :methods);  use Apache::Constants qw(:common :http :methods);
     use Apache::loncacc;  use Apache::loncacc;
     use Apache::loncommon();  use Apache::loncommon();
     use Apache::Log();  use Apache::Log();
     use Apache::lonnet;  use Apache::lonnet;
     use HTML::Entities();  use HTML::Entities();
     use Apache::lonlocal;  use Apache::lonlocal;
     use Apache::lonupload;  use Apache::lonupload;
     use File::Basename();  use File::Basename();
   
 # ---------------------------------------------------------------- Display Control  # ---------------------------------------------------------------- Display Control
 sub display_control {  sub display_control {
Line 1104  sub final_display { Line 1130  sub final_display {
                 for (my $k=$numitems+$start[$i]-1; $k<$numitems+$end[$i]; $k++) {                  for (my $k=$numitems+$start[$i]-1; $k<$numitems+$end[$i]; $k++) {
                     @{$answers{$k}} = ();                      @{$answers{$k}} = ();
                     if ($qtype[$i] eq "MC") {                      if ($qtype[$i] eq "MC") {
                         lc $items[$k];                          $items[$k] =~ tr/A-Z/a-z/;
                         $items[$k] =~ s/\W//g;                          $items[$k] =~ s/\W//g;
                         if ($foilformats[$i] eq "lcperiod" || $foilformats[$i] eq "lcparen" || $foilformats[$i] eq "ucparen" || $foilformats[$i] eq "ucperiod") {                          if ($foilformats[$i] eq "lcperiod" || $foilformats[$i] eq "lcparen" || $foilformats[$i] eq "ucparen" || $foilformats[$i] eq "ucperiod") {
                             for (my $j=0; $j<@alphabet; $j++) {                              for (my $j=0; $j<@alphabet; $j++) {
Line 1122  sub final_display { Line 1148  sub final_display {
                             }                              }
                         }                          }
                     } elsif (($qtype[$i] eq "MA") || ($qtype[$i] eq "Ord")) {                      } elsif (($qtype[$i] eq "MA") || ($qtype[$i] eq "Ord")) {
                         lc $items[$k];                          $items[$k] =~ tr/A-Z/a-z/;
                         my @corrects = split/$patterns{$ansrtypes[$i]}/,$items[$k];                          my @corrects = split/$patterns{$ansrtypes[$i]}/,$items[$k];
                         foreach my $correct (@corrects) {                          foreach my $correct (@corrects) {
                             $correct =~s/\W//g;                              $correct =~s/\W//g;
Line 1521  sub create_mcq { Line 1547  sub create_mcq {
                 $tol = 5;                  $tol = 5;
                 $numans = $$answerref[0];                  $numans = $$answerref[0];
             } else {              } else {
                 my $min = 0;                  my $min = $$answerref[0];
                 my $max = 0;                      my $max = $$answerref[0];    
                 for (my $i=0; $i<@{$answerref}; $i++) {                  for (my $i=1; $i<@{$answerref}; $i++) {
                     if ($$answerref[$i]<$min) {                      if ($$answerref[$i]<=$min) {
                         $min = $$answerref[$i];                          $min = $$answerref[$i];
                     } elsif ($$answerref[$i] > $max) {                      } elsif ($$answerref[$i] >= $max) {
                         $max = $$answerref[$i];                          $max = $$answerref[$i];
                     }                      }
                 }                  }

Removed from v.1.1  
changed lines
  Added in v.1.4


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