xowf::test_item::Question_manager method question_info (public)
<instance of xowf::test_item::Question_manager> question_info \ [ -numbers numbers ] [ -with_title ] [ -with_minutes ] \ [ -with_points ] [ -titleless_form ] [ -obj obj ] \ [ -user_answers user_answers ] [ -no_position ] \ [ -question_number_label question_number_label ] \ [ -positions positions ] [ -with_question_count_in_title on|off ] \ form_objs
Defined in packages/xowf/tcl/test-item-procs.tcl
Returns a dict containing "form", "title_infos", "form_constraints" "disabled_form_constraints" "randomization_for_exam" "autograde" and "question_objs". This information is obtained from the provided "form_objs".
- Switches:
- -numbers (optional)
- -with_title (optional, defaults to
"false"
)- -with_minutes (optional, defaults to
"false"
)- -with_points (optional, defaults to
"false"
)- -titleless_form (optional, defaults to
"false"
)- -obj (optional, object)
- -user_answers (optional, object, accept empty)
- -no_position (optional, defaults to
"false"
)- -question_number_label (optional, defaults to
"#xowf.question#"
)- -positions (optional, integer)
- -with_question_count_in_title (optional, boolean, defaults to
"false"
)- Parameters:
- form_objs (required)
- Returns:
- dict containing "title_infos", "form_constraints", "disabled_form_constraints", "randomization_for_exam", "autograde", "question_forms", "question_objs"
- Testcases:
- No testcase defined.
Source code: set full_fc {} set full_disabled_fc {} set title_infos {} set question_forms {} set randomizationOk 1 set autoGrade 1 if {[llength $positions] == 0} { set position -1 set positions [lmap form_obj $form_objs {incr position}] } set question_count_label "" if {$with_question_count_in_title} { set question_count_label " / [:question_count $obj]" } foreach form_obj $form_objs number $numbers position $positions { set form_obj [:FL rename_attributes $form_obj] set form_title [$form_obj title] set minutes [:question_property $form_obj minutes] set points [:question_property $form_obj points] if {$points eq ""} { #ns_log notice "[$form_obj name]: NO POINTS, default to minutes $minutes" set points $minutes } set time_budget [$obj property time_budget] if {$time_budget ni {"" 100} && $minutes ne ""} { set minutes [expr {$time_budget*$minutes/100.0}] ns_log notice "[$form_obj name]: TIME BUDGET '$time_budget' -> minutes set to $minutes" } set mapping {show_points with_points show_minutes with_minutes} foreach property {show_points show_minutes} { if {[$obj property $property] ne ""} { set [dict get $mapping $property] [$obj property $property] #ns_log notice "[$form_obj name]: override flag via exam setting: '$property' -> [$obj property $property]" } } set title "" if {$number ne ""} { append title "$question_number_label $number $question_count_label:" } set title_components {} if {$with_title} { lappend title_components [ns_quotehtml $form_title] } if {$with_minutes} { lappend title_components [:minutes_string $form_obj] } if {$with_points} { lappend title_components [:points_string $form_obj] } append title " " [join $title_components " - "] # # The flag "no_position" is just provided for the composite # form, in cases where we are called at form generation time, # where the position is different from the position in the # exam. When the position is fixed, we do not provide it as an # argument. As a consequence, the percent substitution is not # performed, since it would return always very similar values # based on a fixed position. # if {$no_position} { set positionArg {} } else { set positionArg [list -position $position] } #ns_log notice "CHECK 0 user_answers <$user_answers> (obj is the inclass exam [$obj name])" if {$user_answers eq ""} { set user_answers $obj } # # Resolve links in the context of the resolve_object # set d [:item_substitute_markup -obj $user_answers {*}$positionArg -form_obj $form_obj] lappend question_forms [dict get $d form] lappend title_infos [list full_title $title title $form_title minutes $minutes points $points number $number] lappend full_fc [:add_to_fc -fc [dict get $d form_constraints] -minutes $minutes -points $points {*}$positionArg] lappend full_disabled_fc [:add_to_fc -fc [dict get $d disabled_form_constraints] -minutes $minutes -points $points {*}$positionArg] if {![:question_is_autograded $form_obj]} { set autoGrade 0 } if {![:question_randomization_ok $form_obj]} { set randomizationOk 0 } } return [list title_infos $title_infos form_constraints [join [lsort -unique $full_fc] \n] disabled_form_constraints [join [lsort -unique $full_disabled_fc] \n] randomization_for_exam $randomizationOk autograde $autoGrade question_forms $question_forms question_objs $form_objs]XQL Not present: Generic, PostgreSQL, Oracle