def removeItemsFromSelf(self, tasks): ''' removeItemsFromSelf is called when an item is removed from the observed list. The default behavior of removeItemsFromSelf is to remove the item from the observing list (i.e. this list) unchanged. We override the default behavior to remove the tasks' efforts from the CompositeEfforts they are part of. ''' for task in tasks: self.removeComposites(task, task.efforts())
def extendSelf(self, tasks): ''' extendSelf is called when an item is added to the observed list. The default behavior of extendSelf is to add the item to the observing list (i.e. this list) unchanged. We override the default behavior to first get the efforts from the task and then group the efforts by time period. ''' newComposites = [] for task in tasks: newComposites.extend(self.createComposites(task, task.efforts())) super(EffortAggregator, self).extendSelf(newComposites)