Just go with this:
and a rule that:
- retrieves all the ‘CanStartWhen’-objects for a Task,
- per CanStartWhen-object retrieves the ‘ThisTask’ from ‘Task’
- if all ThisTasks have reached the percentage, return true, else false
Doing the *-* relation it would look like this:
but in my opinion the first is easier to understand.
You could create an extra progress entity where you store the progress of each task, and once a certain task is at a certain percentage, you set a boolean and use that to start the new task for instance.
Otherwise you should store the progress of each task in the task itself and check whether the progress is far enough to start the next task
I think you might need a second entity indeed, something like:
- Task entity: Has a number of attributes like status and current completion percentage. Also has a self reference
- Task requirement entity: Has two associations to task – one to the task this is a requirement for (so Task C in your example) and one to the tasks that are a requirement for this task. Also has an attribute “Percentage”. Make a page on which you can configure the task requirements. For every requirement the user creates, create a new task requirement entity and set the correct associations.
Now, when you need to check if task C is completed, retrieve all Task Requirements, and for each task requirement retrieve the corresponding tasks. Compare the Task Requirement percentage and the Task completion percentage, and if all requirements are met, then complete Task C.