diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2013-12-08 21:21:22 -0500 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2013-12-08 21:21:22 -0500 |
commit | c68cfdce4fab94196d1932b6ccbcdaea351fe832 (patch) | |
tree | 1a23459ddad72b35b7d522b09f5fb9d43cdeaee1 /GradeBook_lib.tcl | |
parent | 03982e0d096912911894ea0ef9de99576fa83ff7 (diff) | |
download | GradeBook-c68cfdce4fab94196d1932b6ccbcdaea351fe832.tar.gz GradeBook-c68cfdce4fab94196d1932b6ccbcdaea351fe832.zip |
improved logic of the lowest grades dropout
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-x | GradeBook_lib.tcl | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index de5f91c..2d74edf 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -224,6 +224,7 @@ proc dropTheLowestGrades {num_to_drop grades grades_max_possible} { # let's find the index of grade with the smallest grade/max_possible ratio set sm_ind -1; # non existing set smallest_ratio 10000; # something very big (larger than 1) + set max_grade_for_smallest_ratio 0; # something small set i 0 foreach max_val $grades_max_possible { # grades with zero max_possible belong to bonuses @@ -236,10 +237,22 @@ proc dropTheLowestGrades {num_to_drop grades grades_max_possible} { # so we just put something very big (much larger than 1) set grade_weight 1000000; # larger than default smallest_ratio } + # update lowest contribution + # FIXME: this logic is not as easy in the general case but it works + # when max grades are about the same in the same category if { $grade_weight < $smallest_ratio } { - set sm_ind $i - set smallest_ratio $grade_weight + # this easy case + set sm_ind $i + set smallest_ratio $grade_weight + set max_grade_for_smallest_ratio $max_val + } + if { ($grade_weight == $smallest_ratio) && ($max_val > $max_grade_for_smallest_ratio) } { + # for same grade_weight we should remove the one which has the largest max_val + # this bust overall percentage for a student + set sm_ind $i + set smallest_ratio $grade_weight + set max_grade_for_smallest_ratio $max_val } incr i } |