xowf::test_item::Question_manager method combined_question_form (public)

 <instance of xowf::test_item::Question_manager[i]> combined_question_form \
    [ -with_numbers ] [ -with_title ] [ -with_minutes ] \
    [ -with_points ] [ -user_specific ] [ -shuffle_id shuffle_id ] \
    [ -user_answers user_answers ] [ -form_objs form_objs ] obj

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

For the provided assessment, return a combined question_form as a single (combined) form, containing the content of all question forms. The result is a dict, containing also title information etc. depending on the provided parameters.

Switches:
-with_numbers (optional, defaults to "false")
-with_title (optional, defaults to "false")
-with_minutes (optional, defaults to "false")
-with_points (optional, defaults to "false")
-user_specific (optional, defaults to "false")
-shuffle_id (optional, integer, defaults to "-1")
used only for selecting form_objs
-user_answers (optional, object, accept empty)
instance of the answer-wf. Needed for user-specific percent substitutions.
-form_objs (optional, object, accept empty)
Parameters:
obj (required, object)
is the exam

Testcases:
No testcase defined.
Source code:
#ns_log notice "combined_question_form called with user_answers <$user_answers> for $obj [$obj name]"
#if {$user_answers eq ""} {xo::show_stack}

set all_form_objs [:question_objs -shuffle_id $shuffle_id $obj]
set positions {}
if {[llength $form_objs] > 0} {
  foreach form_obj $form_objs {
    lappend positions [lsearch $all_form_objs $form_obj]
  }
}
#ns_log notice "XXX combined_question_form fos=$form_objs all_form_objs=$all_form_objs <$positions>"

if {$user_specific} {
  set form_objs [:max_items [$obj property max_items ""$form_objs]
}
if {$with_numbers} {
  set numbers ""
  for {set i 1} {$i <= [llength $all_form_objs]} {incr i} {
    lappend numbers $i
  }
  if {[llength $form_objs] > 0} {
    set new_numbers {}
    set new_form_objs {}
    foreach form_obj $all_form_objs number $numbers {
      if {$form_obj in $form_objs} {
        lappend new_numbers $number
        lappend new_form_objs $form_obj
      }
    }
    set numbers $new_numbers
    set form_objs $new_form_objs
  } else {
    set form_objs $all_form_objs
  }
  set extra_flags [list -numbers $numbers]
} else {
  set form_objs $all_form_objs
  set extra_flags ""
}
return [:question_info  -with_title=$with_title  -with_minutes=$with_minutes  -with_points=$with_points  {*}$extra_flags  -obj $obj  -user_answers $user_answers  -positions $positions  $form_objs]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: