xowf::test_item::Answer_manager method result_table per_participant (protected)
<instance of xowf::test_item::Answer_manager> result_table per_participant \ [ -manual_gradings manual_gradings ] \ [ -gradingScheme gradingScheme ] [ -only_grades on|off ] \ results_dict
Defined in packages/xowf/tcl/test-item-procs.tcl
- Switches:
- -manual_gradings (optional)
- -gradingScheme (optional)
- -only_grades (optional, boolean, defaults to
"false"
)- Parameters:
- results_dict (required)
- Testcases:
- No testcase defined.
Source code: ns_log notice "per_participant gradingScheme $gradingScheme" # # In case "only_grades" is specified, hide field "achieved". # set fieldType [expr {$only_grades ? "HiddenField" : "Field"}] set fieldTypeGrade [expr {$gradingScheme eq "::xowf::test_item::grading::none" ? "HiddenField" : "Field"}] set grade_dict {} set table [::xowiki::TableWidget new -name results -columns [subst { Field create participant -label #xowf.participant# -orderby participant $fieldType create achieved -label #xowf.Achieved_points# -orderby achieved -html {align right} HiddenField create achievable -label #xowf.Achievable_points# -orderby achievable -html {align right} $fieldType create percentage -label #xowf.Percentage# -orderby percentage -html {align right} $fieldTypeGrade create grade -label #xowf.Grade# -orderby grade -html {align right} }]] #ns_log notice "We have in results_dict the following users: [dict keys $results_dict]" foreach {user_id properties} $results_dict { if {[llength $properties] == 0} { # # The user has not seen any exercises, probably in "initial" # state, ignore it. # continue } set manual_grading [:dict_value $manual_gradings $user_id] set achievedPoints 0.0 set achievablePoints 0.0 set participant [acs_user::get_element -user_id $user_id -element username] foreach qn [dict keys [dict get $results_dict $user_id]] { set achievable [dict get $results_dict $user_id $qn achievable] # # Respect manual_grading, since these are eagerly updated # via exam protocol. # set achieved [:dict_value [:dict_value $manual_grading $qn] achieved] if {$achieved eq ""} { set achieved [dict get $results_dict $user_id $qn achieved] } # # When a participant has not done yet this exercise, the # value might be empty. # if {$achieved eq ""} { set achieved 0 } set achievedPoints [expr {$achievedPoints + $achieved}] set achievablePoints [expr {$achievablePoints + $achievable}] } set gradingDict [$gradingScheme grading_dict [list achievedPoints $achievedPoints achievablePoints $achievablePoints totalPoints $achievablePoints]] #ns_log notice "COMPLETED DICT $gradingDict" set grade [$gradingScheme grade -achieved_points $gradingDict] dict incr grade_dict $grade set l [::xo::Table::Line new] $table add -participant $participant -achievable $achievablePoints -achieved [dict get $gradingDict achievedPoints] -percentage [dict get $gradingDict percentageRounded] -grade $grade } $table set __grade_dict $grade_dict return $tableXQL Not present: Generic, PostgreSQL, Oracle