lib/openwfe/expressions/fe_cursor.rb in openwferu-0.9.4 vs lib/openwfe/expressions/fe_cursor.rb in openwferu-0.9.5
- old
+ new
@@ -37,12 +37,13 @@
# "made in Japan"
#
# John Mettraux at openwfe.org
#
+require 'openwfe/expressions/condition'
+require 'openwfe/expressions/wtemplate'
require 'openwfe/expressions/flowexpression'
-require 'openwfe/expressions/fe_condition'
#
# 'cursor' and 'loop' expressions
#
@@ -67,18 +68,21 @@
# back and forth within it.
#
class CursorExpression < WithTemplateExpression
attr_accessor \
+ :loop_id,
:current_child_id,
:current_child_fei
#
# apply / reply
def apply (workitem)
+ @loop_id = 0
+
@current_child_id = -1
clean_children_list()
reply(workitem)
@@ -117,10 +121,11 @@
if @current_child_id >= @children.length
if not is_loop
reply_to_parent(workitem)
return
end
+ @loop_id += 1
@current_child_id = 0
end
end
workitem.attributes.delete(command_field)
@@ -132,11 +137,11 @@
@current_child_fei = @children[@current_child_id]
#
# launch the next child as a template
- get_expression_pool\
- .launch_template(self, @current_child_fei, workitem, nil)
+ get_expression_pool.launch_template(
+ self, @loop_id, @current_child_fei, workitem, nil)
end
#
# takes care of cancelling the current child if necessary
#