Index: openacs-4/packages/xowf/tcl/test-item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/test-item-procs.tcl,v diff -u -N -r1.7.2.30 -r1.7.2.31 --- openacs-4/packages/xowf/tcl/test-item-procs.tcl 21 Mar 2020 05:51:02 -0000 1.7.2.30 +++ openacs-4/packages/xowf/tcl/test-item-procs.tcl 21 Mar 2020 09:43:13 -0000 1.7.2.31 @@ -1126,6 +1126,9 @@ # - get_wf_instances # - get_answers # + # - get_duration + # - get_IPs + # # - marked_results # - answers_panel # - result_table @@ -1242,6 +1245,7 @@ wf:object } { # get_wf_instances: return the workflow instances + :assert_assessment_container $wf return [::xowiki::FormPage get_form_entries \ @@ -1272,6 +1276,41 @@ ######################################################################## + :public method get_duration {revision_sets} { + # + # Get the duration from a set of revisions and return a dict + # containing at least "from", "to" and "duration" + # + + 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 creation_date] tz]] + 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" + return $r + } + + ######################################################################## + + :public method get_IPs {revision_sets} { + # + # Get the IP addresses for the given revision set. Should be + # actually only one. The revision_set must not be empty. + # + foreach revision_set $revision_sets { + set ip [ns_set get $revision_set creation_ip] + if {$ip ne ""} { + dict set IPs [ns_set get $revision_set creation_ip] 1 + } + } + return [dict keys $IPs] + } + + ######################################################################## + :method participant_result { -obj:object answerObj:object