aboutsummaryrefslogtreecommitdiff
path: root/GradeBook_lib.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-xGradeBook_lib.tcl101
1 files changed, 82 insertions, 19 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl
index ccca241..6cddfc3 100755
--- a/GradeBook_lib.tcl
+++ b/GradeBook_lib.tcl
@@ -907,29 +907,90 @@ proc htmlGradesTableHeadersRaw { permission_list user sql_column_str hidden_colu
puts "</tr>"
}
+proc getColAndValForUserName { user_name sql_column_str hidden_columns } {
+ set eval_str [concat SELECT $sql_column_str FROM GradesTable WHERE UserName=\"$user_name\"]
+ set err [catch {
+ db eval $eval_str v {
+ }
+ } errStat ]
+ if { $err } {
+ dbg "we should never be here if UserName: $user_name exist in the table" msg_level_critical
+ dbg $errStat msg_level_critical
+ htmlErrorMsg $errStat
+ return
+ } else {
+ return [array get v]
+ }
+}
+
proc htmlFormatMaxPossibleRaw { sql_column_str hidden_columns } {
# show max point values in html format
puts "<tr>"
- set eval_str_MP [concat SELECT $sql_column_str FROM GradesTable WHERE UserName=\"_Max_Points_\"]
- set errMaxPoints [catch {
- db eval $eval_str_MP v_MP {
- foreach c $v_MP(*) {
- if { $c in $hidden_columns } continue
- switch $c {
- "FirstName" {set MaxPointsStr "Max"}
- "LastName" {set MaxPointsStr "Possible"}
- "GroupName" {set MaxPointsStr ""}
- "UserName" {set MaxPointsStr "_Derived_"}
- default {set MaxPointsStr $v_MP($c)}
+ array set v [getColAndValForUserName _Max_Points_ $sql_column_str $hidden_columns]
+ foreach c $v(*) {
+ if { $c in $hidden_columns } continue
+ switch $c {
+ "FirstName" {set out_str "Max"}
+ "LastName" {set out_str "Possible"}
+ "GroupName" {set out_str ""}
+ "UserName" {set out_str "_Derived_"}
+ default {
+ if { ![info exists v($c)] } {
+ set out_str "N/A"
+ } else {
+ set out_str $v($c)
}
- puts "<td> <b>$MaxPointsStr</b> </td>"
- }
+ }
+ }
+ puts "<td> <b>$out_str</b> </td>"
+ }
+ puts "</tr>"
+}
+
+proc htmlFormatTheHighestGradeRaw { sql_column_str hidden_columns } {
+ # show max point values in html format
+ puts "<tr>"
+ array set v [getColAndValForUserName _The_Highest_Grade_ $sql_column_str $hidden_columns]
+ foreach c $v(*) {
+ if { $c in $hidden_columns } continue
+ switch $c {
+ "FirstName" {set out_str "Class"}
+ "LastName" {set out_str "High"}
+ "GroupName" {set out_str ""}
+ "UserName" {set out_str "_Derived_"}
+ default {
+ if { ![info exists v($c)] } {
+ set out_str "N/A"
+ } else {
+ set out_str $v($c)
+ }
+ }
+ }
+ puts "<td> <b>$out_str</b> </td>"
+ }
+ puts "</tr>"
+}
+
+proc htmlFormatTheLowestGradeRaw { sql_column_str hidden_columns } {
+ # show max point values in html format
+ puts "<tr>"
+ array set v [getColAndValForUserName _The_Lowest_Grade_ $sql_column_str $hidden_columns]
+ foreach c $v(*) {
+ if { $c in $hidden_columns } continue
+ switch $c {
+ "FirstName" {set out_str "Class"}
+ "LastName" {set out_str "Low"}
+ "GroupName" {set out_str ""}
+ "UserName" {set out_str "_Derived_"}
+ default {
+ if { ![info exists v($c)] } {
+ set out_str "N/A"
+ } else {
+ set out_str $v($c)
+ }
+ }
}
- } errStat_MP ]
- if { $errMaxPoints } {
- dbg "we should never be here if UserName: _Max_Points_ exist in the table" msg_level_critical
- dbg $errStat_MP msg_level_critical
- htmlErrorMsg $errStat_MP
+ puts "<td> <b>$out_str</b> </td>"
}
puts "</tr>"
}
@@ -1026,7 +1087,9 @@ proc htmlDBout {db permission_list user {sort_col {}}} {
puts {<table class="gradestable" border="1">}
set v_array_list [array get v]
htmlGradesTableHeadersRaw $permission_list $user $sql_column_str $hidden_columns $v_array_list
- htmlFormatMaxPossibleRaw $sql_column_str $hidden_columns
+ htmlFormatMaxPossibleRaw $sql_column_str $hidden_columns
+ htmlFormatTheHighestGradeRaw $sql_column_str $hidden_columns
+ htmlFormatTheLowestGradeRaw $sql_column_str $hidden_columns
}
puts "<tr>"