From 5b086a3a0ffd74926e8ce7a1cfaff9963ae3633a Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Thu, 8 May 2014 17:02:47 -0400 Subject: begin/end transaction placed correctly to achive fast stats update --- GradeBook_lib.tcl | 13 ++++--------- 1 file 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 } { -- cgit v1.2.3