aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2014-05-08 17:02:47 -0400
committerEugeniy Mikhailov <evgmik@gmail.com>2014-05-08 17:02:47 -0400
commit5b086a3a0ffd74926e8ce7a1cfaff9963ae3633a (patch)
tree21cf733040959cf6d6c1e2b5a17921fdda35f6de
parenteaadc7fc0e4fa746e60c759845e92d21bcb7b50c (diff)
downloadGradeBook-5b086a3a0ffd74926e8ce7a1cfaff9963ae3633a.tar.gz
GradeBook-5b086a3a0ffd74926e8ce7a1cfaff9963ae3633a.zip
begin/end transaction placed correctly to achive fast stats update
-rwxr-xr-xGradeBook_lib.tcl13
1 files changed, 4 insertions, 9 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl
index 43859f1..e740dcd 100755
--- a/GradeBook_lib.tcl
+++ b/GradeBook_lib.tcl
@@ -721,11 +721,7 @@ proc isThereUserNameInTheGradesTable { username } {
proc CheckAndCreateAsNeededInfoRow { row_name } {
if { ![isThereUserNameInTheGradesTable $row_name] } {
- # looks like to insert I need previous transactions
- set transactionState [getTransactionState]
- end_db_transaction true
AddUserNonWeb {} {} $row_name inforow
- begin_db_transaction $transactionState
}
}
@@ -2099,7 +2095,6 @@ proc UpdateColumnStDevGrade { columnname } {
proc UpdateGradesTableStatistic { permission_list user } {
- #begin_db_transaction
set grades_categories [get_grades_category]
# remove unset and deleted categories from stats calculation
@@ -2123,25 +2118,26 @@ proc UpdateGradesTableStatistic { permission_list user } {
lappend columns_to_update "Grand Total"
# update all of this columns
+ begin_db_transaction
foreach columnname $columns_to_update {
set update_parent_flag false
UpdateColumnStatistic $columnname $update_parent_flag
}
- #end_db_transaction
+ end_db_transaction
}
proc UpdateColumnStatistic { columnname {update_parent_flag true} } {
- #begin_db_transaction
set all_column_names [getColListFromTable GradesTable]
if { $columnname ni $all_column_names } {
- end_db_transaction
return
}
+ begin_db_transaction
UpdateColumnHighestGrade $columnname
UpdateColumnLowestGrade $columnname
UpdateColumnMeanGrade $columnname
UpdateColumnMedianGrade $columnname
UpdateColumnStDevGrade $columnname
+ end_db_transaction
# check recursion exit conditions
if { !$update_parent_flag } return
@@ -2155,7 +2151,6 @@ proc UpdateColumnStatistic { columnname {update_parent_flag true} } {
set root_category_column "Grand Total"
}
UpdateColumnStatistic $root_category_column
- #end_db_transaction
}
proc UpdateGrades { permission_list user } {