diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2014-03-28 22:16:41 -0400 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2014-03-28 22:16:41 -0400 |
commit | 4da4c10870e6da4a17112c88e434d6cbdaa1f835 (patch) | |
tree | dba79c413c33c4212577880df7f32f8266528a5d /GradeBook_lib.tcl | |
parent | 8021e691f4c0fd9a362f642fefd8bb6b41d09b06 (diff) | |
download | GradeBook-4da4c10870e6da4a17112c88e434d6cbdaa1f835.tar.gz GradeBook-4da4c10870e6da4a17112c88e434d6cbdaa1f835.zip |
added update of high/low for parent category and Grand Total
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-x | GradeBook_lib.tcl | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index c9581f7..49bed90 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -1855,6 +1855,13 @@ proc UpdateColumnHighestGrade { columnname } { set val [expr max([join $col_values ,])] } CheckAndCreateAsNeededInfoRow _The_Highest_Grade_ + + set column_category [SelectColValue4User $columnname _Col_Category_] + if { $column_category eq "weighted_column" } { + #convert val to percent for weighted_column + set val [format "%04.2f%%" [expr {100.* $val} ] ] + } + UpdateColValue4UserNameNonWeb $columnname _The_Highest_Grade_ $val } @@ -1867,9 +1874,34 @@ proc UpdateColumnLowestGrade { columnname } { set val [expr min([join $col_values ,])] } CheckAndCreateAsNeededInfoRow _The_Lowest_Grade_ + + set column_category [SelectColValue4User $columnname _Col_Category_] + if { $column_category eq "weighted_column" } { + #convert val to percent for weighted_column + set val [format "%04.2f%%" [expr {100.* $val} ] ] + } + UpdateColValue4UserNameNonWeb $columnname _The_Lowest_Grade_ $val } +proc UpdateHighLowForColumn { columnname } { + set all_column_names [getColListFromTable GradesTable] + if { $columnname ni $all_column_names } { + return + } + UpdateColumnHighestGrade $columnname + UpdateColumnLowestGrade $columnname + if { $columnname eq "Grand Total" } return + + set column_category [SelectColValue4User $columnname _Col_Category_] + if { $column_category ne "weighted_column" } { + set root_category_column ${column_category}Total + } else { + set root_category_column "Grand Total" + } + UpdateHighLowForColumn $root_category_column +} + proc UpdateGrades { permission_list user } { global script_name set subaction [::ncgi::value subaction {}] @@ -1892,11 +1924,9 @@ proc UpdateGrades { permission_list user } { dbg "the following error happen: $errStat" msg_level_critical } else { calculteWeightedTotals - UpdateColumnHighestGrade $columnname - UpdateColumnLowestGrade $columnname + UpdateHighLowForColumn $columnname } } - } proc ChangeGrades { permission_list user } { |