Hello,
you could directly do
sequence :tag => 'submission' do
author :task => 'overview', :progress => '1/10'
author :task => 'author_info', :progress => '2/10'
author :task => 'upload_files', :progress => '3/10'
author :task => 'gap_analysis', :progress => '4/10'
author :task => 'responsibilities', :progress => '5/10'
author :task => 'disclosure', :progress => '6/10'
author :task => 'copyright', :progress => '7/10'
author :task => 'fees', :progress => '8/10'
author :task => 'review', :progress => '9/10'
author :task => 'submit', :progress => '10/10'
end
It's easier (on ruote) than
author :task => 'overview', tag => '1/10'
because ruote doesn't have to keep a copy of the tag.
Tags are more appropriate when you do things like
sequence :tag => 'submission' do
concurrence :tag => '1/2' do
author :task => 'overview'
editor :task => 'guide'
concurrence :tag => '2/2' do
author :task => 'terminate'
editor :task => 'harass'
end
end
where the tags 'propagate' via the workitem. (as seen in
http://ruote.rubyforge.org/common_attributes.html#tag )
Note that if you're using Ruby process definitions, you could do
sequence :tag => 'submission' do
tasks = %w[
overview author_info upload_files gap_analysis responsibilities
disclosure copyright fees review submit
]
tasks.each_with_index { |t, i|
author :task => t, :progress => "#{i + 1}/#{tasks.length}
}
end
It's shorter, but perhaps not immediately graspable.
If your use case is "each time my user receives a workitem, I want to notify
him of his progress", you could do, as you have access to the workitem and
the dashboard:
step = workitem.fei.child_id + 1
exp = dashboard.fetch_flow_expression(workitem)
parent_exp = dashboard.fetch_flow_expression(exp.parent_id)
progress = "#{step}/#{parent_exp.tree[2].length}"
That's OK, but it adds two requests to the dashboard. You could do that right
when the workitem reaches the participant so that you don't have to repeat
the requests each time you display the workitem.
Another way would be to place in a workitem field the "parent length":
sequence :tag => 'submission' do
flag_length
author :task => 'overview', :progress => '1/10'
author :task => 'author_info', :progress => '2/10'
author :task => 'upload_files', :progress => '3/10'
end
where
class FlagLength
include Ruote::LocalParticipant
def on_workitem
parent_exp = fetch_flow_expression(flow_expression().parent_id)
workitem['steps'] = parent_exp.tree[2].length - 1
reply
end
end
then, when handling author workitems, you can do
progress = "#{workitem.fei.child_id}/#{workitem.fields['steps']}"
I hope it helps, best regards,
--
John Mettraux - http://lambda.io/processi
Hello,
most of the examples I have are closed source as well.
I tend to avoid storing too much business info in the workitem (only storing
what's useful for routing) and point at business objects (via their primary
key usually).
The participants do a "update the business object and then give the workitem
back". I want them really separated, else I would use a state machine
focusing on the business object. My workflows orchestrate the work of one or
more persons around one or more business objects.
Sorry for being so vague,