diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2013-12-04 16:36:45 -0500 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2013-12-04 16:36:45 -0500 |
commit | 8c4b16d19d6712f6143cd7dfe1ec3fdbba48dbf9 (patch) | |
tree | 7292f6a3aa46d35f4671ee33b8c906ada5551d6b /GradeBook_lib.tcl | |
parent | 33d2d051f3a3c46b085e70d39391e1d98c225278 (diff) | |
download | GradeBook-8c4b16d19d6712f6143cd7dfe1ec3fdbba48dbf9.tar.gz GradeBook-8c4b16d19d6712f6143cd7dfe1ec3fdbba48dbf9.zip |
Do not recalculate column weights if it was not changed during update
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-x | GradeBook_lib.tcl | 19 |
1 files changed, 16 insertions, 3 deletions
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 |