xowf::test_item::Answer_manager method get_duration (public)

 <instance of xowf::test_item::Answer_manager[i]> get_duration \
    [ -exam_published_time exam_published_time ] revision_sets

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

Get the duration from a set of revisions and return a dict containing "from", "fromClock","to", "toClock", "seconds", and "duration".

Switches:
-exam_published_time
(optional)
Parameters:
revision_sets

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

Testcases:
create_test_items
Source code:
set first [lindex $revision_sets 0]
set last [lindex $revision_sets end]
set fromClock [clock scan [::xo::db::tcl_date [ns_set get $first creation_date] tz]]
set toClock [clock scan [::xo::db::tcl_date [ns_set get $last last_modified] tz]]
dict set r fromClock $fromClock
dict set r toClock $toClock
dict set r from [clock format $fromClock -format "%H:%M:%S"]
dict set r to [clock format $toClock -format "%H:%M:%S"]
set timeDiff [expr {$toClock - $fromClock}]
dict set r duration "[expr {$timeDiff/60}]m [expr {$timeDiff%60}]s"
dict set r seconds $timeDiff
if {$exam_published_time ne ""} {
  set examPublishedClock [clock scan [::xo::db::tcl_date $exam_published_time tz]]
  dict set r examPublishedClock $examPublishedClock
  dict set r examPublished [clock format $examPublishedClock -format "%H:%M:%S"]
  set epTimeDiff [expr {$toClock - $examPublishedClock}]
  dict set r examPublishedDuration "[expr {$epTimeDiff/60}]m [expr {$epTimeDiff%60}]s"
  #ns_log notice "EP examPublishedDuration [dict get $r examPublishedDuration]"  "EP [dict get $r examPublished] $exam_published_time"
  dict set r examPublishedSeconds $epTimeDiff
}
return $r
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: