aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xGradeBook_lib.tcl22
1 files changed, 22 insertions, 0 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl
index 7f8bac4..d189acd 100755
--- a/GradeBook_lib.tcl
+++ b/GradeBook_lib.tcl
@@ -129,6 +129,28 @@ proc isCalculateTotalForCategorySet { category } {
}
}
+proc howManyGradesToDropForCategorySet { category } {
+ if {![existsColumnWithRowvalueInTable GradesCategoryTable CategoryName $category ]} {
+ dbg "Category: $category does not exists in the GradesCategoryTable, setting number of grades to drop to 0" msg_level_info
+ return 0
+ }
+ if { ![doesColumnExists NumberToDrop GradesCategoryTable] } {
+ dbg "Do not have column NumberToDrop in the table GradesCategoryTable, setting number of grades to drop to 0" msg_level_info
+ return 0
+ }
+ set num [SelectColvalueFromTable GradesCategoryTable NumberToDrop CategoryName $category]
+ if { ![string is double -strict $num] } {
+ dbg "Number of grades to drop is not a number, returning 0" msg_level_info
+ return 0
+ }
+ if { ![string is integer -strict $num] } {
+ set new_num [expr {round($num)}]
+ dbg "Number of grades to drop is a double: $num, rounding it to $new_num" msg_level_info
+ return $new_num
+ }
+ return $num
+}
+
proc allUserNamesInGroup { group } {
set eval_str [concat SELECT UserName FROM \'GradesTable\' WHERE GroupName == \'$group\']
set username_list {}