diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2013-12-08 20:28:26 -0500 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2013-12-08 20:28:26 -0500 |
commit | 9655899f923d0c70809b8952d5d99e7599a525fb (patch) | |
tree | fd3e4e10b9dc4e53e328c4576f43fcabb1b274d4 | |
parent | a1519228f634d87938cac44391c3144b13013a55 (diff) | |
download | GradeBook-9655899f923d0c70809b8952d5d99e7599a525fb.tar.gz GradeBook-9655899f923d0c70809b8952d5d99e7599a525fb.zip |
Creation of GradesCategoryTable adds NumberToDrop clolumn
-rwxr-xr-x | GradeBook_lib.tcl | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index 5b68c67..829d6b5 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -548,7 +548,14 @@ proc ModifyWeightForGradesCategory {db category weight} { } UpdateColumnWithValueInTableWhere GradesCategoryTable CategoryWeight $weight CategoryName $category } -\ + +proc ModifyNumberOfLowestGradesToDropGradesCategory {db category num} { + if {![existsColumnWithRowvalueInTable GradesCategoryTable CategoryName $category ]} { + dbg "Category: $category already does not exists in the GradesCategoryTable, creating it" msg_level_info + AddGradesCategory db $category + } + UpdateColumnWithValueInTableWhere GradesCategoryTable NumberToDrop $num CategoryName $category +} proc AddGradesCategory {db category} { if {[existsColumnWithRowvalueInTable GradesCategoryTable CategoryName $category ]} { @@ -563,11 +570,12 @@ proc AddGradesCategory {db category} { } ModifyWeightForGradesCategory db $category 0 ModifyNeedsTotalForGradesCategory db $category false + ModifyNumberOfLowestGradesToDropGradesCategory db $category 0 } proc CreateGradesCategoryTable {db} { # construct sql string for table creation - set sql_str {CREATE TABLE GradesCategoryTable(CategoryName text, CategoryWeight float, NeedsTotal text)} + set sql_str {CREATE TABLE GradesCategoryTable(CategoryName text, CategoryWeight float, NeedsTotal text, NumberToDrop integer)} set err [catch {db eval $sql_str } errStat] if { $err && ($errStat ne "table GradesCategoryTable already exists") } { |