--- loncom/interface/loncoursedata.pm 2003/10/20 20:42:39 1.105 +++ loncom/interface/loncoursedata.pm 2004/02/17 19:56:30 1.117 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: loncoursedata.pm,v 1.105 2003/10/20 20:42:39 matthew Exp $ +# $Id: loncoursedata.pm,v 1.117 2004/02/17 19:56:30 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -73,8 +73,6 @@ and/or itself. =item &get_sequence_assessment_data() -AT THIS TIME THE USE OF THIS FUNCTION IS *NOT* RECOMMENDED - Use lonnavmaps to build a data structure describing the order and assessment contents of each sequence in the current course. @@ -190,6 +188,10 @@ sub get_sequence_assessment_data { $title =~ s/\:/\&\#058;/g; $symb = $curRes->symb(); $src = $curRes->src(); + # Grab the filename if there is not title available + if (! defined($title) || $title eq '') { + ($title) = ($src=~ m:/([^/]*)$:); + } my $parts = $curRes->parts(); my %partdata; foreach my $part (@$parts) { @@ -399,21 +401,13 @@ characters) and a KEY on 'part_id'. =item $student_table -The student_table has two columns. The first is a 'student_id' and the second -is the text description of the 'student' (typically username:domain) (less -than 100 characters). The 'student_id' is automatically generated by MySQL. -The use of the name 'student_id' is loaded, I know, but this ID is used ONLY -internally to the MySQL database and is not the same as the students ID -(stored in the students environment). This table has its PRIMARY KEY on the -'student' (100 characters). - -=item $studentdata_table - -The studentdata_table has four columns: 'student_id' (the unique id of -the student), 'updatetime' (the time the students data was last updated), -'fullupdatetime' (the time the students full data was last updated), -'section', and 'classification'( the students current classification). -This table has its PRIMARY KEY on 'student_id'. +The student_table has 7 columns. The first is a 'student_id' assigned by +MySQL. The second is 'student' which is username:domain. The third through +fifth are 'section', 'status' (enrollment status), and 'classification' +(to be used in the future). The sixth and seventh ('updatetime' and +'fullupdatetime') contain the time of last update and full update of student +data. This table has its PRIMARY KEY on the 'student_id' column and is indexed +on 'student', 'section', and 'status'. =back @@ -519,7 +513,6 @@ my $current_course =''; my $symb_table; my $part_table; my $student_table; -my $studentdata_table; my $performance_table; my $parameters_table; my $fulldump_response_table; @@ -595,30 +588,24 @@ sub init_dbs { auto_inc => 'yes', }, { name => 'student', type => 'VARCHAR(100)', + restrictions => 'NOT NULL UNIQUE'}, + { name => 'section', + type => 'VARCHAR(100)', + restrictions => 'NOT NULL'}, + { name => 'status', + type => 'VARCHAR(15)', restrictions => 'NOT NULL'}, { name => 'classification', type => 'varchar(100)', }, - ], - 'PRIMARY KEY' => ['student (100)'], - 'KEY' => [{ columns => ['student_id']},], - }; - # - my $studentdata_table_def = { - id => $studentdata_table, - permanent => 'no', - columns => [{ name => 'student_id', - type => 'MEDIUMINT UNSIGNED', - restrictions => 'NOT NULL UNIQUE',}, { name => 'updatetime', type => 'INT UNSIGNED'}, { name => 'fullupdatetime', type => 'INT UNSIGNED'}, - { name => 'section', - type => 'VARCHAR(100)'}, - { name => 'classification', - type => 'VARCHAR(100)', }, ], 'PRIMARY KEY' => ['student_id'], + 'KEY' => [{ columns => ['student (100)', + 'section (100)', + 'status (15)',]},], }; # my $performance_table_def = { @@ -796,13 +783,6 @@ sub init_dbs { return 3; } # - $tableid = &Apache::lonmysql::create_table($studentdata_table_def); - if (! defined($tableid)) { - &Apache::lonnet::logthis("error creating studentdata_table: ". - &Apache::lonmysql::get_error()); - return 4; - } - # $tableid = &Apache::lonmysql::create_table($performance_table_def); if (! defined($tableid)) { &Apache::lonnet::logthis("error creating preformance_table: ". @@ -1039,8 +1019,9 @@ sub get_student_id { $have_read_student_table = 1; } if (! exists($ids_by_student{$student})) { - &Apache::lonmysql::store_row($student_table,[undef,$student,undef]); + &populate_student_table(); undef(%ids_by_student); + undef(%students_by_id); my @Result = &Apache::lonmysql::get_rows($student_table); foreach (@Result) { $ids_by_student{$_->[1]}=$_->[0]; @@ -1064,6 +1045,39 @@ sub get_student { return undef; # error } +sub populate_student_table { + my ($courseid) = @_; + if (! defined($courseid)) { + $courseid = $ENV{'request.course.id'}; + } + # + &setup_table_names($courseid); + my $dbh = &Apache::lonmysql::get_dbh(); + my $request = 'INSERT IGNORE INTO '.$student_table. + "(student,section,status) VALUES "; + my $classlist = &get_classlist($courseid); + my $student_count=0; + while (my ($student,$data) = each %$classlist) { + my ($section,$status) = ($data->[&CL_SECTION()], + $data->[&CL_STATUS()]); + if ($section eq '' || $section =~ /^\s*$/) { + $section = 'none'; + } + $request .= "('".$student."','".$section."','".$status."'),"; + $student_count++; + } + return if ($student_count == 0); + chop($request); + $dbh->do($request); + if ($dbh->err()) { + &Apache::lonnet::logthis("error ".$dbh->errstr(). + " occured executing \n". + $request); + } + return; +} + + ################################################ ################################################ @@ -1122,8 +1136,7 @@ a description of the error. Once the "fulldump" tables are updated, the tables used for chart and spreadsheet (which hold only the current state of the student on their homework, not historical data) are updated. If all updates have occured -successfully, the studentdata table is updated to reflect the time of the -update. +successfully, $student_table is updated to reflect the time of the update. Notice we do not insert the data and immediately query it. This means it is possible for there to be data returned this first time that is not @@ -1222,11 +1235,7 @@ sub update_full_student_data { # However, there is one wrinkle: submissions which end in # and odd number of '\' cause insert errors to occur. # Best trap this somehow... - $value =~ s/\'/\\\'/g; - my ($offensive_string) = ($value =~ /(\\+)$/); - if (length($offensive_string) % 2) { - $value =~ s/\\$/\\\\/; - } + $value = $dbh->quote($value); } if ($field eq 'submissiongrading' || $field eq 'molecule') { @@ -1275,13 +1284,21 @@ sub update_full_student_data { while (my ($part_id,$hash2) = each (%$hash1)) { while (my ($resp_id,$hash3) = each (%$hash2)) { while (my ($transaction,$data) = each (%$hash3)) { - $store_command .= "('".join("','",$symb_id,$part_id, - $resp_id,$student_id, - $transaction, - $data->{'awarddetail'}, - $data->{'response_specific'}, - $data->{'response_specific_value'}, - $data->{'submission'})."'),"; + my $submission = $data->{'submission'}; + # We have to be careful with user supplied input. + # most of the time we are okay because it is escaped. + # However, there is one wrinkle: submissions which end in + # and odd number of '\' cause insert errors to occur. + # Best trap this somehow... + $submission = $dbh->quote($submission); + $store_command .= "('". + join("','",$symb_id,$part_id, + $resp_id,$student_id, + $transaction, + $data->{'awarddetail'}, + $data->{'response_specific'}, + $data->{'response_specific_value'}). + "',".$submission."),"; $store_rows++; } } @@ -1310,9 +1327,14 @@ sub update_full_student_data { ## ## Update the students time...... if ($returnstatus eq 'okay') { - &Apache::lonmysql::replace_row - ($studentdata_table, - [$student_id,$time_of_retrieval,$time_of_retrieval,undef,undef]); + &store_updatetime($student_id,$time_of_retrieval,$time_of_retrieval); + if ($dbh->err) { + if ($returnstatus eq 'okay') { + $returnstatus = 'error updating student time'; + } else { + $returnstatus = 'error updating student time'; + } + } } return $returnstatus; } @@ -1380,13 +1402,31 @@ sub update_student_data { # # Set the students update time if ($Results[0] eq 'okay') { - &Apache::lonmysql::replace_row($studentdata_table, - [$student_id,$time_of_retrieval,undef,undef,undef]); + &store_updatetime($student_id,$time_of_retrieval,$time_of_retrieval); } # return @Results; } +sub store_updatetime { + my ($student_id,$updatetime,$fullupdatetime)=@_; + my $values = ''; + if (defined($updatetime)) { + $values = 'updatetime='.$updatetime.' '; + } + if (defined($fullupdatetime)) { + if ($values ne '') { + $values .= ','; + } + $values .= 'fullupdatetime='.$fullupdatetime.' '; + } + return if ($values eq ''); + my $dbh = &Apache::lonmysql::get_dbh(); + my $request = 'UPDATE '.$student_table.' SET '.$values. + ' WHERE student_id='.$student_id.' LIMIT 1'; + $dbh->do($request); +} + sub store_student_data { my ($sname,$sdom,$courseid,$student_data) = @_; # @@ -1506,21 +1546,20 @@ sub ensure_tables_are_set_up { # # if the tables do not exist, make them my @CurrentTable = &Apache::lonmysql::tables_in_db(); - my ($found_symb,$found_student,$found_part,$found_studentdata, + my ($found_symb,$found_student,$found_part, $found_performance,$found_parameters,$found_fulldump_part, $found_fulldump_response,$found_fulldump_timestamp); foreach (@CurrentTable) { $found_symb = 1 if ($_ eq $symb_table); $found_student = 1 if ($_ eq $student_table); $found_part = 1 if ($_ eq $part_table); - $found_studentdata = 1 if ($_ eq $studentdata_table); $found_performance = 1 if ($_ eq $performance_table); $found_parameters = 1 if ($_ eq $parameters_table); $found_fulldump_part = 1 if ($_ eq $fulldump_part_table); $found_fulldump_response = 1 if ($_ eq $fulldump_response_table); $found_fulldump_timestamp = 1 if ($_ eq $fulldump_timestamp_table); } - if (!$found_symb || !$found_studentdata || + if (!$found_symb || !$found_student || !$found_part || !$found_performance || !$found_parameters || !$found_fulldump_part || !$found_fulldump_response || @@ -1543,7 +1582,7 @@ Input: $sname, $sdom, $courseid Output: $status, $data This routine ensures the data for a given student is up to date. -The $studentdata_table is queried to determine the time of the last update. +The $student_table is queried to determine the time of the last update. If the students data is out of date, &update_student_data() is called. The return values from the call to &update_student_data() are returned. @@ -1565,11 +1604,11 @@ sub ensure_current_data { $Apache::lonnet::perlvar{'lonUsersDir'}); # my $student_id = &get_student_id($sname,$sdom); - my @Result = &Apache::lonmysql::get_rows($studentdata_table, + my @Result = &Apache::lonmysql::get_rows($student_table, "student_id ='$student_id'"); my $data = undef; if (@Result) { - $updatetime = $Result[0]->[1]; + $updatetime = $Result[0]->[5]; # Ack! This is dumb! } if ($modifiedtime > $updatetime) { ($status,$data) = &update_student_data($sname,$sdom,$courseid); @@ -1590,7 +1629,7 @@ Output: $status This routine ensures the fulldata (the data from a lonnet::dump, not a lonnet::currentdump) for a given student is up to date. -The $studentdata_table is queried to determine the time of the last update. +The $student_table is queried to determine the time of the last update. If the students fulldata is out of date, &update_full_student_data() is called. @@ -1613,11 +1652,11 @@ sub ensure_current_full_data { $Apache::lonnet::perlvar{'lonUsersDir'}); # my $student_id = &get_student_id($sname,$sdom); - my @Result = &Apache::lonmysql::get_rows($studentdata_table, + my @Result = &Apache::lonmysql::get_rows($student_table, "student_id ='$student_id'"); my $updatetime; if (@Result && ref($Result[0]) eq 'ARRAY') { - $updatetime = $Result[0]->[2]; + $updatetime = $Result[0]->[6]; } if (! defined($updatetime) || $modifiedtime > $updatetime) { $status = &update_full_student_data($sname,$sdom,$courseid); @@ -1876,7 +1915,7 @@ able to answer it correctly. ################################################ ################################################ sub get_problem_statistics { - my ($students,$symb,$part,$courseid) = @_; + my ($Sections,$status,$symb,$part,$courseid) = @_; return if (! defined($symb) || ! defined($part)); $courseid = $ENV{'request.course.id'} if (! defined($courseid)); # @@ -1888,42 +1927,41 @@ sub get_problem_statistics { my $dbh = &Apache::lonmysql::get_dbh(); return undef if (! defined($dbh)); # - # A) Number of Students attempting problem - # B) Total number of tries of students attempting problem - # C) Mod (largest number of tries for solving the problem) - # D) Mean (average number of tries for solving the problem) - # E) Number of students to solve the problem - # F) Number of students to solve the problem by override - # G) Number of students unable to solve the problem - # H) Degree of difficulty : 1-(E+F)/B - # I) Standard deviation of number of tries - # J) Skew of tries: sqrt(sum(Xi-D)^3)/A - # $dbh->do('DROP TABLE '.$stats_table); # May return an error my $request = - 'CREATE TEMPORARY TABLE '.$stats_table. - ' SELECT student_id,solved,award,tries FROM '.$performance_table. - ' WHERE symb_id='.$symb_id.' AND part_id='.$part_id; - if (defined($students)) { + 'CREATE TEMPORARY TABLE '.$stats_table.' '. + 'SELECT a.student_id,a.solved,a.award,a.awarded,a.tries '. + 'FROM '.$performance_table.' AS a '; + if ((defined($Sections) && lc($Sections->[0]) ne 'all') || + (defined($status) && lc($status) ne 'any')) { + $request .= 'NATURAL LEFT JOIN '.$student_table.' AS b '; + } + $request .= ' WHERE a.symb_id='.$symb_id.' AND a.part_id='.$part_id; + if (defined($Sections) && lc($Sections->[0]) ne 'all') { $request .= ' AND ('. - join(' OR ', map {'student_id='. - &get_student_id($_->{'username'}, - $_->{'domain'}) - } @$students + join(' OR ', map { "b.section='".$_."'" } @$Sections ).')'; } -# &Apache::lonnet::logthis($request); + if (defined($status) && lc($status) ne 'any') { + $request .= " AND b.status='".$status."'"; + } $dbh->do($request); +# &Apache::lonnet::logthis('request = '.$/.$request); + $request = 'SELECT COUNT(*),SUM(tries),MAX(tries),AVG(tries),STD(tries) '. + 'FROM '.$stats_table; my ($num,$tries,$mod,$mean,$STD) = &execute_SQL_request - ($dbh, - 'SELECT COUNT(*),SUM(tries),MAX(tries),AVG(tries),STD(tries) FROM '. - $stats_table); - my ($Solved) = &execute_SQL_request($dbh,'SELECT COUNT(tries) FROM '. - $stats_table. - " WHERE solved='correct_by_student' OR solved='correct_by_scantron'"); - my ($solved) = &execute_SQL_request($dbh,'SELECT COUNT(tries) FROM '. - $stats_table. - " WHERE solved='correct_by_override'"); + ($dbh,$request); +# &Apache::lonnet::logthis('request = '.$/.$request); + $request = 'SELECT SUM(awarded) FROM '.$stats_table; + my ($Solved) = &execute_SQL_request($dbh,$request); +# &Apache::lonnet::logthis('request = '.$/.$request); + $request = 'SELECT SUM(awarded) FROM '.$stats_table. + " WHERE solved='correct_by_override'"; +# &Apache::lonnet::logthis('request = '.$/.$request); + my ($solved) = &execute_SQL_request($dbh,$request); +# $Solved = int($Solved); +# $solved = int($solved); + # $num = 0 if (! defined($num)); $tries = 0 if (! defined($tries)); $mod = 0 if (! defined($mod)); @@ -1943,7 +1981,7 @@ sub get_problem_statistics { $wrongpercent=int(10*100*($num-$Solved+$solved)/$num)/10; } # - $dbh->do('DROP TABLE '.$stats_table); # May return an error +# $dbh->do('DROP TABLE '.$stats_table); # May return an error # # Store in metadata # @@ -2017,7 +2055,15 @@ sub get_student_data { } } -sub get_optionresponse_data { +sub RD_student_id { return 0; } +sub RD_awarddetail { return 1; } +sub RD_response_eval { return 2; } +sub RD_submission { return 3; } +sub RD_timestamp { return 4; } +sub RD_tries { return 5; } +sub RD_sname { return 6; } + +sub get_response_data { my ($students,$symb,$response,$courseid) = @_; return undef if (! defined($symb) || ! defined($response)); @@ -2031,7 +2077,7 @@ sub get_optionresponse_data { return undef if (! defined($dbh)); my $request = 'SELECT '. 'a.student_id, a.awarddetail, a.response_specific_value, '. - 'a.submission, b.timestamp, c.tries '. + 'a.submission, b.timestamp, c.tries, d.student '. 'FROM '.$fulldump_response_table.' AS a '. 'LEFT JOIN '.$fulldump_timestamp_table.' AS b '. 'ON a.symb_id=b.symb_id AND a.student_id=b.student_id AND '. @@ -2039,6 +2085,8 @@ sub get_optionresponse_data { 'LEFT JOIN '.$fulldump_part_table.' AS c '. 'ON a.symb_id=c.symb_id AND a.student_id=c.student_id AND '. 'a.part_id=c.part_id AND a.transaction = c.transaction '. + 'LEFT JOIN '.$student_table.' AS d '. + 'ON a.student_id=d.student_id '. 'WHERE '. 'a.symb_id='.$symb_id.' AND a.response_id='.$response_id; if (defined($students)) { @@ -2059,10 +2107,144 @@ sub get_optionresponse_data { } my $dataset = $sth->fetchall_arrayref(); if (ref($dataset) eq 'ARRAY' && scalar(@$dataset)>0) { + # Clear the \'s from around the submission + for (my $i =0;$i[$i]->[3] =~ s/(\'$|^\')//g; + } return $dataset; } } +sub RT_student_id { return 0; } +sub RT_awarded { return 1; } +sub RT_tries { return 2; } +sub RT_timestamp { return 3; } + +sub get_response_time_data { + my ($students,$symb,$part,$courseid) = @_; + return undef if (! defined($symb) || + ! defined($part)); + $courseid = $ENV{'request.course.id'} if (! defined($courseid)); + # + &setup_table_names($courseid); + my $symb_id = &get_symb_id($symb); + my $part_id = &get_part_id($part); + # + my $dbh = &Apache::lonmysql::get_dbh(); + return undef if (! defined($dbh)); + my $request = 'SELECT '. + 'a.student_id, a.awarded, a.tries, b.timestamp '. + 'FROM '.$fulldump_part_table.' AS a '. + 'NATURAL LEFT JOIN '.$fulldump_timestamp_table.' AS b '. +# 'ON a.symb_id=b.symb_id AND a.student_id=b.student_id AND '. +# 'a.transaction = b.transaction '. + 'WHERE '. + 'a.symb_id='.$symb_id.' AND a.part_id='.$part_id; + if (defined($students)) { + $request .= ' AND ('. + join(' OR ', map {'a.student_id='. + &get_student_id($_->{'username'}, + $_->{'domain'}) + } @$students + ).')'; + } + $request .= ' ORDER BY b.timestamp'; +# &Apache::lonnet::logthis("request =\n".$request); + my $sth = $dbh->prepare($request); + $sth->execute(); + if ($dbh->err) { + &Apache::lonnet::logthis('error = '.$dbh->errstr()); + return undef; + } + my $dataset = $sth->fetchall_arrayref(); + if (ref($dataset) eq 'ARRAY' && scalar(@$dataset)>0) { + return $dataset; + } + +} + +################################################ +################################################ + +=pod + +=item &get_student_scores($Sections,$Symbs,$enrollment,$courseid) + +=cut + +################################################ +################################################ +sub get_student_scores { + my ($Sections,$Symbs,$enrollment,$courseid) = @_; + $courseid = $ENV{'request.course.id'} if (! defined($courseid)); + &setup_table_names($courseid); + my $dbh = &Apache::lonmysql::get_dbh(); + return (undef) if (! defined($dbh)); + my $tmptable = $courseid.'_temp_'.time; + # + my $symb_requirements; + if (defined($Symbs) && @$Symbs) { + $symb_requirements = '('. + join(' OR ', map{ "(a.symb_id='".&get_symb_id($_->{'symb'}). + "' AND a.part_id='".&get_part_id($_->{'part'}). + "')" + } @$Symbs).')'; + } + # + my $student_requirements; + if ( (defined($Sections) && $Sections->[0] ne 'all')) { + $student_requirements = '('. + join(' OR ', map { "b.section='".$_."'" } @$Sections + ).')'; + } + # + my $enrollment_requirements=undef; + if (defined($enrollment) && $enrollment ne 'Any') { + $enrollment_requirements = "b.status='".$enrollment."'"; + } + ## + ## + my $request = 'CREATE TEMPORARY TABLE IF NOT EXISTS '.$tmptable. + ' SELECT a.student_id,SUM(a.awarded) AS score FROM '. + $performance_table.' AS a '; + if (defined($student_requirements) || defined($enrollment_requirements)) { + $request .= ' NATURAL LEFT JOIN '.$student_table.' AS b '; + } + if (defined($symb_requirements) || + defined($student_requirements) || + defined($enrollment_requirements) ) { + $request .= ' WHERE '; + } + if (defined($symb_requirements)) { + $request .= $symb_requirements.' AND '; + } + if (defined($student_requirements)) { + $request .= $student_requirements.' AND '; + } + if (defined($enrollment_requirements)) { + $request .= $enrollment_requirements.' AND '; + } + $request =~ s/ AND $//; + $request .= ' GROUP BY a.student_id'; +# &Apache::lonnet::logthis("request = \n".$request); + my $sth = $dbh->prepare($request); + $sth->execute(); + if ($dbh->err) { + &Apache::lonnet::logthis('error = '.$dbh->errstr()); + return undef; + } + $request = 'SELECT score,COUNT(*) FROM '.$tmptable.' GROUP BY score'; +# &Apache::lonnet::logthis("request = \n".$request); + $sth = $dbh->prepare($request); + $sth->execute(); + if ($dbh->err) { + &Apache::lonnet::logthis('error = '.$dbh->errstr()); + return undef; + } + my $dataset = $sth->fetchall_arrayref(); + return $dataset; +} + ################################################ ################################################ @@ -2106,7 +2288,6 @@ sub setup_table_names { $symb_table = $base_id.'_'.'symb'; $part_table = $base_id.'_'.'part'; $student_table = $base_id.'_'.'student'; - $studentdata_table = $base_id.'_'.'studentdata'; $performance_table = $base_id.'_'.'performance'; $parameters_table = $base_id.'_'.'parameters'; $fulldump_part_table = $base_id.'_'.'partdata'; @@ -2117,7 +2298,6 @@ sub setup_table_names { $symb_table, $part_table, $student_table, - $studentdata_table, $performance_table, $parameters_table, $fulldump_part_table, @@ -2163,7 +2343,7 @@ $ENV{'course.'.$cid.'.domain'}, and $ENV Returns a reference to a hash which contains: keys '$sname:$sdom' - values [$sdom,$sname,$end,$start,$id,$section,$fullname,$status] + values [$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type] The constant values CL_SDOM, CL_SNAME, CL_END, etc. can be used as indices into the returned list to future-proof clients against @@ -2182,6 +2362,7 @@ sub CL_ID { return 4; } sub CL_SECTION { return 5; } sub CL_FULLNAME { return 6; } sub CL_STATUS { return 7; } +sub CL_TYPE { return 8; } sub get_classlist { my ($cid,$cdom,$cnum) = @_; @@ -2198,9 +2379,9 @@ sub get_classlist { } my ($sname,$sdom) = split(/:/,$student); my @Values = split(/:/,$info); - my ($end,$start,$id,$section,$fullname); + my ($end,$start,$id,$section,$fullname,$type); if (@Values > 2) { - ($end,$start,$id,$section,$fullname) = @Values; + ($end,$start,$id,$section,$fullname,$type) = @Values; } else { # We have to get the data ourselves ($end,$start) = @Values; $section = &Apache::lonnet::getsection($sdom,$sname,$cid); @@ -2237,11 +2418,11 @@ sub get_classlist { $status='Active'; } $classlist{$student} = - [$sdom,$sname,$end,$start,$id,$section,$fullname,$status]; + [$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type]; } if (wantarray()) { return (\%classlist,['domain','username','end','start','id', - 'section','fullname','status']); + 'section','fullname','status','type']); } else { return \%classlist; }