Re: [Planner Dev] cost of tasks with subtasks



Hi,

> 1. The cached value has to be invalidated when assignments get
>    added or removed, and when task duration (or work?) is changed.
>    I've solved this with a function in mrp-task that marks the
>    cached value as stale, so that on the next request, cost is
>    recalculated.  Staleness also propagates to parent tasks.  This
>    function is called from
> 
>    - task_assignment_removed_cb,
>    - task_remove_assignments,

Only the first should be needed here, right?

>    - imrp_task_add_assignment,

This should be possible to do through a callback instead, like above.

>    - imrp_task_set_duration.

This should be done through a "notify::duration" callback. There are
examples of that throughout the code.

> 2. Invalidation also must happen when the cost of a resource is
>    changed.  For this, I added a function that invalidates the
>    cached cost for all tasks that a resource is assigned to.  This
>    is called from resource_dialog_cost_changed_cb in
>    planner-resource-dialog.c.
> 
>    Question: how do I handle the cost-change event if it happens
>    in the resource view, not the dialog?  The problem is that in
>    the view, cost is a custom property, while for the dialog,
>    there is a callback explicitly for cost change.

We really should turn the cost into a regular property, it's a bit weird
to keep such an integral part as a custom property. This should be
pretty easy since it's actually a regular property in the xml files. The
database backend could be trickier, but at this stage I'm don't all
opposed to just break the database, since it has never been really
official (we didn't even ship the database scheme...). If it can be
changed without breakage that's good of course.

In the meantime, we could add a small hack that just listens to changes
to that particular custom property.

/Richard

-- 
Imendio HB, http://www.imendio.com/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]