aboutsummaryrefslogtreecommitdiff
path: root/GradeBook_lib.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-xGradeBook_lib.tcl36
1 files changed, 33 insertions, 3 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl
index cccb9ca..4509f32 100755
--- a/GradeBook_lib.tcl
+++ b/GradeBook_lib.tcl
@@ -1007,15 +1007,26 @@ proc htmlGradesTableHeadersRaw { permission_list user sql_column_str hidden_colu
global script_name
array set permission $permission_list
array set v $v_array_list
+ # we need to prepend column list with UserCount column, so the counter appears first
+ set v(*) [linsert $v(*) 0 UserCount]
+ # the following us unnessesary since this proc use $v(*) to get column names
+ # but I add the value just in case
+ set v(UserCount) DummyValueForUserCount
puts "<tr>"
+ set first_column true
foreach col $v(*) {
if { $col in $hidden_columns } continue
# detect what column category it is
- set category [SelectColValue4User $col _Col_Category_]
+ if { $col eq "UserCount" } {
+ set category "user_counter_col"
+ } else {
+ set category [SelectColValue4User $col _Col_Category_]
+ }
puts -nonewline "<th class=\"$category\"><a href=\"$script_name?action=sort&sortCol=$col\">$col</a>"
# below list has action and action_label pairs
set action_list {userhidecolumn}
switch $col {
+ UserCount { set action_list {} }
FirstName { lappend action_list changefirstname }
LastName { lappend action_list changelastname }
UserName { lappend action_list changeusername }
@@ -1091,9 +1102,12 @@ proc htmlFormatMaxPossibleRaw { sql_column_str hidden_columns } {
# show max point values in html format
puts "<tr>"
array set v [getColAndValForUserName _Max_Points_ $sql_column_str $hidden_columns]
+ # we need to prepend column list with UserCount column, so the counter appears first
+ set v(*) [linsert $v(*) 0 UserCount]
foreach c $v(*) {
if { $c in $hidden_columns } continue
switch $c {
+ "UserCount" {set out_str ""}
"FirstName" {set out_str "Max"}
"LastName" {set out_str "Possible"}
"GroupName" {set out_str ""}
@@ -1125,6 +1139,9 @@ proc htmlFormatTheStatsForGradeRaw { stats_needed sql_column_str hidden_columns
}
}
array set v [getColAndValForUserName $sql_user_name $sql_column_str $hidden_columns]
+ # we need to prepend column list with UserCount column, so the counter appears first
+ set v(*) [linsert $v(*) 0 UserCount]
+ set v(UserCount) "."
set html_str "<tr>\n"
foreach columnname $v(*) {
if { ![info exists v($columnname)] } {
@@ -1192,8 +1209,13 @@ proc htmlFormatColVal { col_value columnname user user_shown permission_list {fo
set font_style_strt "<$font_style>"
set font_style_end "</$font_style>"
}
- set category [SelectColValue4User $columnname _Col_Category_]
- set max_points [SelectColValue4User $columnname _Max_Points_]
+ if { $columnname eq "UserCount" } {
+ set category "user_counter_col"
+ set max_points 0
+ } else {
+ set category [SelectColValue4User $columnname _Col_Category_]
+ set max_points [SelectColValue4User $columnname _Max_Points_]
+ }
set special_user_names [list _Max_Points_ _The_Highest_Grade_ _The_Lowest_Grade_ _The_Mean_Grade_ _The_Median_Grade_ _The_StDev_Grade_ ]
if { (([SelectColValue4User GroupName $user_shown] ne "inforow") || ($user in $special_user_names)) && ($category eq "weighted_column") && ($max_points != 0) } {
if { $col_value eq "" } {
@@ -1354,6 +1376,7 @@ proc htmlDBout {db permission_list user {sort_col {}}} {
#get all allowed columns and rows
set eval_str [concat SELECT $sql_column_str FROM GradesTable $where_statement ORDER BY $ordered_by_str]
set err [catch {
+ set user_cnt 0
db eval $eval_str v {
if { $show_header } {
set show_header 0
@@ -1374,11 +1397,18 @@ proc htmlDBout {db permission_list user {sort_col {}}} {
} else {
set user_shown "_UNSET_"
}
+ incr user_cnt
+ set first_column true
foreach columnname $v(*) {
if { $columnname in $hidden_columns } continue
if { $columnname != "*" } {
# detect what column category it is
set col_value $v($columnname)
+ if { $first_column } {
+ # we need to prepend first column with a user counter column
+ set first_column false
+ puts [htmlFormatColVal ${user_cnt} UserCount $user $user_shown $permission_list]
+ }
puts [htmlFormatColVal $col_value $columnname $user $user_shown $permission_list]
}
}