diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-03-11 13:07:54 -0500 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-03-11 13:07:54 -0500 |
commit | 22ce8595cd7fb52149edd42e7282a3b6d86080f4 (patch) | |
tree | c25d6d3e17dd7596a7fa1d6182ad57b4889e2e55 /GradeBook_lib.tcl | |
parent | 556ac6d8e26de0b60d7652bed09c6dff5a474144 (diff) | |
download | GradeBook-22ce8595cd7fb52149edd42e7282a3b6d86080f4.tar.gz GradeBook-22ce8595cd7fb52149edd42e7282a3b6d86080f4.zip |
bug fix in grand total weight calculation
Ignore-this: 304e9c352c7227681030630aad690ec3
darcs-hash:20110311180754-067c0-bfefaa6a47811d6a9a9ed318f8414b5ea7209f2e.gz
Diffstat (limited to 'GradeBook_lib.tcl')
-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 |