Skip to content

Commit

Permalink
ensure task.expiration is always set(cannot be null)
Browse files Browse the repository at this point in the history
  • Loading branch information
dchhabda committed Apr 17, 2023
1 parent e9af590 commit 8faf13a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pybossa/repositories/task_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from flask import current_app
from sqlalchemy import or_
from sqlalchemy.sql import case as sqlalchemy_case
from pybossa.task_creator_helper import get_task_expiration


class TaskRepository(Repository):
Expand Down Expand Up @@ -179,6 +180,9 @@ def _filter_query(self, query, obj, limit, offset, last_id, yielded, desc):
def save(self, element, clean_project=True):
self._validate_can_be(self.SAVE_ACTION, element)
try:
# set task default expiration
if element.__class__.__name__ == "Task":
element.expiration = get_task_expiration(element.expiration, make_timestamp())
self.db.session.add(element)
self.db.session.commit()
if clean_project:
Expand Down

0 comments on commit 8faf13a

Please sign in to comment.