aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2018-05-10 16:15:52 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2018-05-10 16:18:46 -0400
commit00888946676b6e21bbf5be73668fa4da55d9cdb4 (patch)
tree8e2cf47a758535004242685a9e16a489cec97dad
parentf650fc5d56b6d7c82b0d9d11dd1f1de14718caa6 (diff)
downloadGradeBook-00888946676b6e21bbf5be73668fa4da55d9cdb4.tar.gz
GradeBook-00888946676b6e21bbf5be73668fa4da55d9cdb4.zip
Added display of the grading scheme to the html output
-rwxr-xr-xGradeBook_lib.tcl37
1 files changed, 37 insertions, 0 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl
index f2b87cf..5df6c71 100755
--- a/GradeBook_lib.tcl
+++ b/GradeBook_lib.tcl
@@ -961,6 +961,7 @@ proc FillDefaultAccessRights {} {
AddDefaultAccessRight edit_user_grade 1 1 0 0 0
AddDefaultAccessRight edit_letter_grade_request 1 0 0 0 0
AddDefaultAccessRight edit_letter_grade 1 0 0 0 0
+ AddDefaultAccessRight show_grading_schema 1 1 1 1 0
}
proc getDefaultPermissionsForGroup { group } {
@@ -1805,6 +1806,7 @@ proc ChoseAction {action permission_list user} {
htmlDefaultView $permission_list $user
}
showcontrols { ShowControls $permission_list $user }
+ show_grading_schema { htmlShowGradingSchema $permission_list $user }
hidecolfromstudents { HideColumnFromStudents $permission_list $user
htmlDefaultView $permission_list $user }
unhidecolfromstudents { UnHideColumnFromStudents $permission_list $user
@@ -2864,8 +2866,43 @@ proc htmlGradesTable {db permission_list user} {
}
}
+proc htmlShowGradingSchema { permission_list user } {
+ set grading_scheme [get_grading_scheme]
+ set prevThreshold ""
+ set skipAplus true
+ set separator ";"
+ puts {<div class="grading_scheme">}
+ puts {<p>}
+ puts {Final letter grade is assigned by the following scheme:}
+ puts {</p>}
+ puts {<p>}
+ foreach {letter threshold} $grading_scheme {
+ if { $skipAplus} {
+ if { $letter eq "A+" } { continue }
+ }
+ # converting to percents
+ set threshold [expr {round(100.0*$threshold)}]
+ set threshold "$threshold%"
+ if { $prevThreshold eq "" } {
+ puts -nonewline "$letter: >= $threshold"
+ } else {
+ if { $letter eq "F" } {
+ puts -nonewline "$separator $letter: < $prevThreshold"
+ } else {
+ puts -nonewline "$separator $letter: ($prevThreshold, $threshold]"
+ }
+ }
+ set prevThreshold $threshold
+ }
+ puts ""
+ puts {</p>}
+ puts {</div>}
+
+}
+
proc htmlDefaultView { permission_list user } {
ChoseAction showcontrols $permission_list $user
+ ChoseAction show_grading_schema $permission_list $user
ChoseAction showgrades $permission_list $user
}