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

 <instance of xowf::test_item::Answer_manager[i]> state_periods \
    -state state  revision_sets

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

Return for the provided revision_sets the time ranges the workflow was in the provided state.

Switches:
-state (required)
Parameters:
revision_sets (required)

Testcases:
No testcase defined.
Source code:
set periods ""
set from ""
set last_from ""
set until ""
foreach ps $revision_sets {
  set current_state [ns_set get $ps state]
  if {$state eq $current_state} {
    if {$until ne ""} {
      lappend periods [:pretty_period $last_from $until]
    }
    set from [ns_set get $ps creation_date]
    set until ""
  } elseif {$until eq "" && $current_state ne $state && $from ne ""} {
    set until [ns_set get $ps last_modified]
    set last_from $from
    set from ""
  }
}
if {$until ne ""} {
  lappend periods [:pretty_period $last_from $until]
} elseif {$from ne ""} {
  lappend periods [:pretty_period $from ""]
}
#ns_log  notice "state_periods $state <$from> <$last_from> <$until> <$periods>"
return $periods
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: