aboutsummaryrefslogtreecommitdiff
path: root/GradeBook_lib.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-xGradeBook_lib.tcl17
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
}