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

 <instance of xowf::test_item::Question_manager[i]> get_pool_questions \
    [ -allowed_forms allowed_forms ] [ -field_name field_name ] \
    pool_question_obj exam_question_names

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

Obtain for the specs in the pool_question_obj potential replacement items in form of a replacement dict. For raw forms (i.e., not obtained via the renaming form-loader), we have just the plain "answer", which can be provided via the "field_name" attribute.

Switches:
-allowed_forms
(defaults to "en:edit-interaction.wf") (optional)
-field_name
(optional)
Parameters:
pool_question_obj
exam_question_names

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.
Source code:
set query_dict [:fc_to_dict [$pool_question_obj property form_constraints]]
if {$field_name eq ""} {
  #
  # No field name was provided, so get the field name from the
  # question obj.
  #
  set field_name [:FL form_name_based_attribute_stem [$pool_question_obj name]]
  if {![dict exists $query_dict $field_name]} {
    #
    # Fall back to field_name "answer". This will be necessary,
    # when called with question_objs not adapted by the renaming
    # form-loader.
    #
    if {[dict exists $query_dict answer]} {
      ns_log notice "get_pool_questions: fallback from field_name '$field_name' to 'answer'"
      set field_name answer
    }
  }
} elseif {![dict exists $query_dict $field_name]} {
  ns_log warning "QM get_pool_questions: the provided field name '$field_name'"  "is not defined in the form_constraints, fall back to '[lindex [dict keys $query_dict] 0]'"
  set field_name [lindex [dict keys $query_dict] 0]
}
set question_attributes [dict get [$pool_question_obj instance_attributes] question]
set minutes [dict get $question_attributes question.minutes]
set points [dict get $question_attributes question.points]

set fc_dict [dict get $query_dict $field_name]
set lang [string range [$pool_question_obj nls_language] 0 1]

append key test-item-replacement-cands  - $minutes - $points - $lang - $fc_dict - [$pool_question_obj revision_id]
ns_log notice "get_pool_questions fetch via key: '$key'"

return [ns_cache_eval -expires 1m -- ns:memoize $key {
  :get_pool_replacement_candidates  -minutes $minutes  -points $points  -fc_dict $fc_dict  -lang $lang  $pool_question_obj
}]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: