| … | |
… | |
| 163 | |
163 | |
| 164 | # FIXME I'm assuming the problems are all the same |
164 | # FIXME I'm assuming the problems are all the same |
| 165 | |
165 | |
| 166 | my $num_of_problems = @problems; |
166 | my $num_of_problems = @problems; |
| 167 | # get user records |
167 | # get user records |
|
|
168 | $WeBWorK::timer->continue("Begin obtaining user records for set $setName") if defined($WeBWorK::timer); |
| 168 | my @userRecords = $db->getUsers(@studentList); |
169 | my @userRecords = $db->getUsers(@studentList); |
| 169 | |
170 | $WeBWorK::timer->continue("End obtaining user records for set $setName") if defined($WeBWorK::timer); |
| 170 | |
171 | |
| 171 | my @augmentedUserRecords = (); |
172 | my @augmentedUserRecords = (); |
| 172 | foreach my $studentRecord (@userRecords) { |
173 | foreach my $studentRecord (@userRecords) { |
| 173 | my $student = $studentRecord->user_id; |
174 | my $student = $studentRecord->user_id; |
| 174 | next if $studentRecord->last_name =~/^practice/i; # don't show practice users |
175 | next if $studentRecord->last_name =~/^practice/i; # don't show practice users |
| … | |
… | |
| 181 | my $totalRight = 0; |
182 | my $totalRight = 0; |
| 182 | my $total = 0; |
183 | my $total = 0; |
| 183 | my $num_of_attempts = 0; |
184 | my $num_of_attempts = 0; |
| 184 | my %h_problemData = (); |
185 | my %h_problemData = (); |
| 185 | my $probNum = 0; |
186 | my $probNum = 0; |
|
|
187 | my @triplets = map {[$student, $setName, $_ ]} @problems; |
|
|
188 | $WeBWorK::timer->continue("Begin obtaining problem records for user $student set $setName") if defined($WeBWorK::timer); |
|
|
189 | my @problemRecords = $db->getUserProblems( @triplets ); |
|
|
190 | $WeBWorK::timer->continue("End obtaining problem records for user $student set $setName") if defined($WeBWorK::timer); |
|
|
191 | |
|
|
192 | foreach my $problemRecord (@problemRecords) { |
|
|
193 | my $prob = $problemRecord->problem_id; |
| 186 | foreach my $prob (@problems) { |
194 | #foreach my $prob (@problems) { |
| 187 | my $problemRecord = $db->getUserProblem($student, $setName, $prob); |
195 | #my $problemRecord = $db->getUserProblem($student, $setName, $prob); |
| 188 | $probNum++; |
196 | $probNum++; |
| 189 | my $valid_status = 0; |
197 | my $valid_status = 0; |
| 190 | unless (defined($problemRecord) ){ |
198 | unless (defined($problemRecord) ){ |
| 191 | # warn "Can't find record for problem $prob in set $setName for $student"; |
199 | # warn "Can't find record for problem $prob in set $setName for $student"; |
| 192 | # FIXME check the legitimate reasons why a student record might not be defined |
200 | # FIXME check the legitimate reasons why a student record might not be defined |
| … | |
… | |
| 332 | |
340 | |
| 333 | # FIXME I'm assuming the problems are all the same |
341 | # FIXME I'm assuming the problems are all the same |
| 334 | # FIXME what does this mean? |
342 | # FIXME what does this mean? |
| 335 | |
343 | |
| 336 | my @rows; |
344 | my @rows; |
| 337 | my $max_problems; |
345 | my $max_problems=0; |
| 338 | |
346 | |
| 339 | foreach my $setName (@setIDs) { |
347 | foreach my $setName (@setIDs) { |
| 340 | my $status = 0; |
348 | my $status = 0; |
| 341 | my $attempted = 0; |
349 | my $attempted = 0; |
| 342 | my $longStatus = ''; |
350 | my $longStatus = ''; |
| … | |
… | |
| 347 | my $num_of_attempts = 0; |
355 | my $num_of_attempts = 0; |
| 348 | my @problems = sort {$a <=> $b } $db->listUserProblems($studentName, $setName); |
356 | my @problems = sort {$a <=> $b } $db->listUserProblems($studentName, $setName); |
| 349 | my $num_of_problems = @problems; |
357 | my $num_of_problems = @problems; |
| 350 | $max_problems = $num_of_problems if $num_of_problems > $max_problems; |
358 | $max_problems = $num_of_problems if $num_of_problems > $max_problems; |
| 351 | # construct header |
359 | # construct header |
|
|
360 | $WeBWorK::timer->continue("Begin collecting problems for set $setName") if defined($WeBWorK::timer); |
|
|
361 | my @problemRecords = $db->getUserProblems( map {[$studentName, $setName,$_]} @problems); |
|
|
362 | $WeBWorK::timer->continue("End collecting problems for set $setName") if defined($WeBWorK::timer); |
|
|
363 | foreach my $problemRecord (@problemRecords) { |
|
|
364 | my $prob = $problemRecord->problem_id; |
| 352 | foreach my $prob (@problems) { |
365 | #foreach my $prob (@problems) { |
| 353 | my $problemRecord = $db->getUserProblem($studentName, $setName, $prob); |
366 | #my $problemRecord = $db->getUserProblem($studentName, $setName, $prob); |
| 354 | |
367 | |
| 355 | my $valid_status = 0; |
368 | my $valid_status = 0; |
| 356 | unless (defined($problemRecord) ){ |
369 | unless (defined($problemRecord) ){ |
| 357 | # warn "Can't find record for problem $prob in set $setName for $student"; |
370 | # warn "Can't find record for problem $prob in set $setName for $student"; |
| 358 | # FIXME check the legitimate reasons why a student record might not be defined |
371 | # FIXME check the legitimate reasons why a student record might not be defined |
| … | |
… | |
| 387 | $totalRight += round_score($status*$probValue) if $valid_status; |
400 | $totalRight += round_score($status*$probValue) if $valid_status; |
| 388 | my $num_correct = $problemRecord->num_incorrect || 0; |
401 | my $num_correct = $problemRecord->num_incorrect || 0; |
| 389 | my $num_incorrect = $problemRecord->num_correct || 0; |
402 | my $num_incorrect = $problemRecord->num_correct || 0; |
| 390 | $num_of_attempts += $num_correct + $num_incorrect; |
403 | $num_of_attempts += $num_correct + $num_incorrect; |
| 391 | } |
404 | } |
|
|
405 | |
| 392 | # FIXME we can do this more effficiently get the list first |
406 | # FIXME we can do this more effficiently get the list first |
| 393 | |
407 | |
| 394 | |
408 | |
| 395 | # FIXME this needs formatting |
409 | # FIXME this needs formatting |
| 396 | |
410 | |