version 1.61, 2003/03/25 22:29:31
|
version 1.64, 2003/03/28 15:19:35
|
Line 506 sub init_dbs {
|
Line 506 sub init_dbs {
|
type => 'TINYTEXT' }, |
type => 'TINYTEXT' }, |
{ name => 'timestamp', |
{ name => 'timestamp', |
type => 'INT UNSIGNED'}, |
type => 'INT UNSIGNED'}, |
{ name => 'weight', |
|
type => 'INT UNSIGNED'}, |
|
], |
], |
'PRIMARY KEY' => ['symb_id','student_id','part_id'], |
'PRIMARY KEY' => ['symb_id','student_id','part_id'], |
'KEY' => [{ columns=>['student_id'] }, |
'KEY' => [{ columns=>['student_id'] }, |
Line 859 sub update_student_data {
|
Line 857 sub update_student_data {
|
my $symb_id = &get_symb_id($current_symb); |
my $symb_id = &get_symb_id($current_symb); |
# |
# |
# Load data into the tables |
# Load data into the tables |
foreach my $parameter (keys(%$param_hash)) { |
while (my ($parameter,$value) = each(%$param_hash)) { |
my $value = $param_hash->{$parameter}; |
|
my $newstring; |
my $newstring; |
if ($parameter !~ /(timestamp|resource\.(.*)\.(solved|tries|awarded|award|awarddetail|previous|weight))/) { |
if ($parameter !~ /(timestamp|resource\.(.*)\.(solved|tries|awarded|award|awarddetail|previous))/) { |
$newstring = "('".join("','", |
$newstring = "('".join("','", |
$symb_id,$student_id, |
$symb_id,$student_id, |
$parameter,$value)."'),\n"; |
$parameter,$value)."'),\n"; |
Line 883 sub update_student_data {
|
Line 880 sub update_student_data {
|
my $award = $param_hash->{'resource.'.$part.'.award'}; |
my $award = $param_hash->{'resource.'.$part.'.award'}; |
my $awarddetail = $param_hash->{'resource.'.$part.'.awarddetail'}; |
my $awarddetail = $param_hash->{'resource.'.$part.'.awarddetail'}; |
my $timestamp = $param_hash->{'timestamp'}; |
my $timestamp = $param_hash->{'timestamp'}; |
# use EXT to get the weight |
|
my $weight = &Apache::lonnet::EXT('resource.'.$part.'.weight', |
|
$current_symb,$sdom,$sname); |
|
# Give the weight back to the user |
|
$param_hash->{'resource.'.$part.'.weight'}=$weight; |
|
# |
# |
$solved = '' if (! defined($awarded)); |
$solved = '' if (! defined($awarded)); |
$tries = '' if (! defined($tries)); |
$tries = '' if (! defined($tries)); |
Line 896 sub update_student_data {
|
Line 888 sub update_student_data {
|
$awarddetail = '' if (! defined($awarddetail)); |
$awarddetail = '' if (! defined($awarddetail)); |
$newstring = "('".join("','",$symb_id,$student_id,$part_id, |
$newstring = "('".join("','",$symb_id,$student_id,$part_id, |
$solved,$tries,$awarded,$award, |
$solved,$tries,$awarded,$award, |
$awarddetail,$timestamp,$weight)."'),\n"; |
$awarddetail,$timestamp)."'),\n"; |
$store_performance_command .= $newstring; |
$store_performance_command .= $newstring; |
$rows_stored++; |
$rows_stored++; |
} |
} |
Line 1039 sub get_student_data_from_performance_ca
|
Line 1031 sub get_student_data_from_performance_ca
|
my $dbh = &Apache::lonmysql::get_dbh(); |
my $dbh = &Apache::lonmysql::get_dbh(); |
my $request = "SELECT ". |
my $request = "SELECT ". |
"d.symb,c.part,a.solved,a.tries,a.awarded,a.award,a.awarddetail,". |
"d.symb,c.part,a.solved,a.tries,a.awarded,a.award,a.awarddetail,". |
"a.timestamp,a.weight "; |
"a.timestamp "; |
if (defined($student)) { |
if (defined($student)) { |
$request .= "FROM $student_table AS b ". |
$request .= "FROM $student_table AS b ". |
"LEFT JOIN $performance_table AS a ON b.student_id=a.student_id ". |
"LEFT JOIN $performance_table AS a ON b.student_id=a.student_id ". |
Line 1068 sub get_student_data_from_performance_ca
|
Line 1060 sub get_student_data_from_performance_ca
|
} |
} |
foreach my $row (@{$sth->fetchall_arrayref}) { |
foreach my $row (@{$sth->fetchall_arrayref}) { |
$rows_retrieved++; |
$rows_retrieved++; |
my ($symb,$part,$solved,$tries,$awarded,$award,$awarddetail,$time,$weight) = |
my ($symb,$part,$solved,$tries,$awarded,$award,$awarddetail,$time) = |
(@$row); |
(@$row); |
my $base = 'resource.'.$part; |
my $base = 'resource.'.$part; |
$studentdata->{$symb}->{$base.'.solved'} = $solved; |
$studentdata->{$symb}->{$base.'.solved'} = $solved; |
Line 1077 sub get_student_data_from_performance_ca
|
Line 1069 sub get_student_data_from_performance_ca
|
$studentdata->{$symb}->{$base.'.award'} = $award; |
$studentdata->{$symb}->{$base.'.award'} = $award; |
$studentdata->{$symb}->{$base.'.awarddetail'} = $awarddetail; |
$studentdata->{$symb}->{$base.'.awarddetail'} = $awarddetail; |
$studentdata->{$symb}->{'timestamp'} = $time if (defined($time) && $time ne ''); |
$studentdata->{$symb}->{'timestamp'} = $time if (defined($time) && $time ne ''); |
$studentdata->{$symb}->{'resource.'.$part.'.weight'}=$weight; |
|
} |
} |
return $studentdata; |
return $studentdata; |
} |
} |
Line 1159 the students you are concerned with prio
|
Line 1150 the students you are concerned with prio
|
|
|
Inputs: $students, $symb, $part, $courseid |
Inputs: $students, $symb, $part, $courseid |
|
|
|
=over 4 |
|
|
|
=item $students is an array of hash references. |
|
Each hash must contain at least the 'username' and 'domain' of a student. |
|
|
|
=item $symb is the symb for the problem. |
|
|
|
=item $part is the part id you need statistics for |
|
|
|
=item $courseid is the course id, of course! |
|
|
|
=back |
|
|
|
Outputs: See the code for up to date information. |
|
|
|
=over 4 |
|
|
|
=item $num The number of students attempting the problem |
|
|
|
=item $tries The total number of tries for the students |
|
|
|
=item $mod The maximum number of tries taken |
|
|
|
=item $mean The average number of tries |
|
|
|
=item $Solved The number of students able to solve the problem |
|
|
|
=item $solved The number of students whose answer is 'correct_by_override' |
|
|
|
=item $DegOfDiff The degree of difficulty of the problem |
|
|
|
=item $STD The standard deviation of the number of tries |
|
|
|
=item $SKEW The skew of the number of tries |
|
|
|
=back |
|
|
=cut |
=cut |
|
|
################################################ |
################################################ |
Line 1172 sub get_problem_statistics {
|
Line 1200 sub get_problem_statistics {
|
my $part_id = &get_part_id($part); |
my $part_id = &get_part_id($part); |
my $stats_table = $courseid.'_problem_stats'; |
my $stats_table = $courseid.'_problem_stats'; |
# |
# |
&Apache::lonnet::logthis('symb id = '.$symb_id); |
|
&Apache::lonnet::logthis('part id = '.$part_id); |
|
|
|
my $dbh = &Apache::lonmysql::get_dbh(); |
my $dbh = &Apache::lonmysql::get_dbh(); |
return undef if (! defined($dbh)); |
return undef if (! defined($dbh)); |
&Apache::lonnet::logthis('dbh is defined'); |
|
# |
# |
# A) Number of Students attempting problem |
# A) Number of Students attempting problem |
# B) Total number of tries of students attempting problem |
# B) Total number of tries of students attempting problem |
Line 1195 sub get_problem_statistics {
|
Line 1219 sub get_problem_statistics {
|
'CREATE TEMPORARY TABLE '.$stats_table. |
'CREATE TEMPORARY TABLE '.$stats_table. |
' SELECT student_id,solved,award,tries FROM '.$performance_table. |
' SELECT student_id,solved,award,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)) { |
|
$request .= ' AND ('. |
|
join(' OR ', map {'student_id='. |
|
&get_student_id($_->{'username'}, |
|
$_->{'domain'}) |
|
} @$students |
|
).')'; |
|
} |
# &Apache::lonnet::logthis($request); |
# &Apache::lonnet::logthis($request); |
$dbh->do($request); |
$dbh->do($request); |
my ($num,$tries,$mod,$mean,$STD) = &execute_SQL_request |
my ($num,$tries,$mod,$mean,$STD) = &execute_SQL_request |