Feature #5

Dynamic Workflow

Added by Michel Loiseleur 700 days ago. Updated 603 days ago.

Status:Closed Start:10/03/2008
Priority:Normal Due date:
Assigned to:Michel Loiseleur % Done:

100%

Category:Internal Spent time: -
Target version:0.8

Description

Even if it's possible to make a dynamic workflow with plugin system, it should be editable without a RoR developper.

What's currently wanted is to provides different flow & status according to the issue type. For instance, "Bypassed" or "Fixed" is correct for a bug issue but not for an information issue.

Currently, it works with a simple model. 2 constants & a switch/case :
 1   OPENED = [ 1, 2, 3, 4, 5 ] # We need to work on it
 2   CLOSED = [ 6, 7, 8 ] # The time count is now less/not important
 3 
 4   def possible(recipient = nil)
 5     search =
 6       if recipient
 7         return [] unless id == 3 || id == 2
 8         'id IN (6,7,8)'
 9       else
10         case id
11         when 1 then 'id IN (2)'            # Submitted -> Active
12         when 2 then 'id IN (3,4,5,6,7,8)'  # Active -> Suspended, Analysed, Bypassed, Fixed, Closed, Cancelled
13         when 3 then 'id IN (2,4,5,6,7,8)'  # Suspended -> Active, Analysed, Bypassed, Fixed, Closed, Cancelled
14         when 4 then 'id IN (2,3)'          # Analysed -> Active,Suspended
15         when 5 then 'id IN (2,3,6,7,8)'    # Bypassed -> Active, Suspended, Fixed, Closed, Cancelled
16         when 6 then 'id IN (7,2)'          # Fixed -> Closed, Active
17         when 7 then 'id IN (2)'            # Closed -> Active
18         when 8 then 'id IN (2)'            # Cancelled -> Active
19         end
20       end
21     Statut.find_select(:conditions => search, :order => 'statuts.id')
22   end
The data model could be extended with 2 or 3 more tables. Something like :
 1   create_table "workflows" do |t|
 2     t.string   "name" 
 3     t.text     "description",                 :null => false
 4     t.integer  "typeissue_id",                :null => false
 5     t.string   "opened_status_ids",           :null => false
 6     t.string   "closed_status_ids",           :null => false
 7     t.datetime "created_on",                  :null => false
 8     t.datetime "updated_on",                  :null => false
 9   end
10 
11   create_table "workchains" do |t|
12     t.integer  "workflow_id",                 :null => false
13     t.integer  "status_id",                   :null => false
14     t.string   "allowed_status_ids",           :null => false
15   end

It's a simple mapping of the actual code to the DB. Each workflow would apply on a specific type of issue. It would as many Workchains as there is allowed status. Those status should be divided into 2 groups : active status, where an activity is still needed and closed status, where the issue is kept for archiving.

When looking at the resulting data model, (model1.pdf), it feels somehow incomplete.

A workflow seems to be an extended version of the current "Typeissue" Activerecord. So I thought about a second one, model2.pdf, where Typeissue is merged with Workflow.

Feel free to comment this idea, it's not implemented yet.

model2.pdf - 2nd model (3.8 KB) Michel Loiseleur, 10/03/2008 04:49 PM

model1.pdf - 1st model (3.9 KB) Michel Loiseleur, 10/03/2008 04:49 PM

History

10/03/2008 05:57 PM - Michel Loiseleur

Jon said that using a workflow framework could be smarter.

After a little research, I found http://openwferu.rubyforge.org/

11/10/2008 02:55 PM - Michel Loiseleur

It can work with an "override system", linked with the Software Tag feature.

11/10/2008 04:38 PM - Michel Loiseleur

  • Target version changed from 0.7.5 to 0.8

12/26/2008 05:24 PM - Michel Loiseleur

  • Category set to Internal
  • % Done changed from 0 to 70

12/26/2008 05:25 PM - Michel Loiseleur

  • Status changed from New to Assigned

01/05/2009 11:30 AM - Rémy-Christophe Schermesser

You have to make a check server-side beofre the save of a comment. We must check that the new status of the issue is allowed.

01/05/2009 11:30 AM - Rémy-Christophe Schermesser

We also have to find a way to translate it.

01/08/2009 03:46 PM - Michel Loiseleur

  • Status changed from Assigned to Closed
  • % Done changed from 70 to 100

Also available in: Atom PDF