aboutsummaryrefslogtreecommitdiff
path: root/GradeBook_lib.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-xGradeBook_lib.tcl52
1 files changed, 23 insertions, 29 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl
index 2150ce0..7aaa8e7 100755
--- a/GradeBook_lib.tcl
+++ b/GradeBook_lib.tcl
@@ -976,39 +976,33 @@ proc htmlFormatMaxPossibleRaw { sql_column_str hidden_columns } {
puts "</tr>"
}
-proc htmlFormatTheHighestGradeRaw { sql_column_str hidden_columns } {
- # show max point values in html format
- array set v [getColAndValForUserName _The_Highest_Grade_ $sql_column_str $hidden_columns]
- set html_str "<tr>\n"
- foreach columnname $v(*) {
- if { $columnname in $hidden_columns } continue
- switch $columnname {
- "FirstName" {set col_value "Class"}
- "LastName" {set col_value "High"}
- "UserName" {set col_value "_Derived_"}
- default {
- if { ![info exists v($columnname)] } {
- set col_value "N/A"
- } else {
- set col_value $v($columnname)
- }
- }
+proc htmlFormatTheHighOrLowGradeRaw { stats_needed sql_column_str hidden_columns } {
+ # show max or min point values in html format
+ switch $stats_needed {
+ "high" {set sql_user_name _The_Highest_Grade_}
+ "low" {set sql_user_name _The_Lowest_Grade_}
+ default {
+ htmlErrorMsg "Required stats ($stats_needed) to output is not known"
+ return ""
}
- set html_str [join [list $html_str "\n" [htmlFormatColVal $col_value $columnname _The_Highest_Grade_ _The_Highest_Grade_ {} {b}] ] {}]
}
- set html_str [join [list $html_str "\n" "</tr>"]]
- return $html_str
-}
-
-proc htmlFormatTheLowestGradeRaw { sql_column_str hidden_columns } {
- # show max point values in html format
- array set v [getColAndValForUserName _The_Lowest_Grade_ $sql_column_str $hidden_columns]
+ array set v [getColAndValForUserName $sql_user_name $sql_column_str $hidden_columns]
set html_str "<tr>\n"
foreach columnname $v(*) {
+ if { ![info exists v($columnname)] } {
+ # this raw does not exist abandone raw compillation
+ return ""
+ }
if { $columnname in $hidden_columns } continue
switch $columnname {
"FirstName" {set col_value "Class"}
- "LastName" {set col_value "Low"}
+ "LastName" {
+ switch $stats_needed {
+ "high" {set col_value "High"}
+ "low" {set col_value "Low"}
+ default {set col_value "UNKNOWN"}
+ }
+ }
"UserName" {set col_value "_Derived_"}
default {
if { ![info exists v($columnname)] } {
@@ -1018,7 +1012,7 @@ proc htmlFormatTheLowestGradeRaw { sql_column_str hidden_columns } {
}
}
}
- set html_str [join [list $html_str "\n" [htmlFormatColVal $col_value $columnname _The_Lowest_Grade_ _The_Lowest_Grade_ {} {b}] ] {}]
+ set html_str [join [list $html_str "\n" [htmlFormatColVal $col_value $columnname _The_Highest_Grade_ _The_Highest_Grade_ {} {b}] ] {}]
}
set html_str [join [list $html_str "\n" "</tr>"]]
return $html_str
@@ -1167,8 +1161,8 @@ proc htmlDBout {db permission_list user {sort_col {}}} {
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
- puts [htmlFormatTheHighestGradeRaw $sql_column_str $hidden_columns]
- puts [htmlFormatTheLowestGradeRaw $sql_column_str $hidden_columns]
+ puts [htmlFormatTheHighOrLowGradeRaw high $sql_column_str $hidden_columns]
+ puts [htmlFormatTheHighOrLowGradeRaw low $sql_column_str $hidden_columns]
}
puts "<tr>"