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 15, 2023
1 parent e9af590 commit 0f74350
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 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,8 @@ 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 default expiration
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 0f74350

Please sign in to comment.