diff options
-rwxr-xr-x | GradeBook_lib.tcl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index d0e4fad..170e3dc 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -180,12 +180,19 @@ proc calculteWeightedTotals { } { AddColumnNonWeb $grand_total_col_name weighted_column 0 } foreach student $students_list { - set grand_total($student) 0 + set grand_total($student) 0 foreach {category weight} [getGradingWeights] { if { ![info exist max_points($category)] } { set tmpList [ calculteMaxPointsInCategory $category ] set max_points($category) [lindex $tmpList 0] } + if { ![info exist points_sum($category,$student)] } { + set points_sum($category,$student) [ calculteSumOfPointsForStudentInCategory $student $category ] + if { $max_points($category) != 0 } { + # normalizing + set points_sum($category,$student) [expr { 1. * $points_sum($category,$student) / $max_points($category) } ] + } + } if { $max_points($category) == 0} { dbg "Category: $category has 0 for total maximum points. Skipping it." 4 continue |