From 8c4b16d19d6712f6143cd7dfe1ec3fdbba48dbf9 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Wed, 4 Dec 2013 16:36:45 -0500 Subject: Do not recalculate column weights if it was not changed during update --- GradeBook_lib.tcl | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'GradeBook_lib.tcl') diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index c9c4ccb..dcecce4 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -1516,11 +1516,24 @@ proc UpdateColumn { permission_list user } { set oldcolumnname [ColName2SqlSafeForm $oldcolumnname] set newcolumnname [ColName2SqlSafeForm $newcolumnname] + set needToRecalculateWeightedTotals false + # first we update category and maxpointpossible values of the old columnname - UpdateColValue4UserNameNonWeb $oldcolumnname _Col_Category_ $column_category - UpdateColValue4UserNameNonWeb $oldcolumnname _Max_Points_ $maxpointpossible + set old_column_category [SelectColValue4User $oldcolumnname _Col_Category_] + if { $old_column_category ne $column_category } { + UpdateColValue4UserNameNonWeb $oldcolumnname _Col_Category_ $column_category + set needToRecalculateWeightedTotals true + } - calculteWeightedTotals + set old_maxpointpossible [SelectColValue4User $oldcolumnname _Max_Points_] + if { $old_maxpointpossible ne $maxpointpossible } { + UpdateColValue4UserNameNonWeb $oldcolumnname _Max_Points_ $maxpointpossible + set needToRecalculateWeightedTotals true + } + + if { $needToRecalculateWeightedTotals } { + calculteWeightedTotals + } if { $newcolumnname eq $oldcolumnname } { # no need to mess with renaming -- cgit v1.2.3