From 22ce8595cd7fb52149edd42e7282a3b6d86080f4 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Fri, 11 Mar 2011 13:07:54 -0500 Subject: bug fix in grand total weight calculation Ignore-this: 304e9c352c7227681030630aad690ec3 darcs-hash:20110311180754-067c0-bfefaa6a47811d6a9a9ed318f8414b5ea7209f2e.gz --- GradeBook_lib.tcl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3