[system] / trunk / webwork / system / cgi / cgi-scripts / profCourseRecData.pl Repository:
ViewVC logotype

Diff of /trunk/webwork/system/cgi/cgi-scripts/profCourseRecData.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 180 Revision 181
25 25
26my %inputs; 26my %inputs;
27my ($classID, $setNumber,$User,$Session_key,$batchMode); 27my ($classID, $setNumber,$User,$Session_key,$batchMode);
28 28
29 29
30 &CGI::ReadParse; 30 &CGI::ReadParse;
31 %inputs = %main::in; 31 %inputs = %main::in;
32 32
33 # get information from CGI inputs (see also below for additional information) 33 # get information from CGI inputs (see also below for additional information)
34 $classID = $inputs{'course'}; 34 $classID = $inputs{'course'};
35 $setNumber = $inputs{'setNo'}; 35 $setNumber = $inputs{'setNo'};
36 $User = $inputs{'user'}; 36 $User = $inputs{'user'};
37 $Session_key = $inputs{'key'}; 37 $Session_key = $inputs{'key'};
38 38
39 unless ($classID && $User && $Session_key) { 39 unless ($classID && $User && $Session_key) {
40 &wwerror("$0","The script profCourseRecData.pl did not receive the proper input data.","","", query_string()); 40 &wwerror("$0","The script profCourseRecData.pl did not receive the proper input data.","","", query_string());
41 } 41 }
42 42
43# CAUTION: FOR THIS SCRIPT TO WORK CORRECTLTY, ALL STUDENTS 43# CAUTION: FOR THIS SCRIPT TO WORK CORRECTLTY, ALL STUDENTS
44# MUST HAVE BEEN ASSIGNED THE SAME NUMBER OF PROBLREMS 44# MUST HAVE BEEN ASSIGNED THE SAME NUMBER OF PROBLREMS
45 45
46# print "set is $setNumber"; 46# print "set is $setNumber";
57require "${scriptDirectory}$Global::classlist_DBglue_pl"; 57require "${scriptDirectory}$Global::classlist_DBglue_pl";
58require "${scriptDirectory}$Global::FILE_pl"; 58require "${scriptDirectory}$Global::FILE_pl";
59require "${scriptDirectory}$Global::SCRtools_pl"; 59require "${scriptDirectory}$Global::SCRtools_pl";
60require "${scriptDirectory}$Global::HTMLglue_pl"; 60require "${scriptDirectory}$Global::HTMLglue_pl";
61 61
62 my $keyFile = &Global::getCourseKeyFile($classID); 62 my $keyFile = &Global::getCourseKeyFile($classID);
63 &verify_key($User, $Session_key, $keyFile, $classID); 63 &verify_key($User, $Session_key, $keyFile, $classID);
64 my $permissionsFile = &Global::getCoursePermissionsFile($classID); 64 my $permissionsFile = &Global::getCoursePermissionsFile($classID);
65 my $permissions = &get_permissions($User, $permissionsFile); 65 my $permissions = &get_permissions($User, $permissionsFile);
66 66
67 if (($permissions != $Global::instructor_permissions) and ($permissions != $Global::TA_permissions) ) { 67 if (($permissions != $Global::instructor_permissions) and ($permissions != $Global::TA_permissions) ) {
68 print "permissions = $permissions instructor_permissions= $Global::instructor_permissions\n"; 68 print "permissions = $permissions instructor_permissions= $Global::instructor_permissions\n";
69 print &html_NO_PERMISSION; 69 print &html_NO_PERMISSION;
70 exit(0); 70 exit(0);
71 } 71 }
72my $DELIM = $Global::delim; 72my $DELIM = $Global::delim;
73 73
74## get rest of data from cgi form 74## get rest of data from cgi form
75$batchMode = $inputs{'batchMode'}; ## if 1 it means user has choosen to ignore warning message 75$batchMode = $inputs{'batchMode'}; ## if 1 it means user has choosen to ignore warning message
76 76
77# get list of problems and values from the database. Warn user if different students 77# get list of problems and values from the database. Warn user if different students
78#have different numbers of problems or different valuse for the same problem 78#have different numbers of problems or different valuse for the same problem
79my $cgiMode = 1; 79my $cgiMode = 1;
80my ($warningMsg,$dueDate, $problemListref,$problemValueListref) 80my ($warningMsg,$dueDate, $problemListref,$problemValueListref)
81 = &readProblemsAndValuesFromDB($setNumber,0,$cgiMode,$batchMode); 81 = &readProblemsAndValuesFromDB($setNumber,0,$cgiMode,$batchMode);
82 82
83if ($warningMsg ne '') { &warningMsgPage(\%inputs,$warningMsg);} 83if ($warningMsg ne '') { &warningMsgPage(\%inputs,$warningMsg);}
84 84
85my @problemList = @$problemListref; 85my @problemList = @$problemListref;
86my @problemValueList = @$problemValueListref; 86my @problemValueList = @$problemValueListref;
158push @dataArray, $dataRow; 158push @dataArray, $dataRow;
159 159
160 160
161## display data for Recitations 161## display data for Recitations
162foreach $recitationName (@recitationNameArray) { 162foreach $recitationName (@recitationNameArray) {
163 $dataRow = "$recitationName $DELIM $allStudentsHash{$recitationName} $DELIM"; ## all recitations and total # of students 163 $dataRow = "$recitationName $DELIM $allStudentsHash{$recitationName} $DELIM"; ## all recitations and total # of students
164 164
165 $item =0; ## % of students who have attempted at least one problem in set 165 $item =0; ## % of students who have attempted at least one problem in set
166 $item = int(100*$attemptedSetHash{$recitationName}/$allStudentsHash{$recitationName}+.5) if $allStudentsHash{$recitationName}; 166 $item = int(100*$attemptedSetHash{$recitationName}/$allStudentsHash{$recitationName}+.5) if $allStudentsHash{$recitationName};
167 $dataRow .= "$item $DELIM"; 167 $dataRow .= "$item $DELIM";
168 168
169 $item =0; ## avg score of students who have attempted at least one problem in set 169 $item =0; ## avg score of students who have attempted at least one problem in set
170 $item = (int($totalScoreHash{$recitationName} *10/$attemptedSetHash{$recitationName}+.5))/10 if $attemptedSetHash{$recitationName}; 170 $item = (int($totalScoreHash{$recitationName} *10/$attemptedSetHash{$recitationName}+.5))/10 if $attemptedSetHash{$recitationName};
171 $item = sprintf '%.1f', $item; 171 $item = sprintf '%.1f', $item;
172 $dataRow .= "$item $DELIM"; 172 $dataRow .= "$item $DELIM";
173 $dataRow .= "$total_possible"; 173 $dataRow .= "$total_possible";
174 push @dataArray, $dataRow; 174 push @dataArray, $dataRow;
175} 175}
176# print "<pre> @dataArray <\pre>"; 176# print "<pre> @dataArray <\pre>";
177 177
178print <<EOF; 178print <<EOF;
179<HR><BR> 179<HR><BR>
189 189
190### display whole course data 190### display whole course data
191@dataArray =(); 191@dataArray =();
192$dataRow = "$all $DELIM"; 192$dataRow = "$all $DELIM";
193for ($i=1;$i<=$noOfProbs;$i++) { 193for ($i=1;$i<=$noOfProbs;$i++) {
194 $dataRow .= "\# $i $DELIM"; 194 $dataRow .= "\# $i $DELIM";
195} 195}
196$dataRow =~ s|$DELIM$||; ## remove last \$DELIM 196$dataRow =~ s|$DELIM$||; ## remove last \$DELIM
197 197
198push @dataArray, $dataRow; 198push @dataArray, $dataRow;
199 199
200$dataRow = "\% attempting $DELIM"; 200$dataRow = "\% attempting $DELIM";
201for ($i=1;$i<=$noOfProbs;$i++) { 201for ($i=1;$i<=$noOfProbs;$i++) {
202 $item =0; ## percent of students who have attempted this problem 202 $item =0; ## percent of students who have attempted this problem
203 $item = int(100*$attemptedProbHash{$all}[$i]/$allStudentsHash{$all}+.5) if $allStudentsHash{$all}; 203 $item = int(100*$attemptedProbHash{$all}[$i]/$allStudentsHash{$all}+.5) if $allStudentsHash{$all};
204 $dataRow .= "$item $DELIM"; 204 $dataRow .= "$item $DELIM";
205 205
206} 206}
207 207
208 208
209 209
212 212
213 213
214 214
215$dataRow = "percent correct $DELIM"; ## all recitations and total # of students 215$dataRow = "percent correct $DELIM"; ## all recitations and total # of students
216for ($i=1;$i<=$noOfProbs;$i++) { 216for ($i=1;$i<=$noOfProbs;$i++) {
217 $item =0; ## % of students who have attempted this problem 217 $item =0; ## % of students who have attempted this problem
218 $item = int(100*$YHash{$all}[$i]/$attemptedProbHash{$all}[$i]+.5) if $attemptedProbHash{$all}[$i]; 218 $item = int(100*$YHash{$all}[$i]/$attemptedProbHash{$all}[$i]+.5) if $attemptedProbHash{$all}[$i];
219 $dataRow .= "$item $DELIM"; 219 $dataRow .= "$item $DELIM";
220} 220}
221$dataRow =~ s|$DELIM$||; ## remove last \$DELIM 221$dataRow =~ s|$DELIM$||; ## remove last \$DELIM
222push @dataArray, $dataRow; 222push @dataArray, $dataRow;
223 223
224$dataRow = "average incorrect $DELIM"; ## all recitations and total # of students 224$dataRow = "average incorrect $DELIM"; ## all recitations and total # of students
225for ($i=1;$i<=$noOfProbs;$i++) { 225for ($i=1;$i<=$noOfProbs;$i++) {
226 226
227 $item =0; ## avg # of incorrect attempts of students who have attempted this problem 227 $item =0; ## avg # of incorrect attempts of students who have attempted this problem
228 $item = (int(10*$NHash{$all}[$i]/$attemptedProbHash{$all}[$i]+.5))/10 if $attemptedProbHash{$all}[$i]; 228 $item = (int(10*$NHash{$all}[$i]/$attemptedProbHash{$all}[$i]+.5))/10 if $attemptedProbHash{$all}[$i];
229 $item = sprintf '%.1f', $item; 229 $item = sprintf '%.1f', $item;
230 $dataRow .= "$item $DELIM"; 230 $dataRow .= "$item $DELIM";
231} 231}
232$dataRow =~ s|$DELIM$||; ## remove last \$DELIM 232$dataRow =~ s|$DELIM$||; ## remove last \$DELIM
233push @dataArray, $dataRow; 233push @dataArray, $dataRow;
234 234
235print <<EOF; 235print <<EOF;
243 243
244## display data for recitations 244## display data for recitations
245 245
246foreach $recitationName (@recitationNameArray) { 246foreach $recitationName (@recitationNameArray) {
247 247
248 ## add blank row to table to seperate recitations 248 ## add blank row to table to seperate recitations
249 $dataRow = '<BR>'; 249 $dataRow = '<BR>';
250 push @dataArray, $dataRow; 250 push @dataArray, $dataRow;
251# @dataArray =(); 251# @dataArray =();
252 $dataRow = "$recitationName $DELIM"; 252 $dataRow = "$recitationName $DELIM";
253 for ($i=1;$i<=$noOfProbs;$i++) { 253 for ($i=1;$i<=$noOfProbs;$i++) {
254 $dataRow .= "\# $i $DELIM"; 254 $dataRow .= "\# $i $DELIM";
255 } 255 }
256 $dataRow =~ s|$DELIM$||; ## remove last \$DELIM
257
258 push @dataArray, $dataRow;
259
260 $dataRow = "\% attempting $DELIM";
261 for ($i=1;$i<=$noOfProbs;$i++) {
262 $item =0; ## percent of students who have attempted this problem
263 $item = int(100*$attemptedProbHash{$recitationName}[$i]/$allStudentsHash{$recitationName}+.5) if $allStudentsHash{$recitationName};
264 $dataRow .= "$item $DELIM";
265 }
266
267$dataRow =~ s|$DELIM$||; ## remove last \$DELIM 256 $dataRow =~ s|$DELIM$||; ## remove last \$DELIM
257
268push @dataArray, $dataRow; 258 push @dataArray, $dataRow;
269 259
260 $dataRow = "\% attempting $DELIM";
261 for ($i=1;$i<=$noOfProbs;$i++) {
262 $item =0; ## percent of students who have attempted this problem
263 $item = int(100*$attemptedProbHash{$recitationName}[$i]/$allStudentsHash{$recitationName}+.5) if $allStudentsHash{$recitationName};
264 $dataRow .= "$item $DELIM";
265 }
270 266
267$dataRow =~ s|$DELIM$||; ## remove last \$DELIM
268push @dataArray, $dataRow;
271 269
272 270
271
272
273 $dataRow = "percent correct $DELIM"; ## all recitations and total # of students 273 $dataRow = "percent correct $DELIM"; ## all recitations and total # of students
274 for ($i=1;$i<=$noOfProbs;$i++) { 274 for ($i=1;$i<=$noOfProbs;$i++) {
275 $item =0; ## % of students who have attempted this problem 275 $item =0; ## % of students who have attempted this problem
276 $item = int(100*$YHash{$recitationName}[$i]/$attemptedProbHash{$recitationName}[$i]+.5) if $attemptedProbHash{$recitationName}[$i]; 276 $item = int(100*$YHash{$recitationName}[$i]/$attemptedProbHash{$recitationName}[$i]+.5) if $attemptedProbHash{$recitationName}[$i];
277 $dataRow .= "$item $DELIM"; 277 $dataRow .= "$item $DELIM";
278 } 278 }
279 $dataRow =~ s|$DELIM$||; ## remove last \$DELIM 279 $dataRow =~ s|$DELIM$||; ## remove last \$DELIM
280 push @dataArray, $dataRow; 280 push @dataArray, $dataRow;
281 281
282 $dataRow = "average incorrect $DELIM"; ## all recitations and total # of students 282 $dataRow = "average incorrect $DELIM"; ## all recitations and total # of students
283 for ($i=1;$i<=$noOfProbs;$i++) { 283 for ($i=1;$i<=$noOfProbs;$i++) {
284 284
285 $item =0; ## avg # of incorrect attempts of students who have attempted this problem 285 $item =0; ## avg # of incorrect attempts of students who have attempted this problem
286 $item = (int(10*$NHash{$recitationName}[$i]/$attemptedProbHash{$recitationName}[$i]+.5))/10 if $attemptedProbHash{$recitationName}[$i]; 286 $item = (int(10*$NHash{$recitationName}[$i]/$attemptedProbHash{$recitationName}[$i]+.5))/10 if $attemptedProbHash{$recitationName}[$i];
287 $item = sprintf '%.1f', $item; 287 $item = sprintf '%.1f', $item;
288 $dataRow .= "$item $DELIM"; 288 $dataRow .= "$item $DELIM";
289 } 289 }
290 $dataRow =~ s|$DELIM$||; ## remove last \$DELIM 290 $dataRow =~ s|$DELIM$||; ## remove last \$DELIM
291 push @dataArray, $dataRow; 291 push @dataArray, $dataRow;
292 292
293# ## output the html table 293# ## output the html table
294# my $string = &delimitedArray2htmlTable(\@dataArray, 'htmltable'); 294# my $string = &delimitedArray2htmlTable(\@dataArray, 'htmltable');
295# print "${string}<BR>"; 295# print "${string}<BR>";
296 296
349push @dataArray, $dataRow; 349push @dataArray, $dataRow;
350 350
351 351
352## display data for recitations 352## display data for recitations
353foreach $recitationName (@excludedRecitationNameArray) { 353foreach $recitationName (@excludedRecitationNameArray) {
354 $dataRow = "$recitationName $DELIM $allStudentsHash{$recitationName} $DELIM"; ## all recitations and total # of students 354 $dataRow = "$recitationName $DELIM $allStudentsHash{$recitationName} $DELIM"; ## all recitations and total # of students
355 355
356 $item =0; ## % of students who have attempted at least one problem in set 356 $item =0; ## % of students who have attempted at least one problem in set
357 $item = int(100*$attemptedSetHash{$recitationName}/$allStudentsHash{$recitationName}+.5) if $allStudentsHash{$recitationName}; 357 $item = int(100*$attemptedSetHash{$recitationName}/$allStudentsHash{$recitationName}+.5) if $allStudentsHash{$recitationName};
358 $dataRow .= "$item $DELIM"; 358 $dataRow .= "$item $DELIM";
359 359
360 $item =0; ## avg score of students who have attempted at least one problem in set 360 $item =0; ## avg score of students who have attempted at least one problem in set
361 $item = (int($totalScoreHash{$recitationName} *10/$attemptedSetHash{$recitationName}+.5))/10 if $attemptedSetHash{$recitationName}; 361 $item = (int($totalScoreHash{$recitationName} *10/$attemptedSetHash{$recitationName}+.5))/10 if $attemptedSetHash{$recitationName};
362 $item = sprintf '%.1f', $item; 362 $item = sprintf '%.1f', $item;
363 $dataRow .= "$item $DELIM"; 363 $dataRow .= "$item $DELIM";
364 $dataRow .= "$total_possible"; 364 $dataRow .= "$total_possible";
365 push @dataArray, $dataRow; 365 push @dataArray, $dataRow;
366} 366}
367# print "<pre> @dataArray <\pre>"; 367# print "<pre> @dataArray <\pre>";
368 368
369print <<EOF; 369print <<EOF;
370<HR><BR> 370<HR><BR>
380 380
381### display whole course data 381### display whole course data
382@dataArray =(); 382@dataArray =();
383$dataRow = "$all $DELIM"; 383$dataRow = "$all $DELIM";
384for ($i=1;$i<=$noOfProbs;$i++) { 384for ($i=1;$i<=$noOfProbs;$i++) {
385 $dataRow .= "\# $i $DELIM"; 385 $dataRow .= "\# $i $DELIM";
386} 386}
387$dataRow =~ s|$DELIM$||; ## remove last \$DELIM 387$dataRow =~ s|$DELIM$||; ## remove last \$DELIM
388 388
389push @dataArray, $dataRow; 389push @dataArray, $dataRow;
390 390
391$dataRow = "\% attempting $DELIM"; 391$dataRow = "\% attempting $DELIM";
392for ($i=1;$i<=$noOfProbs;$i++) { 392for ($i=1;$i<=$noOfProbs;$i++) {
393 $item =0; ## percent of students who have attempted this problem 393 $item =0; ## percent of students who have attempted this problem
394 $item = int(100*$attemptedProbHash{$all}[$i]/$allStudentsHash{$all}+.5) if $allStudentsHash{$all}; 394 $item = int(100*$attemptedProbHash{$all}[$i]/$allStudentsHash{$all}+.5) if $allStudentsHash{$all};
395 $dataRow .= "$item $DELIM"; 395 $dataRow .= "$item $DELIM";
396 396
397} 397}
398 398
399 399
400 400
403 403
404 404
405 405
406$dataRow = "percent correct $DELIM"; ## all recitations and total # of students 406$dataRow = "percent correct $DELIM"; ## all recitations and total # of students
407for ($i=1;$i<=$noOfProbs;$i++) { 407for ($i=1;$i<=$noOfProbs;$i++) {
408 $item =0; ## % of students who have attempted this problem 408 $item =0; ## % of students who have attempted this problem
409 $item = int(100*$YHash{$all}[$i]/$attemptedProbHash{$all}[$i]+.5) if $attemptedProbHash{$all}[$i]; 409 $item = int(100*$YHash{$all}[$i]/$attemptedProbHash{$all}[$i]+.5) if $attemptedProbHash{$all}[$i];
410 $dataRow .= "$item $DELIM"; 410 $dataRow .= "$item $DELIM";
411} 411}
412$dataRow =~ s|$DELIM$||; ## remove last \$DELIM 412$dataRow =~ s|$DELIM$||; ## remove last \$DELIM
413push @dataArray, $dataRow; 413push @dataArray, $dataRow;
414 414
415$dataRow = "average incorrect $DELIM"; ## all recitations and total # of students 415$dataRow = "average incorrect $DELIM"; ## all recitations and total # of students
416for ($i=1;$i<=$noOfProbs;$i++) { 416for ($i=1;$i<=$noOfProbs;$i++) {
417 417
418 $item =0; ## avg # of incorrect attempts of students who have attempted this problem 418 $item =0; ## avg # of incorrect attempts of students who have attempted this problem
419 $item = (int(10*$NHash{$all}[$i]/$attemptedProbHash{$all}[$i]+.5))/10 if $attemptedProbHash{$all}[$i]; 419 $item = (int(10*$NHash{$all}[$i]/$attemptedProbHash{$all}[$i]+.5))/10 if $attemptedProbHash{$all}[$i];
420 $item = sprintf '%.1f', $item; 420 $item = sprintf '%.1f', $item;
421 $dataRow .= "$item $DELIM"; 421 $dataRow .= "$item $DELIM";
422} 422}
423$dataRow =~ s|$DELIM$||; ## remove last \$DELIM 423$dataRow =~ s|$DELIM$||; ## remove last \$DELIM
424push @dataArray, $dataRow; 424push @dataArray, $dataRow;
425 425
426print <<EOF; 426print <<EOF;
434 434
435## display data for recitations 435## display data for recitations
436 436
437foreach $recitationName (@excludedRecitationNameArray) { 437foreach $recitationName (@excludedRecitationNameArray) {
438 438
439 ## add blank row to table to seperate recitations 439 ## add blank row to table to seperate recitations
440 $dataRow = '<BR>'; 440 $dataRow = '<BR>';
441 push @dataArray, $dataRow; 441 push @dataArray, $dataRow;
442# @dataArray =(); 442# @dataArray =();
443 $dataRow = "$recitationName $DELIM"; 443 $dataRow = "$recitationName $DELIM";
444 for ($i=1;$i<=$noOfProbs;$i++) { 444 for ($i=1;$i<=$noOfProbs;$i++) {
445 $dataRow .= "\# $i $DELIM"; 445 $dataRow .= "\# $i $DELIM";
446 } 446 }
447 $dataRow =~ s|$DELIM$||; ## remove last \$DELIM
448
449 push @dataArray, $dataRow;
450
451 $dataRow = "\% attempting $DELIM";
452 for ($i=1;$i<=$noOfProbs;$i++) {
453 $item =0; ## percent of students who have attempted this problem
454 $item = int(100*$attemptedProbHash{$recitationName}[$i]/$allStudentsHash{$recitationName}+.5) if $allStudentsHash{$recitationName};
455 $dataRow .= "$item $DELIM";
456 }
457
458$dataRow =~ s|$DELIM$||; ## remove last \$DELIM 447 $dataRow =~ s|$DELIM$||; ## remove last \$DELIM
448
459push @dataArray, $dataRow; 449 push @dataArray, $dataRow;
460 450
451 $dataRow = "\% attempting $DELIM";
452 for ($i=1;$i<=$noOfProbs;$i++) {
453 $item =0; ## percent of students who have attempted this problem
454 $item = int(100*$attemptedProbHash{$recitationName}[$i]/$allStudentsHash{$recitationName}+.5) if $allStudentsHash{$recitationName};
455 $dataRow .= "$item $DELIM";
456 }
461 457
458$dataRow =~ s|$DELIM$||; ## remove last \$DELIM
459push @dataArray, $dataRow;
462 460
463 461
462
463
464 $dataRow = "percent correct $DELIM"; ## all recitations and total # of students 464 $dataRow = "percent correct $DELIM"; ## all recitations and total # of students
465 for ($i=1;$i<=$noOfProbs;$i++) { 465 for ($i=1;$i<=$noOfProbs;$i++) {
466 $item =0; ## % of students who have attempted this problem 466 $item =0; ## % of students who have attempted this problem
467 $item = int(100*$YHash{$recitationName}[$i]/$attemptedProbHash{$recitationName}[$i]+.5) if $attemptedProbHash{$recitationName}[$i]; 467 $item = int(100*$YHash{$recitationName}[$i]/$attemptedProbHash{$recitationName}[$i]+.5) if $attemptedProbHash{$recitationName}[$i];
468 $dataRow .= "$item $DELIM"; 468 $dataRow .= "$item $DELIM";
469 } 469 }
470 $dataRow =~ s|$DELIM$||; ## remove last \$DELIM 470 $dataRow =~ s|$DELIM$||; ## remove last \$DELIM
471 push @dataArray, $dataRow; 471 push @dataArray, $dataRow;
472 472
473 $dataRow = "average incorrect $DELIM"; ## all recitations and total # of students 473 $dataRow = "average incorrect $DELIM"; ## all recitations and total # of students
474 for ($i=1;$i<=$noOfProbs;$i++) { 474 for ($i=1;$i<=$noOfProbs;$i++) {
475 475
476 $item =0; ## avg # of incorrect attempts of students who have attempted this problem 476 $item =0; ## avg # of incorrect attempts of students who have attempted this problem
477 $item = (int(10*$NHash{$recitationName}[$i]/$attemptedProbHash{$recitationName}[$i]+.5))/10 if $attemptedProbHash{$recitationName}[$i]; 477 $item = (int(10*$NHash{$recitationName}[$i]/$attemptedProbHash{$recitationName}[$i]+.5))/10 if $attemptedProbHash{$recitationName}[$i];
478 $item = sprintf '%.1f', $item; 478 $item = sprintf '%.1f', $item;
479 $dataRow .= "$item $DELIM"; 479 $dataRow .= "$item $DELIM";
480 } 480 }
481 $dataRow =~ s|$DELIM$||; ## remove last \$DELIM 481 $dataRow =~ s|$DELIM$||; ## remove last \$DELIM
482 push @dataArray, $dataRow; 482 push @dataArray, $dataRow;
483 483
484# ## output the html table 484# ## output the html table
485# my $string = &delimitedArray2htmlTable(\@dataArray, 'htmltable'); 485# my $string = &delimitedArray2htmlTable(\@dataArray, 'htmltable');
486# print "${string}<BR>"; 486# print "${string}<BR>";
487 487
508 508
509 509
510##subroutines 510##subroutines
511 511
512sub processRecitationNameArrays { 512sub processRecitationNameArrays {
513 ## first consider all blank entries (i.e. empty or white space) in excludedRecitationNameArray 513 ## first consider all blank entries (i.e. empty or white space) in excludedRecitationNameArray
514 ## to be the same recitation, namely ' ' 514 ## to be the same recitation, namely ''
515 my %temp_hash =(); 515 my %temp_hash =();
516 my $recitationName; 516 my $recitationName;
517 foreach $recitationName (@excludedRecitationNameArray) { 517 foreach $recitationName (@excludedRecitationNameArray) {
518 if ((!defined ($recitationName)) or ($recitationName =~ m|^\s*$|)) {$recitationName = ' ';} 518 if ((!defined ($recitationName)) or ($recitationName =~ m|^\s*$|)) {$recitationName = '';}
519 $temp_hash{$recitationName} =1; 519 $temp_hash{$recitationName} =1;
520 } 520 }
521 @excludedRecitationNameArray = keys %temp_hash; 521 @excludedRecitationNameArray = keys %temp_hash;
522 522
523 ## Make sure excludedRecitationNameArray is a subset of recitationNameArray 523 ## Make sure excludedRecitationNameArray is a subset of recitationNameArray
524 %temp_hash =(); 524 %temp_hash =();
525 grep($temp_hash{$_}++,@recitationNameArray); 525 grep($temp_hash{$_}++,@recitationNameArray);
526 @excludedRecitationNameArray = grep($temp_hash{$_},@excludedRecitationNameArray); 526 @excludedRecitationNameArray = grep($temp_hash{$_},@excludedRecitationNameArray);
527 527
528 ## Now remove excluded recitations from recitation list 528 ## Now remove excluded recitations from recitation list
529 %temp_hash =(); 529 %temp_hash =();
530 grep($temp_hash{$_}++,@excludedRecitationNameArray); 530 grep($temp_hash{$_}++,@excludedRecitationNameArray);
531 @recitationNameArray = grep(!$temp_hash{$_},@recitationNameArray); 531 @recitationNameArray = grep(!$temp_hash{$_},@recitationNameArray);
532 532
533 @recitationNameArray = sort @recitationNameArray; 533 @recitationNameArray = sort @recitationNameArray;
534 @excludedRecitationNameArray = sort @excludedRecitationNameArray; 534 @excludedRecitationNameArray = sort @excludedRecitationNameArray;
535} 535}
536 536
537sub initializeAndLoadUp { 537sub initializeAndLoadUp {
538 my ($recitationNameArrayref, $wholeCourseName) = @_; 538 my ($recitationNameArrayref, $wholeCourseName) = @_;
539 my @recitationNameArray = @$recitationNameArrayref; 539 my @recitationNameArray = @$recitationNameArrayref;
540 my $all = $wholeCourseName; 540 my $all = $wholeCourseName;
541 my ($recitationName,$i,$score); 541 my ($recitationName,$i,$score);
542 542
543 ## compute total possible points 543 ## compute total possible points
544 $total_possible = 0; 544 $total_possible = 0;
545 for ($i=1;$i<=$noOfProbs;$i++) {$total_possible += $problemValueList[$i];} 545 for ($i=1;$i<=$noOfProbs;$i++) {$total_possible += $problemValueList[$i];}
546 546
547 foreach $recitationName (@recitationNameArray) { 547 foreach $recitationName (@recitationNameArray) {
548 $totalScoreHash{$recitationName} = 0; 548 $totalScoreHash{$recitationName} = 0;
549 $attemptedSetHash{$recitationName} = 0; 549 $attemptedSetHash{$recitationName} = 0;
550 $allStudentsHash{$recitationName} = 0; 550 $allStudentsHash{$recitationName} = 0;
551 for ($i=1;$i<=$noOfProbs;$i++) { 551 for ($i=1;$i<=$noOfProbs;$i++) {
552 $NHash{$recitationName}[$i]=0; ## contains number of incorrect responses 552 $NHash{$recitationName}[$i]=0; ## contains number of incorrect responses
553 $YHash{$recitationName}[$i]=0; ## contains totals of problem scores (i.e. a 553 $YHash{$recitationName}[$i]=0; ## contains totals of problem scores (i.e. a
554 ## number in [0,1] for each problem 554 ## number in [0,1] for each problem
555 $attemptedProbHash{$recitationName}[$i]=0; 555 $attemptedProbHash{$recitationName}[$i]=0;
556 } 556 }
557 } 557 }
558 558
559 ## load up hashes with data 559 ## load up hashes with data
560 560
561 my @pinNumbersArray = &getAllProbSetKeysForSet($setNumber); 561 my @pinNumbersArray = &getAllProbSetKeysForSet($setNumber);
562 my ($studentAttemptedAProblem, $numIncorr, $pin, $status,$login_name_for_psvn); 562 my ($studentAttemptedAProblem, $numIncorr, $pin, $status,$login_name_for_psvn);
563 foreach $pin (@pinNumbersArray) { 563 foreach $pin (@pinNumbersArray) {
564 attachProbSetRecord($pin); 564 attachProbSetRecord($pin);
565 $login_name_for_psvn = &getStudentLogin($pin); 565 $login_name_for_psvn = &getStudentLogin($pin);
566 attachCLRecord($login_name_for_psvn); 566 attachCLRecord($login_name_for_psvn);
567 $status = CL_getStudentStatus($login_name_for_psvn); 567 $status = CL_getStudentStatus($login_name_for_psvn);
568 next if dropStatus($status); 568 next if dropStatus($status);
569 $studentAttemptedAProblem = 0; 569 $studentAttemptedAProblem = 0;
570 $recitationName = &CL_getClassRecitation($login_name_for_psvn); 570 $recitationName = &CL_getClassRecitation($login_name_for_psvn);
571 if ((!defined ($recitationName)) or ($recitationName =~ m|^\s*$|)){ 571 if ((!defined ($recitationName)) or ($recitationName =~ m|^\s*$|)){
572 $recitationName = ' '; 572 $recitationName = '';
573 } 573 }
574 $allStudentsHash{$recitationName} += 1; 574 $allStudentsHash{$recitationName} += 1;
575 575
576 for ($i=1;$i<=$noOfProbs;$i++) { 576 for ($i=1;$i<=$noOfProbs;$i++) {
577 if (&getProblemAttempted($i,$pin)) { 577 if (&getProblemAttempted($i,$pin)) {
578 $studentAttemptedAProblem = 1; 578 $studentAttemptedAProblem = 1;
579 $numIncorr = &getProblemNumOfIncorrectAns($i,$pin); 579 $numIncorr = &getProblemNumOfIncorrectAns($i,$pin);
580 $numIncorr =0 unless defined $numIncorr; 580 $numIncorr =0 unless defined $numIncorr;
581 $numIncorr = &min($numIncorr,99); 581 $numIncorr = &min($numIncorr,99);
582 $NHash{$recitationName}[$i] += $numIncorr; 582 $NHash{$recitationName}[$i] += $numIncorr;
583 $attemptedProbHash{$recitationName}[$i] += 1; 583 $attemptedProbHash{$recitationName}[$i] += 1;
584 $score = &getProblemStatus($i,$pin); 584 $score = &getProblemStatus($i,$pin);
585 $YHash{$recitationName}[$i] += $score; 585 $YHash{$recitationName}[$i] += $score;
586 $totalScoreHash{$recitationName} += round_score($score*$problemValueList[$i]); 586 $totalScoreHash{$recitationName} += round_score($score*$problemValueList[$i]);
587 } 587 }
588 } 588 }
589 if ($studentAttemptedAProblem) {$attemptedSetHash{$recitationName} += 1;} 589 if ($studentAttemptedAProblem) {$attemptedSetHash{$recitationName} += 1;}
590 } 590 }
591 591
592 ## initialize whole course data 592 ## initialize whole course data
593 $totalScoreHash{$all} = 0; 593 $totalScoreHash{$all} = 0;
594 $attemptedSetHash{$all} = 0; 594 $attemptedSetHash{$all} = 0;
595 $allStudentsHash{$all} = 0; 595 $allStudentsHash{$all} = 0;
596 for ($i=1;$i<=$noOfProbs;$i++) { 596 for ($i=1;$i<=$noOfProbs;$i++) {
597 $NHash{$all}[$i]=0; 597 $NHash{$all}[$i]=0;
598 $YHash{$all}[$i]=0; 598 $YHash{$all}[$i]=0;
599 $attemptedProbHash{$all}[$i]=0; 599 $attemptedProbHash{$all}[$i]=0;
600 } 600 }
601 601
602 ## compute whole course data 602 ## compute whole course data
603 foreach $recitationName (@recitationNameArray) { 603 foreach $recitationName (@recitationNameArray) {
604 $totalScoreHash{$all} += $totalScoreHash{$recitationName}; 604 $totalScoreHash{$all} += $totalScoreHash{$recitationName};
605 $attemptedSetHash{$all} += $attemptedSetHash{$recitationName}; 605 $attemptedSetHash{$all} += $attemptedSetHash{$recitationName};
606 $allStudentsHash{$all} += $allStudentsHash{$recitationName}; 606 $allStudentsHash{$all} += $allStudentsHash{$recitationName};
607 for ($i=1;$i<=$noOfProbs;$i++) { 607 for ($i=1;$i<=$noOfProbs;$i++) {
608 $NHash{$all}[$i] += $NHash{$recitationName}[$i]; 608 $NHash{$all}[$i] += $NHash{$recitationName}[$i];
609 $YHash{$all}[$i] += $YHash{$recitationName}[$i]; 609 $YHash{$all}[$i] += $YHash{$recitationName}[$i];
610 $attemptedProbHash{$all}[$i] += $attemptedProbHash{$recitationName}[$i]; 610 $attemptedProbHash{$all}[$i] += $attemptedProbHash{$recitationName}[$i];
611 } 611 }
612 } 612 }
613} 613}
614## find unique name 614## find unique name
615sub uniqueCourseName { 615sub uniqueCourseName {
616 my $all = $classID; 616 my $all = $classID;
617 if (exists $allStudentsHash{$all}) { 617 if (exists $allStudentsHash{$all}) {
618 my $j = 1; 618 my $j = 1;
619 $all = "${all}$j"; 619 $all = "${all}$j";
620 while (exists $allStudentsHash{$all}) { 620 while (exists $allStudentsHash{$all}) {
621 $j++; 621 $j++;
622 $all = "${all}$j"; 622 $all = "${all}$j";
623 } 623 }
624 } 624 }
625$all 625$all
626} 626}
627 627
628 628
629 629
653 653
654## profScoring form -- allows you to score problem sets 654## profScoring form -- allows you to score problem sets
655print <<EOF; 655print <<EOF;
656<P> 656<P>
657 657
658 <FORM METHOD = "POST" ACTION= "${cgiURL}profCourseRecData.pl"> 658 <FORM METHOD = "POST" ACTION= "${cgiURL}profCourseRecData.pl">
659 <INPUT TYPE="SUBMIT" VALUE="Continue displaying data for $setNumber"> 659 <INPUT TYPE="SUBMIT" VALUE="Continue displaying data for $setNumber">
660 660
661EOF 661EOF
662 662
663 663
664 print qq{ 664 print qq{
665 <BR><INPUT TYPE=CHECKBOX NAME="batchMode" VALUE=1 >Continue 665 <BR><INPUT TYPE=CHECKBOX NAME="batchMode" VALUE=1 >Continue
666 }; 666 };
667 667
668# resume printing the rest of the form 668# resume printing the rest of the form
669 669
670print <<EOF; 670print <<EOF;
671 <INPUT TYPE="HIDDEN" NAME="user" VALUE="$inputs{'user'}"> 671 <INPUT TYPE="HIDDEN" NAME="user" VALUE="$inputs{'user'}">
672 <INPUT TYPE="HIDDEN" NAME="key" VALUE="$inputs{'key'}"> 672 <INPUT TYPE="HIDDEN" NAME="key" VALUE="$inputs{'key'}">
673 <INPUT TYPE="HIDDEN" NAME="course" VALUE="$inputs{'course'}"> 673 <INPUT TYPE="HIDDEN" NAME="course" VALUE="$inputs{'course'}">
674 <INPUT TYPE="HIDDEN" NAME="setNo" VALUE="$inputs{'setNo'}"> 674 <INPUT TYPE="HIDDEN" NAME="setNo" VALUE="$inputs{'setNo'}">
675 </FORM> 675 </FORM>
676EOF 676EOF
677 677
678 678
679print &htmlBOTTOM("profLogin.pl", \%inputs); 679print &htmlBOTTOM("profLogin.pl", \%inputs);
680exit; 680exit;

Legend:
Removed from v.180  
changed lines
  Added in v.181

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9