Diff for /loncom/interface/lonplacementtest.pm between versions 1.2 and 1.5

version 1.2, 2016/04/04 15:56:58 version 1.5, 2016/05/30 03:16:28
Line 1 Line 1
 # The LearningOnline Network with CAPA  # The LearningOnline Network with CAPA
 # Handler to manage dependencies for HTML files uploaded directly  # Handler for a Placement Test course container 
 # to a course.  
 #  #
 # $Id$  # $Id$
 #  #
Line 20 Line 19
 #  #
 # You should have received a copy of the GNU General Public License  # You should have received a copy of the GNU General Public License
 # along with LON-CAPA; if not, write to the Free Software  # along with LON-CAPA; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA#  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
   #
 # /home/httpd/html/adm/gpl.txt  # /home/httpd/html/adm/gpl.txt
 #  #
 # http://www.lon-capa.org/  # http://www.lon-capa.org/
Line 120  sub check_completion { Line 120  sub check_completion {
     my $incomplete;      my $incomplete;
     if (@resources) {      if (@resources) {
         my $firstsymb = $resources[0]->symb();          my $firstsymb = $resources[0]->symb();
         my %bytitle;          my (%bytitle,%bysymb);
         foreach my $res (@resources) {          foreach my $res (@resources) {
             my $currsymb = $res->symb();              my $currsymb = $res->symb();
             my $title = $res->compTitle;              my $title = $res->compTitle;
             unless (exists($bytitle{$title})) {              unless (exists($bytitle{$title})) {
                 $bytitle{$title} = 0;                  $bytitle{$title} = 0;
             }              }
               unless (exists($bysymb{$currsymb})) {
                   $bysymb{$currsymb} = 0;
               }
             my $notdone = 0;              my $notdone = 0;
             my $done = 0;              my $done = 0;
             my %storetries;              my %storetries;
Line 171  sub check_completion { Line 174  sub check_completion {
                 $totaldone += $done;                  $totaldone += $done;
             }              }
             $bytitle{$title} += $points;              $bytitle{$title} += $points;
               $bysymb{$currsymb} += $points;
             $totalpoints += $points;              $totalpoints += $points;
         }          }
         if ($makenew) {          if ($makenew) {
Line 180  sub check_completion { Line 184  sub check_completion {
                                                              4,$newmax,'int_pos',                                                               4,$newmax,'int_pos',
                                                              $env{'user.name'},                                                               $env{'user.name'},
                                                              $env{'user.domain'});                                                               $env{'user.domain'});
             my %grades = (              my $user = $env{'user.name'}.':'.$env{'user.domain'};
                              uname   => $env{'user.name'},              if ($user) {
                              domain  => $env{'user.domain'},                  my %grades = (
                              total   => $totalpoints,                                 $user => {
                              bytitle => \%bytitle,                                            role            => $env{'request.role'},
                          );                                            id              => $env{'environment.id'},
             my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};                                            status          => $env{'environment.inststatus'},
             my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};                                            lastname        => $env{'environment.lastname'},
             if (($cnum ne '') && ($cdom ne '')) {                                            firstname       => $env{'environment.firstname'},
                 &Apache::lonnet::auto_export_grades($cnum,$cdom,\%grades);                                            permanentemail  => $env{'environment.permanentemail'},
                                             section         => $env{'request.course.sec'},
                                             total           => $totalpoints,
                                             category        => '',
                                             gradebookcolumn => '',
                                             context         => $map,
                                           },
                                );
                   $grades{$user}{bytitle} = \%bytitle;
                   $grades{$user}{bysymb} = \%bysymb;
                   my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
                   my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
                   my $scope = 'map';
                   my $instcode = $env{'course.'.$env{'request.course.id'}.'.internal.coursecode'};
                   my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
                   my $context = 'completion';
                   if (($cnum ne '') && ($cdom ne '')) {
                       my %info = (
                                     scope    => $scope,
                                     instcode => $instcode,
                                     crstype  => $crstype,
                                     context  => $context, 
                                  ); 
                       my $response = &Apache::lonnet::auto_export_grades($cdom,$cnum,\%info,\%grades);
                       my $outcome;
                       if (ref($response) eq 'HASH') {
                           if ($response->{$user}) {
                               $outcome = 'ok';
                           } else {
                               $outcome = 'fail';
                           }
                       } else {
                           $outcome = $response;
                       }
                       unless ($outcome eq 'ok') {
                           &Apache::lonnet::logthis("Placement Test grade export for $env{'user.name'}:$env{'user.domain'} in $env{'request.course.id'} was: $outcome"); 
                       }
                   }
             }              }
         }          }
     }      }
Line 245  sub showresult { Line 286  sub showresult {
     my ($score) = &Apache::lonplacementtest::check_completion(1,undef,1);      my ($score) = &Apache::lonplacementtest::check_completion(1,undef,1);
     my %aclt = &test_action_text();      my %aclt = &test_action_text();
     my $output;      my $output;
     unless ($inhibitmenu) {      if ($inhibitmenu) {
           $output = '<hr />';
       } else {
         my $brcrum = [{'href' => '/adm/flip?postdata=firstres%3a',          my $brcrum = [{'href' => '/adm/flip?postdata=firstres%3a',
                        'text' => 'Test Status'},];                         'text' => 'Test Status'},];
         $output = &Apache::loncommon::start_page('Placement Test Completed',          $output = &Apache::loncommon::start_page('Placement Test Completed',
Line 270  sub showincomplete { Line 313  sub showincomplete {
     my %aclt = &test_action_text();      my %aclt = &test_action_text();
     my $output;      my $output;
     if ($incomplete == 100) {      if ($incomplete == 100) {
         unless ($inhibitmenu) {          if ($inhibitmenu) {
               $output = '<hr />';
           } else {
             my $brcrum = [{'href' => '/adm/flip?postdata=firstres%3a',              my $brcrum = [{'href' => '/adm/flip?postdata=firstres%3a',
                            'text' => 'Test Status'},];                             'text' => 'Test Status'},];
             $output = &Apache::loncommon::start_page('Placement Test Unattempted',              $output = &Apache::loncommon::start_page('Placement Test Unattempted',
Line 284  sub showincomplete { Line 329  sub showincomplete {
                        '<a href="/adm/logout">'.$aclt{'exit'}.'</a></li>',                         '<a href="/adm/logout">'.$aclt{'exit'}.'</a></li>',
                       ]);                        ]);
     } elsif ($incomplete) {      } elsif ($incomplete) {
         unless ($inhibitmenu) {          if ($inhibitmenu) {
               $output = '<hr />';
           } else {
             my $brcrum = [{'href' => '/adm/flip?postdata=endplacement%3a',              my $brcrum = [{'href' => '/adm/flip?postdata=endplacement%3a',
                            'text' => 'Test Status'},];                             'text' => 'Test Status'},];
             $output .=  &Apache::loncommon::start_page('Incomplete Placement Test',              $output .=  &Apache::loncommon::start_page('Incomplete Placement Test',

Removed from v.1.2  
changed lines
  Added in v.1.5


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