From 48427bb515d5ea718aa6e98da44eb51a8bef6717 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Thu, 27 Mar 2014 13:58:35 -0400 Subject: max point html table raw moved into separate proc --- GradeBook_lib.tcl | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) (limited to 'GradeBook_lib.tcl') diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index 87ff2ab..6f914c8 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -838,6 +838,33 @@ proc number2letter_grade { num } { return "NA" } +proc htmlFormatMaxPossibleRaw { sql_column_str hidden_columns } { + # show max point values in html format + puts "" + 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)} + } + puts " $MaxPointsStr " + } + } + } 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 "" +} + proc htmlDBout {db permission_list user {sort_col {}}} { array set permission $permission_list global GradebookServerConfig @@ -990,30 +1017,7 @@ proc htmlDBout {db permission_list user {sort_col {}}} { puts "" } puts "" - # show max point values - puts "" - 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)} - } - puts " $MaxPointsStr " - } - } - } 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 "" + htmlFormatMaxPossibleRaw $sql_column_str $hidden_columns puts "" } else { puts "" -- cgit v1.2.3