Return to scorer.anon.tcl CVS log | Up to [LON-CAPA] / capa / capa51 / GUITools |
- fixed scorer to no longer guess for CapaIDs
1: ########################################################### 2: # compareCapaID2 3: ########################################################### 4: ########################################################### 5: ########################################################### 6: proc compareCapaID2 { onPaper onList } { 7: set length [string length $onPaper] 8: set same 0 9: for { set i 0 } { $i < $length } { incr i } { 10: if { [string index $onPaper $i] == [string index $onList $i] } { 11: incr same 12: } 13: } 14: return $same 15: } 16: 17: ########################################################### 18: # getAnonModeID 19: ########################################################### 20: ########################################################### 21: ########################################################### 22: proc getAnonModeID { num answerStructVar} { 23: global gScorer 24: upvar $answerStructVar answerStruct 25: 26: set i 0 27: set length [llength $gScorer(studentList.$num)] 28: # puts ofrloop:\ [time { 29: foreach student $gScorer(studentList.$num) { 30: lappend which([compareCapaID $answerStruct(CapaID) [lindex $student 3]]) $i 31: incr i 32: } 33: # }] 34: set highest [lindex [lsort -decreasing -integer [array names which]] 0] 35: if {$highest != 6} { return "" } 36: set answerStruct(indices) $which($highest) 37: foreach index $which($highest) { 38: lappend result [lindex [lindex $gScorer(studentList.$num) $index] 1] 39: } 40: return $result 41: } 42: 43: ########################################################### 44: # scorerSum 45: ########################################################### 46: ########################################################### 47: ########################################################### 48: proc scorerSum { scores } { 49: set total 0 50: foreach score [split $scores {}] { incr total $score } 51: return $total 52: } 53: 54: ########################################################### 55: # pickAnonHighest 56: ########################################################### 57: ########################################################### 58: ########################################################### 59: proc pickAnonHighest { num answerStructVar which } { 60: global gPrompt gScorer 61: upvar $answerStructVar answerStruct 62: 63: set scores "" 64: foreach index $which { 65: set studentNumber [lindex [lindex $gScorer(studentList.$num) $index] 1] 66: lappend scores [list [scorerSum [finalScorer $num Lenient $studentNumber \ 67: $answerStruct($studentNumber.numRight)]] \ 68: $studentNumber] 69: } 70: # puts $scores 71: set scores [lsort -index 0 -integer $scores] 72: # puts $scores 73: # puts [lindex [lindex $scores 0] 1] 74: return [lindex [lindex $scores 0] 1] 75: } 76: 77: ########################################################### 78: # getWhichAnon 79: ########################################################### 80: ########################################################### 81: ########################################################### 82: proc getWhichAnon { num answerStructVar which } { 83: global gPrompt gScorer 84: upvar $answerStructVar answerStruct 85: 86: set dialog [toplevel .getWhichAnon$num -borderwidth 10] 87: wm title $dialog "Getting Which Anonymous" 88: 89: set msgFrame [frame $dialog.msg ] 90: set listFrame [frame $dialog.list ] 91: set typeInFrame [frame $dialog.typein] 92: set buttonFrame [frame $dialog.button] 93: pack $msgFrame $listFrame $typeInFrame $buttonFrame 94: 95: label $msgFrame.lbl -text "Grading:" 96: label $msgFrame.lbl2 -text "Student Number: $answerStruct(StudentNumber)" 97: label $msgFrame.lbl3 -text "CapaID: $answerStruct(CapaID)" 98: label $msgFrame.lbl4 -text "Name: $answerStruct(FirstName) $answerStruct(LastName)" 99: label $msgFrame.lbl5 -text "Select the paper used to grade student." 100: label $msgFrame.lbl6 -text "Name StuNumber capa capa score" 101: label $msgFrame.lbl7 -text " ID IDplus Std Len Str " 102: 103: pack $msgFrame.lbl $msgFrame.lbl2 $msgFrame.lbl3 $msgFrame.lbl4 $msgFrame.lbl5 \ 104: $msgFrame.lbl6 $msgFrame.lbl7 -anchor w 105: 106: set listbox [listbox $listFrame.list -yscrollcommand "$listFrame.scroll set" \ 107: -width 67] 108: scrollbar $listFrame.scroll -command "$listFrame.list yview" 109: pack $listFrame.list $listFrame.scroll -side left 110: pack configure $listFrame.scroll -fill y 111: 112: label $typeInFrame.lbl -text "Type In Student Number:" 113: entry $typeInFrame.typein -width 9 -textvariable gPrompt(typedin) 114: pack $typeInFrame.lbl $typeInFrame.typein -side left 115: 116: button $buttonFrame.button -text Select -command "set gPrompt(ok) 1" 117: button $buttonFrame.typein -text "Use Typed In Value" -command "set gPrompt(ok) 2" 118: pack $buttonFrame.button $buttonFrame.typein -side left 119: foreach index $which { 120: set studentNumber [lindex [lindex $gScorer(studentList.$num) $index] 1] 121: set scores "" 122: foreach methodtype {CAPA Lenient Strict} { 123: lappend scores [scorerSum [finalScorer $num $methodtype $studentNumber \ 124: $answerStruct($studentNumber.numRight)] ] 125: } 126: $listbox insert end [eval format {{%30s %s %4d %6s %4d %4d %4d}} [lindex $gScorer(studentList.$num) $index] $scores] 127: } 128: 129: Centre_Dialog $dialog default 130: focus $dialog 131: capaRaise $dialog 132: capaGrab $dialog 133: while { 1 } { 134: update 135: vwait gPrompt(ok) 136: if { $gPrompt(ok) == 1 } { 137: if { [$listbox curselection] != ""} { break } 138: } else { 139: if { [inClasslist $num $gPrompt(typedin)] } { break } else { 140: displayError "$gPrompt(typedin) is not in the classl file" 141: } 142: } 143: set gPrompt(ok) 0 144: } 145: if { $gPrompt(ok) == 1 } { 146: set selected [lindex $which [$listbox curselection]] 147: set result [lindex [lindex $gScorer(studentList.$num) $selected] 1] 148: } else { 149: set result $gPrompt(typedin) 150: } 151: capaGrab release $dialog 152: destroy $dialog 153: 154: return $result 155: } 156: 157: ########################################################### 158: # inClasslist 159: ########################################################### 160: ########################################################### 161: ########################################################### 162: proc inClasslist { num pid } { 163: global gScorer 164: if {[lsearch -regexp $gScorer(studentList.$num) "\{.*\} .*$pid.*"]!=-1} { 165: return 1 166: } { 167: return 0 168: } 169: }