aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2013-12-05 22:25:00 -0500
committerEugeniy Mikhailov <evgmik@gmail.com>2013-12-05 22:25:00 -0500
commit26e93d7c5b64d6420f9bfea2f2125f81ccdc714a (patch)
treeba20ec7438d07f373d41ba64b446b181bcd5ad98
parentf5cec25730f01effd14376bec8a5fa28baaf0f2c (diff)
downloadGradeBook-26e93d7c5b64d6420f9bfea2f2125f81ccdc714a.tar.gz
GradeBook-26e93d7c5b64d6420f9bfea2f2125f81ccdc714a.zip
wrap inside of transaction only weights recalculation
-rwxr-xr-xGradeBook.tcl18
-rwxr-xr-xGradeBook_lib.tcl19
2 files changed, 19 insertions, 18 deletions
diff --git a/GradeBook.tcl b/GradeBook.tcl
index cb7ddf4..9c785f6 100755
--- a/GradeBook.tcl
+++ b/GradeBook.tcl
@@ -87,28 +87,10 @@ if { [file exists $dbfile] && ("$coursedbfname" ne "") } {
puts "<body>"
sqlite3 db $dbfile
- # we will do everything with in one transaction
- # otherwise I see performance degradation on some computers
- # when there are a lot if update statements
- set eval_str [concat BEGIN TRANSACTION]
- set err [catch {db eval $eval_str } errStat]
- if { $err } {
- htmlErrorMsg $errStat
- dbg "the following error happen: $errStat" msg_level_critical
- }
-
set permission_list [ AccessGroupRights db $user ]
htmlTop $permission_list
ChoseAction $action $permission_list $user
- # ending transaction right before closing database
- set eval_str [concat END TRANSACTION]
- set err [catch {db eval $eval_str } errStat]
- if { $err } {
- htmlErrorMsg $errStat
- dbg "the following error happen: $errStat" msg_level_critical
- }
-
db close
} else {
htmlHeaderDBSelector
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl
index 572430e..9b7293c 100755
--- a/GradeBook_lib.tcl
+++ b/GradeBook_lib.tcl
@@ -209,6 +209,16 @@ proc calculteSumOfPointsForStudentInCategory { student category } {
}
proc calculteWeightedTotals { } {
+ # we will do everything with in one transaction
+ # otherwise I see performance degradation on some computers
+ # when there are a lot if update statements
+ set eval_str [concat BEGIN TRANSACTION]
+ set err [catch {db eval $eval_str } errStat]
+ if { $err } {
+ htmlErrorMsg $errStat
+ dbg "the following error happen: $errStat" msg_level_critical
+ }
+
set grades_category [ get_grades_category ]
#global grades_category
set all_column_names [getColListFromTable GradesTable]
@@ -297,6 +307,15 @@ proc calculteWeightedTotals { } {
set max_weighted_sum [ expr {$max_weighted_sum +$weight} ]
}
UpdateColValue4UserNameNonWeb $grand_total_col_name _Max_Points_ $max_weighted_sum
+
+ # ending transaction
+ set eval_str [concat END TRANSACTION]
+ set err [catch {db eval $eval_str } errStat]
+ if { $err } {
+ htmlErrorMsg $errStat
+ dbg "the following error happen: $errStat" msg_level_critical
+ }
+
}
proc grade_Category2html_name { category } {