diff options
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 } { |