xowf::WorkflowPage instproc answer_is_correct (public)

 <instance of xowf::WorkflowPage[i]> answer_is_correct

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

Check, if answer is correct based on "answer" and "correct_when" attributes of form fields and provided user input.

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

Testcases:
No testcase defined.
Source code:
set correct 0
:log "WorkflowPage(${:name}).answer_is_correct autocorrect '[:get_from_template auto_correct]' -- [string is true -strict [:get_from_template auto_correct]]"
if {[string is true -strict [:get_from_template auto_correct]]} {
  :log "==== answer_is_correct '[:instantiated_form_fields]'"
  foreach f [:instantiated_form_fields] {
    #:log [$f serialize]
    #:log "checking correctness [$f name] [$f info class] answer?[$f exists value] correct_when ?[$f exists correct_when]"
    if {[$f exists value]} {
      set r [$f answer_is_correct]
      #:log [$f serialize]
      if {$r != 1} {
        #:log [$f serialize]
        #:log "checking correctness [$f name] failed ([$f answer_is_correct])"
        set correct -1
        break
      }
      set correct 1
    }
  }
}
return $correct
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: