diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2018-05-10 00:21:02 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2018-05-10 00:21:02 -0400 |
commit | f650fc5d56b6d7c82b0d9d11dd1f1de14718caa6 (patch) | |
tree | b048f3557dfcb98fc6607d1a13a7051f81e99a22 | |
parent | 04ae6e7aa22e7aafb532af183459efb9ff29ffa9 (diff) | |
download | GradeBook-f650fc5d56b6d7c82b0d9d11dd1f1de14718caa6.tar.gz GradeBook-f650fc5d56b6d7c82b0d9d11dd1f1de14718caa6.zip |
added grade histogram calculation
-rwxr-xr-x | GradeBook_lib.tcl | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index 6715a1f..f2b87cf 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -2288,6 +2288,29 @@ proc GetGroupValuesInColumn { group_name columnname } { return $col_values } +proc UpdateAndCreateAsNeededInfoRow { columnname inforow val } { + CheckAndCreateAsNeededInfoRow $inforow + UpdateColValue4UserNameNonWeb $columnname $inforow $val +} + +proc UpdateColumnGradesHistogram { columnname } { + # find maximum in the column with a given name among active students + set hist "N/A" + set limits "N/A" + set col_values [GetGroupValuesInColumn student $columnname] + set col_values [LeaveOnlyNumbersInList $col_values] + if { 0 != [llength $col_values] } { + set maxVal [::math::statistics::max $col_values ]; # fixme should it be _Max_Points_? + set minVal 0 + set barsNum 5; + set limits [::math::statistics::minmax-histogram-limits $minVal $maxVal [incr barsNum]] + set limits [lrange $limits 1 end-1]; # shave first and last interval limits + set hist [::math::statistics::histogram $limits $col_values ] + } + UpdateAndCreateAsNeededInfoRow $columnname _The_Grades_Histogram_ $hist + UpdateAndCreateAsNeededInfoRow $columnname _The_Grades_Hist_Limits_ $limits +} + proc UpdateColumnHighestGrade { columnname } { # find maximum in the column with a given name among active students set val "N/A" @@ -2411,11 +2434,13 @@ proc UpdateColumnStatistic { columnname {update_parent_flag true} } { return } begin_db_transaction + # FIXME all updates pull the same data. Cache it and reuse UpdateColumnHighestGrade $columnname UpdateColumnLowestGrade $columnname UpdateColumnMeanGrade $columnname UpdateColumnMedianGrade $columnname UpdateColumnStDevGrade $columnname + UpdateColumnGradesHistogram $columnname end_db_transaction # check recursion exit conditions |