xowf::test_item::Answer_manager method exam_results (public)

 <instance of xowf::test_item::Answer_manager[i]> exam_results \
    [ -manual_gradings manual_gradings ] \
    [ -gradingScheme gradingScheme ] [ -only_grades on|off ] \
    [ -reply ] [ -format format ] [ -orderby orderby ] results_dict

Defined in packages/xowf/tcl/test-item-procs.tcl

Return results either as HTML table, as HTML chart or as csv. When "reply" is set. the result is returned directly to the browser (for downloading). When "gradingScheme" is empty, this method returns the following fields: participant, question, achieved_points, achievable points, comment When the "gradingScheme" is specified the results are per-participant. In this cases, when the "gradingScheme" is "....::none", the fields are participant, achieved, percentage otherwise the grade and rounding of achieved points and percentage are exported based on the rules of the grading scheme. participant, achieved, percentage, grade When additionally "only_grades" is specified, just participant and grad are returned/exported.

Switches:
-manual_gradings
(optional)
-gradingScheme
(optional)
needed for reporting grades, can be empty
-only_grades
(boolean) (defaults to "false") (optional)
-reply
(defaults to "false") (optional)
when false, csv will be returned as text, when true, it will be returned as response to the browser.
-format
(defaults to "csv") (optional)
-orderby
(defaults to "participant,desc") (optional)
Parameters:
results_dict - the results to format as csv, every key in the dict represents a user_id.
Returns:
csv as value or as response to the client

Partial Call Graph (max 5 caller/called nodes):
%3 ad_decode ad_decode (public) ad_script_abort ad_script_abort (public) xowf::test_item::Answer_manager instproc exam_results xowf::test_item::Answer_manager instproc exam_results xowf::test_item::Answer_manager instproc exam_results->ad_decode xowf::test_item::Answer_manager instproc exam_results->ad_script_abort

Testcases:
No testcase defined.
Source code:
set result ""
if {$gradingScheme eq ""} {
  set t [:result_table per_question  -manual_gradings $manual_gradings  $results_dict]
} else {
  set t [:result_table per_participant  -gradingScheme $gradingScheme  -only_grades $only_grades  -manual_gradings $manual_gradings  $results_dict]
}

lassign [split $orderby ,] att order

$t orderby  -order [expr {$order eq "asc" ? "increasing" : "decreasing"}]  -type [ad_decode $att achieved real achievable real grade integer dictionary]  $att

if {$reply} {
  switch $format {
    html    {
      ns_return 200 "text/html; charset=utf-8" [$t asHTML]
      ad_script_abort
    }
    default {set result [$t write_csv]}
  }
} else {
  switch $format {
    chart   {set result [:grading_table [$t set __grade_dict]]}
    html    {set result [$t asHTML]}
    default {set result [$t format_csv]}
  }
}
$t destroy
return $result
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: