version 1.108, 2003/10/30 16:20:18
|
version 1.112, 2004/01/19 16:31:25
|
Line 73 and/or itself.
|
Line 73 and/or itself.
|
|
|
=item &get_sequence_assessment_data() |
=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 |
Use lonnavmaps to build a data structure describing the order and |
assessment contents of each sequence in the current course. |
assessment contents of each sequence in the current course. |
|
|
Line 190 sub get_sequence_assessment_data {
|
Line 188 sub get_sequence_assessment_data {
|
$title =~ s/\:/\&\#058;/g; |
$title =~ s/\:/\&\#058;/g; |
$symb = $curRes->symb(); |
$symb = $curRes->symb(); |
$src = $curRes->src(); |
$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 $parts = $curRes->parts(); |
my %partdata; |
my %partdata; |
foreach my $part (@$parts) { |
foreach my $part (@$parts) { |
Line 1276 sub update_full_student_data {
|
Line 1278 sub update_full_student_data {
|
while (my ($part_id,$hash2) = each (%$hash1)) { |
while (my ($part_id,$hash2) = each (%$hash1)) { |
while (my ($resp_id,$hash3) = each (%$hash2)) { |
while (my ($resp_id,$hash3) = each (%$hash2)) { |
while (my ($transaction,$data) = each (%$hash3)) { |
while (my ($transaction,$data) = each (%$hash3)) { |
$store_command .= "('".join("','",$symb_id,$part_id, |
my $submission = $data->{'submission'}; |
$resp_id,$student_id, |
# We have to be careful with user supplied input. |
$transaction, |
# most of the time we are okay because it is escaped. |
$data->{'awarddetail'}, |
# However, there is one wrinkle: submissions which end in |
$data->{'response_specific'}, |
# and odd number of '\' cause insert errors to occur. |
$data->{'response_specific_value'}, |
# Best trap this somehow... |
$data->{'submission'})."'),"; |
$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++; |
$store_rows++; |
} |
} |
} |
} |
Line 1889 sub get_problem_statistics {
|
Line 1899 sub get_problem_statistics {
|
my $dbh = &Apache::lonmysql::get_dbh(); |
my $dbh = &Apache::lonmysql::get_dbh(); |
return undef if (! defined($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 |
$dbh->do('DROP TABLE '.$stats_table); # May return an error |
my $request = |
my $request = |
'CREATE TEMPORARY TABLE '.$stats_table. |
'CREATE TEMPORARY TABLE '.$stats_table. |
' SELECT student_id,solved,award,tries FROM '.$performance_table. |
' SELECT student_id,solved,award,awarded,tries FROM '.$performance_table. |
' WHERE symb_id='.$symb_id.' AND part_id='.$part_id; |
' WHERE symb_id='.$symb_id.' AND part_id='.$part_id; |
if (defined($students)) { |
if (defined($students)) { |
$request .= ' AND ('. |
$request .= ' AND ('. |
Line 1915 sub get_problem_statistics {
|
Line 1914 sub get_problem_statistics {
|
} |
} |
# &Apache::lonnet::logthis($request); |
# &Apache::lonnet::logthis($request); |
$dbh->do($request); |
$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 |
my ($num,$tries,$mod,$mean,$STD) = &execute_SQL_request |
($dbh, |
($dbh,$request); |
'SELECT COUNT(*),SUM(tries),MAX(tries),AVG(tries),STD(tries) FROM '. |
# &Apache::lonnet::logthis('request = '.$/.$request); |
$stats_table); |
$request = 'SELECT SUM(awarded) FROM '.$stats_table; |
my ($Solved) = &execute_SQL_request($dbh,'SELECT COUNT(tries) FROM '. |
my ($Solved) = &execute_SQL_request($dbh,$request); |
$stats_table. |
# &Apache::lonnet::logthis('request = '.$/.$request); |
" WHERE solved='correct_by_student' OR solved='correct_by_scantron'"); |
$request = 'SELECT SUM(awarded) FROM '.$stats_table. |
my ($solved) = &execute_SQL_request($dbh,'SELECT COUNT(tries) FROM '. |
" WHERE solved='correct_by_override'"; |
$stats_table. |
# &Apache::lonnet::logthis('request = '.$/.$request); |
" WHERE solved='correct_by_override'"); |
my ($solved) = &execute_SQL_request($dbh,$request); |
|
# $Solved = int($Solved); |
|
# $solved = int($solved); |
|
# |
$num = 0 if (! defined($num)); |
$num = 0 if (! defined($num)); |
$tries = 0 if (! defined($tries)); |
$tries = 0 if (! defined($tries)); |
$mod = 0 if (! defined($mod)); |
$mod = 0 if (! defined($mod)); |
Line 1944 sub get_problem_statistics {
|
Line 1949 sub get_problem_statistics {
|
$wrongpercent=int(10*100*($num-$Solved+$solved)/$num)/10; |
$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 |
# Store in metadata |
# |
# |
Line 2222 $ENV{'course.'.$cid.'.domain'}, and $ENV
|
Line 2227 $ENV{'course.'.$cid.'.domain'}, and $ENV
|
|
|
Returns a reference to a hash which contains: |
Returns a reference to a hash which contains: |
keys '$sname:$sdom' |
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 |
The constant values CL_SDOM, CL_SNAME, CL_END, etc. can be used |
as indices into the returned list to future-proof clients against |
as indices into the returned list to future-proof clients against |
Line 2241 sub CL_ID { return 4; }
|
Line 2246 sub CL_ID { return 4; }
|
sub CL_SECTION { return 5; } |
sub CL_SECTION { return 5; } |
sub CL_FULLNAME { return 6; } |
sub CL_FULLNAME { return 6; } |
sub CL_STATUS { return 7; } |
sub CL_STATUS { return 7; } |
|
sub CL_TYPE { return 8; } |
|
|
sub get_classlist { |
sub get_classlist { |
my ($cid,$cdom,$cnum) = @_; |
my ($cid,$cdom,$cnum) = @_; |
Line 2257 sub get_classlist {
|
Line 2263 sub get_classlist {
|
} |
} |
my ($sname,$sdom) = split(/:/,$student); |
my ($sname,$sdom) = split(/:/,$student); |
my @Values = split(/:/,$info); |
my @Values = split(/:/,$info); |
my ($end,$start,$id,$section,$fullname); |
my ($end,$start,$id,$section,$fullname,$type); |
if (@Values > 2) { |
if (@Values > 2) { |
($end,$start,$id,$section,$fullname) = @Values; |
($end,$start,$id,$section,$fullname,$type) = @Values; |
} else { # We have to get the data ourselves |
} else { # We have to get the data ourselves |
($end,$start) = @Values; |
($end,$start) = @Values; |
$section = &Apache::lonnet::getsection($sdom,$sname,$cid); |
$section = &Apache::lonnet::getsection($sdom,$sname,$cid); |
Line 2296 sub get_classlist {
|
Line 2302 sub get_classlist {
|
$status='Active'; |
$status='Active'; |
} |
} |
$classlist{$student} = |
$classlist{$student} = |
[$sdom,$sname,$end,$start,$id,$section,$fullname,$status]; |
[$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type]; |
} |
} |
if (wantarray()) { |
if (wantarray()) { |
return (\%classlist,['domain','username','end','start','id', |
return (\%classlist,['domain','username','end','start','id', |
'section','fullname','status']); |
'section','fullname','status','type']); |
} else { |
} else { |
return \%classlist; |
return \%classlist; |
} |
} |