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

 <instance of xowf::test_item::Question_manager[i]> exam_target_time \
    [ -manager manager ] [ -base_time base_time ]

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

Calculate the exam target time (finishing time) based on the duration of the exam plus the provided base_time (which is in the format returned by SQL)

Switches:
-manager
(optional)
exam workflow
-base_time
(optional)
time in SQL format

Partial Call Graph (max 5 caller/called nodes):
%3 test_create_test_items create_test_items (test xowf) xowf::test_item::Question_manager instproc exam_target_time xowf::test_item::Question_manager instproc exam_target_time test_create_test_items->xowf::test_item::Question_manager instproc exam_target_time xo::db::tcl_date xo::db::tcl_date (public) xowf::test_item::Question_manager instproc exam_target_time->xo::db::tcl_date

Testcases:
create_test_items
Source code:
set total_minutes [:total_minutes_for_exam -manager $manager]

# Use "try" for backward compatibility, versions before
# factional seconds. TODO: remove me.
try {
  set base_clock [clock scan [::xo::db::tcl_date $base_time tz secfrac]]
  if {[string length $secfrac] > 3} {
    set secfrac [string range $secfrac 0 2]
  }
} on error {errorMsg} {
  set base_clock [clock scan [::xo::db::tcl_date $base_time tz]]
  set secfrac 0
}
set target_time [clock format [expr {int($base_clock + $total_minutes * 60)}]  -format %Y-%m-%dT%H:%M:%S]
#ns_log notice "exam_target_time $base_time base clock $base_clock + total_minutes $total_minutes = ${target_time}.$secfrac"
return ${target_time}.$secfrac
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: