def on_updated(self, updates, original): updated = copy(original) updated.update(updates) if self._stage_changed(updates, original): insert_into_versions(doc=updated) new_task = updates.get('task', {}) old_task = original.get('task', {}) if new_task.get('stage') != old_task.get('stage'): push_notification('task:stage', new_stage=str(new_task.get('stage', '')), old_stage=str(old_task.get('stage', '')), new_desk=str(new_task.get('desk', '')), old_desk=str(old_task.get('desk', ''))) else: push_notification(self.datasource, updated=1) if is_assigned_to_a_desk(updated): if self.__is_content_assigned_to_new_desk(original, updates) and \ not self._stage_changed(updates, original): insert_into_versions(doc=updated) add_activity(ACTIVITY_UPDATE, 'updated task {{ subject }} for item {{ type }}', self.datasource, item=updated, subject=get_subject(updated), type=updated['type'])
def on_created(self, docs): push_notification(self.datasource, created=1) for doc in docs: insert_into_versions(doc['_id']) if self.__is_assigned_to_a_desk(doc): add_activity(ACTIVITY_CREATE, 'added new task {{ subject }} of type {{ type }}', item=doc, subject=get_subject(doc), type=doc['type'])
def on_updated(self, updates, original): push_notification(self.datasource, updated=1) updated = copy(original) updated.update(updates) if updated.get('task') and updated['task'].get('desk'): add_activity(ACTIVITY_UPDATE, 'updated task {{ subject }} for item {{ type }}', item=updated, subject=get_subject(updated))
def on_updated(self, updates, original): updated = copy(original) updated.update(updates) if self._stage_changed(updates, original): insert_into_versions(doc=updated) new_task = updates.get("task", {}) old_task = original.get("task", {}) if new_task.get("stage") != old_task.get("stage"): push_notification( "task:stage", new_stage=str(new_task.get("stage", "")), old_stage=str(old_task.get("stage", "")), new_desk=str(new_task.get("desk", "")), old_desk=str(old_task.get("desk", "")), ) else: push_notification(self.datasource, updated=1) if is_assigned_to_a_desk(updated): if self.__is_content_assigned_to_new_desk(original, updates) and not self._stage_changed(updates, original): insert_into_versions(doc=updated) add_activity( ACTIVITY_UPDATE, "updated task {{ subject }} for item {{ type }}", self.datasource, item=updated, subject=get_subject(updated), type=updated["type"], )
def on_created(self, docs): push_notification(self.datasource, created=1) push_notification('task:new') for doc in docs: insert_into_versions(doc['_id']) if is_assigned_to_a_desk(doc): add_activity(ACTIVITY_CREATE, 'added new task {{ subject }} of type {{ type }}', self.datasource, item=doc, subject=get_subject(doc), type=doc[ITEM_TYPE])
def on_created(self, docs): push_notification(self.datasource, created=1) for doc in docs: if doc.get('task') and doc['task'].get('desk'): add_activity(ACTIVITY_CREATE, 'added new task {{ subject }} of type {{ type }}', item=doc, subject=get_subject(doc), type=doc['type'])
def on_created(self, docs): push_notification(self.datasource, created=1) push_notification("task:new") for doc in docs: insert_into_versions(doc["_id"]) if is_assigned_to_a_desk(doc): add_activity( ACTIVITY_CREATE, "added new task {{ subject }} of type {{ type }}", self.datasource, item=doc, subject=get_subject(doc), type=doc[ITEM_TYPE], )
def on_updated(self, updates, original): new_stage = updates.get('task', {}).get('stage', '') old_stage = original.get('task', {}).get('stage', '') if new_stage != old_stage: push_notification('task:stage', new_stage=str(new_stage), old_stage=str(old_stage)) else: push_notification(self.datasource, updated=1) updated = copy(original) updated.update(updates) if self.__is_assigned_to_a_desk(updated): if self.__is_content_assigned_to_new_desk(original, updates): insert_into_versions(original['_id']) add_activity(ACTIVITY_UPDATE, 'updated task {{ subject }} for item {{ type }}', item=updated, subject=get_subject(updated), type=updated['type'])
def on_updated(self, updates, original): new_stage = updates.get('task', {}).get('stage', '') old_stage = original.get('task', {}).get('stage', '') if new_stage != old_stage: push_notification('task:stage', new_stage=str(new_stage), old_stage=str(old_stage)) else: push_notification(self.datasource, updated=1) updated = copy(original) updated.update(updates) if is_assigned_to_a_desk(updated): if self.__is_content_assigned_to_new_desk(original, updates): insert_into_versions(original['_id']) add_activity(ACTIVITY_UPDATE, 'updated task {{ subject }} for item {{ type }}', item=updated, subject=get_subject(updated), type=updated['type'])