From 8805fc3eb2695c722de1f80cbbc5ed2906a51a30 Mon Sep 17 00:00:00 2001 From: Jorrit Schaap <schaap@astron.nl> Date: Fri, 4 Mar 2016 15:42:19 +0000 Subject: [PATCH] Task #8887: when the specification starttime and endtime are updated, then that effects the task as well --- .../ResourceAssignmentDatabase/radbpglistener.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener.py b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener.py index 06e6ec97a70..61fb21021d0 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener.py +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener.py @@ -53,6 +53,11 @@ class RADBPGListener(PostgresListener): self.subscribe('task_insert', self.onTaskInserted) self.subscribe('task_delete', self.onTaskDeleted) + # when the specification starttime and endtime are updated, then that effects the task as well + # so subscribe to specification_update, and use task_view as view_for_row + self.setupPostgresNotifications('resource_allocation', 'specification', updateNotification=True, insertNotification=False, deleteNotification=False, view_for_row='task_view') + self.subscribe('specification_update', self.onSpecificationUpdated) + self.setupPostgresNotifications('resource_allocation', 'resource_claim', view_for_row='resource_claim_view') self.subscribe('resource_claim_update', self.onResourceClaimUpdated) self.subscribe('resource_claim_insert', self.onResourceClaimInserted) @@ -67,6 +72,11 @@ class RADBPGListener(PostgresListener): def onTaskDeleted(self, payload = None): self._sendNotification('TaskDeleted', payload) + def onSpecificationUpdated(self, payload = None): + # when the specification starttime and endtime are updated, then that effects the task as well + # so send a TaskUpdated notification + self._sendNotification('TaskUpdated', payload, ['starttime', 'endtime']) + def onResourceClaimUpdated(self, payload = None): self._sendNotification('ResourceClaimUpdated', payload, ['starttime', 'endtime']) -- GitLab