def subscribe_to_task(person_id, task_id): """ Add a subscription entry for given person and task. """ subscription = get_task_subscription_raw(person_id, task_id) if subscription is None: subscription = Subscription.create(person_id=person_id, task_id=task_id) return subscription.serialize()
def generate_fixture_subscription(self, task_id=None): task = self.task if task_id is not None: task = Task.get(task_id) self.subscription = Subscription.create(person_id=self.user["id"], task_id=task.id, entity_id=task.entity_id, task_type_id=task.task_type_id) return self.subscription.serialize()
def subscribe_to_sequence(person_id, sequence_id, task_type_id): """ Add a subscription entry for given person, sequence and task type. """ subscription = get_sequence_subscription_raw(person_id, sequence_id, task_type_id) if subscription is None: subscription = Subscription.create(person_id=person_id, entity_id=sequence_id, task_type_id=task_type_id) return subscription.serialize()