From 0e1ac4ebba97e9fbb049848ae36491e8a7d4fa1b Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Wed, 9 May 2018 11:22:56 -0400 Subject: we can modify letter grading scheme \o/ --- GradeBook_lib.tcl | 76 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 66 insertions(+), 10 deletions(-) diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index 702a2df..6715a1f 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -95,6 +95,68 @@ proc get_grading_scheme {} { return $grading_scheme } +proc htmlEditLetterGradeRequest { permission_list user } { + global script_name + puts {
} + puts {

} + puts {Assigning normalized to 1 cutoffs for letter grades.} + puts {

} + puts {

} + puts {If you want to disable "A+" make cutoff significantly higher than 1.} + puts {

} + puts {

} + puts {For example, "A-" = 0.9 and "A" = 0.94 means that a student with score in the range [0.9, 0.94) gets "A-", and any score >= 0.94 gets "A".} + puts {

} + puts {
} + puts "
" + + # table header + puts {} + puts "" + foreach col {Letter Cutoff} { + puts -nonewline "" + } + puts "" + # the rest of the table + foreach {letter cutoff} [get_grading_scheme] { + puts "" + puts -nonewline "" + # column with cutoff + puts "" + puts "" + } + puts "
$col
$letter
" + puts {} + puts {} + puts {} + puts {
} + puts {
} + puts {
} +} + +proc EditLetterGrade { permission_list user } { + global script_name + set subaction [::ncgi::value subaction {}] + set nv [::ncgi::nvlist] + array set colval $nv + if { $subaction eq "Submit" } { + begin_db_transaction + set eval_str [concat SELECT LetterGrade FROM GradingSchemeTable] + set err [catch { + db eval $eval_str v { + if { [info exist colval($v(LetterGrade))] } { + UpdateColumnWithValueInTableWhere GradingSchemeTable LowerCutoff $colval($v(LetterGrade)) LetterGrade $v(LetterGrade) + } + } + } errStat ] + end_db_transaction + if { $err } { + htmlErrorMsg $errStat + dbg "$errStat for $eval_str" msg_level_critical [lindex [info level 0] 0] + } + } +} + # Grades category and their html names proc get_grades_category {} { set eval_str "SELECT CategoryName FROM GradesCategoryTable" @@ -119,7 +181,6 @@ proc get_grades_category {} { return $grades_category } - proc default_grades_category {} { set grades_category [list \ "unset"\ @@ -133,7 +194,7 @@ proc default_grades_category {} { ] return $grades_category } - + proc getGradingWeights { } { set category_name_weight_list {} set eval_str [concat SELECT CategoryName,CategoryWeight FROM GradesCategoryTable] @@ -1779,7 +1840,9 @@ proc ChoseAction {action permission_list user} { htmlDefaultView $permission_list $user } update_grades_stats { UpdateGradesTableStatistic $permission_list $user htmlDefaultView $permission_list $user } - edit_letter_grade_request { EditLetterGradeRequest $permission_list $user } + edit_letter_grade_request { htmlEditLetterGradeRequest $permission_list $user } + edit_letter_grade { EditLetterGrade $permission_list $user + htmlDefaultView $permission_list $user } edit_user_grade_request { htmlEditUserGradeValue $permission_list $user } edit_user_grade { EditUserGradeValue $permission_list $user htmlDefaultView $permission_list $user } @@ -2310,13 +2373,6 @@ proc UpdateColumnStDevGrade { columnname } { UpdateColValue4UserNameNonWeb $columnname _The_StDev_Grade_ $val } -proc EditLetterGradeRequest { permission_list user } { - foreach {letter cutoff} [get_default_grading_scheme] { - # fixme - htmlErrorMsg "$letter $cutoff" - } -} - proc UpdateGradesTableStatistic { permission_list user } { set grades_categories [get_grades_category] -- cgit v1.2.3