aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2014-05-08 10:15:36 -0400
committerEugeniy Mikhailov <evgmik@gmail.com>2014-05-08 10:15:36 -0400
commitf95094659adaad56feb09678d363afaa51013863 (patch)
tree1660448b82116fe914347c2452bd905ea1f119f3
parente1e483138e923a641f4a14fcb518a959bf5d3d44 (diff)
downloadGradeBook-f95094659adaad56feb09678d363afaa51013863.tar.gz
GradeBook-f95094659adaad56feb09678d363afaa51013863.zip
added stded row
-rwxr-xr-xGradeBook_lib.tcl33
1 files changed, 30 insertions, 3 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl
index 82591d5..7be159f 100755
--- a/GradeBook_lib.tcl
+++ b/GradeBook_lib.tcl
@@ -754,6 +754,7 @@ proc CreateGradesTable {db} {
CheckAndCreateAsNeededInfoRow _The_Lowest_Grade_
CheckAndCreateAsNeededInfoRow _The_Mean_Grade_
CheckAndCreateAsNeededInfoRow _The_Median_Grade_
+ CheckAndCreateAsNeededInfoRow _The_StDev_Grade_
# reasonable defaults for hidden columns
#set instructor_hidden_columns [list UserHiddenColums UserHiddenGroups IdNum]
@@ -1113,6 +1114,7 @@ proc htmlFormatTheStatsForGradeRaw { stats_needed sql_column_str hidden_columns
"low" {set sql_user_name _The_Lowest_Grade_}
"mean" {set sql_user_name _The_Mean_Grade_}
"median" {set sql_user_name _The_Median_Grade_}
+ "stdev" {set sql_user_name _The_StDev_Grade_}
default {
htmlErrorMsg "Required stats ($stats_needed) to output is not known"
return ""
@@ -1134,6 +1136,7 @@ proc htmlFormatTheStatsForGradeRaw { stats_needed sql_column_str hidden_columns
"low" {set col_value "Low"}
"mean" {set col_value "Mean"}
"median" {set col_value "Median"}
+ "stdev" {set col_value "StDev"}
default {set col_value "UNKNOWN"}
}
}
@@ -1297,6 +1300,7 @@ proc htmlDBout {db permission_list user {sort_col {}}} {
htmlFormatMaxPossibleRaw $sql_column_str $hidden_columns
puts [htmlFormatTheStatsForGradeRaw high $sql_column_str $hidden_columns]
puts [htmlFormatTheStatsForGradeRaw mean $sql_column_str $hidden_columns]
+ puts [htmlFormatTheStatsForGradeRaw stdev $sql_column_str $hidden_columns]
puts [htmlFormatTheStatsForGradeRaw median $sql_column_str $hidden_columns]
puts [htmlFormatTheStatsForGradeRaw low $sql_column_str $hidden_columns]
}
@@ -2039,7 +2043,7 @@ proc UpdateColumnMeanGrade { columnname } {
if { 0 != [llength $col_values] } {
set val [::math::statistics::mean $col_values ]
# rounding value to 2 digits
- set val [format "%04.2f" $val ]
+ set val [format "%04.2f" $val ]
}
CheckAndCreateAsNeededInfoRow _The_Mean_Grade_
@@ -2056,7 +2060,7 @@ proc UpdateColumnMedianGrade { columnname } {
if { 0 != [llength $col_values] } {
set val [::math::statistics::median $col_values ]
# rounding value to 2 digits
- set val [format "%04.2f" $val ]
+ set val [format "%04.2f" $val ]
}
CheckAndCreateAsNeededInfoRow _The_Median_Grade_
@@ -2065,6 +2069,28 @@ proc UpdateColumnMedianGrade { columnname } {
UpdateColValue4UserNameNonWeb $columnname _The_Median_Grade_ $val
}
+proc UpdateColumnStDevGrade { columnname } {
+ # find minimum in the column with a given name among active students
+ set val "N/A"
+ set col_values [GetGroupValuesInColumn student $columnname]
+ set col_values [LeaveOnlyNumbersInList $col_values]
+ if { 0 != [llength $col_values] } {
+ set val [::math::statistics::stdev $col_values ]
+ if { $val ne "" } {
+ # rounding value to 2 digits
+ set val [format "%04.2f" $val ]
+ } else {
+ set val "N/A"
+ }
+ }
+ CheckAndCreateAsNeededInfoRow _The_StDev_Grade_
+
+ set column_category [SelectColValue4User $columnname _Col_Category_]
+
+ UpdateColValue4UserNameNonWeb $columnname _The_StDev_Grade_ $val
+}
+
+
proc UpdateGradesTableStatistic { permission_list user } {
set grades_categories [get_grades_category]
@@ -2102,8 +2128,9 @@ proc UpdateColumnStatistic { columnname {update_parent_flag true} } {
}
UpdateColumnHighestGrade $columnname
UpdateColumnLowestGrade $columnname
- UpdateColumnMeanGrade $columnname
+ UpdateColumnMeanGrade $columnname
UpdateColumnMedianGrade $columnname
+ UpdateColumnStDevGrade $columnname
# check recursion exit conditions
if { !$update_parent_flag } return