aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xGradeBook_lib.tcl12
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") } {