aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2018-05-12 13:45:58 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2018-05-12 13:45:58 -0400
commita9c4b7882060759e975b46c89a69d884b6f10cc1 (patch)
treefeda652870ffe4c0c7324cd689f83ce58826b1b3
parent628b65524858d0b0b602279e6bb8ae2f43923d74 (diff)
downloadGradeBook-a9c4b7882060759e975b46c89a69d884b6f10cc1.tar.gz
GradeBook-a9c4b7882060759e975b46c89a69d884b6f10cc1.zip
more elegant display of the grading scheme
-rwxr-xr-xGradeBook_lib.tcl12
1 files changed, 7 insertions, 5 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl
index 2379720..95e3749 100755
--- a/GradeBook_lib.tcl
+++ b/GradeBook_lib.tcl
@@ -2909,12 +2909,14 @@ proc htmlShowGradingSchema { permission_list user } {
set grading_scheme [get_grading_scheme]
set prevThreshold ""
set skipAplus true
- set separator ";"
+ set separator "; "
puts {<div class="grading_scheme">}
puts {<p>}
puts {Final letter grade is assigned by the following scheme:}
puts {</p>}
puts {<p>}
+ set scheme_strings {}
+ # we assume that grading_scheme sorted in order from A+ to F
foreach {letter threshold} $grading_scheme {
if { $skipAplus} {
if { $letter eq "A+" } { continue }
@@ -2923,17 +2925,17 @@ proc htmlShowGradingSchema { permission_list user } {
set threshold [expr {round(100.0*$threshold)}]
set threshold "$threshold%"
if { $prevThreshold eq "" } {
- puts -nonewline "$letter: >= $threshold"
+ lappend scheme_strings "$letter: >= $threshold"
} else {
if { $letter eq "F" } {
- puts -nonewline "$separator $letter: < $prevThreshold"
+ lappend scheme_strings "$letter: < $prevThreshold"
} else {
- puts -nonewline "$separator $letter: \[$threshold, $prevThreshold)"
+ lappend scheme_strings "$letter: \[$threshold, $prevThreshold)"
}
}
set prevThreshold $threshold
}
- puts ""
+ puts [join [lreverse $scheme_strings] $separator]
puts {</p>}
puts {</div>}