diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2013-12-08 18:33:43 -0500 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2013-12-08 18:33:43 -0500 |
commit | b0654412ce518cb8a22ace232f4734da49047bb6 (patch) | |
tree | 7e7e750f861e971407afdf157918fec3bbac1711 /GradeBook_lib.tcl | |
parent | 3e91cd5c708b80c6c769bc0d8c8e9949e838ccfd (diff) | |
download | GradeBook-b0654412ce518cb8a22ace232f4734da49047bb6.tar.gz GradeBook-b0654412ce518cb8a22ace232f4734da49047bb6.zip |
added function to read from table number of grades to drop
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-x | GradeBook_lib.tcl | 22 |
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 {} |