From 9655899f923d0c70809b8952d5d99e7599a525fb Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Sun, 8 Dec 2013 20:28:26 -0500 Subject: Creation of GradesCategoryTable adds NumberToDrop clolumn --- GradeBook_lib.tcl | 12 ++++++++++-- 1 file 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") } { -- cgit v1.2.3