Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDISCROWD-5852 Calc task expiration by create date #836

Merged
merged 12 commits into from
Apr 18, 2023
5 changes: 4 additions & 1 deletion pybossa/importers/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from flask import url_for
from pybossa.task_creator_helper import set_gold_answers, upload_files_priv, get_task_expiration
from pybossa.data_access import data_access_levels
from pybossa.model import make_timestamp


def validate_s3_bucket(task, *args):
Expand Down Expand Up @@ -207,7 +208,9 @@ def create_tasks(self, task_repo, project, importer=None, **form_data):
try:
for task_data in tasks:
self.upload_private_data(task_data, project.id)
task_data['expiration'] = get_task_expiration(task_data.get('expiration'))
# As tasks are getting created, pass current date as create_date
create_date = make_timestamp()
task_data['expiration'] = get_task_expiration(task_data.get('expiration'), create_date)

task = Task(project_id=project.id, n_answers=n_answers)
[setattr(task, k, v) for k, v in task_data.items()]
Expand Down
1 change: 0 additions & 1 deletion pybossa/task_creator_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def set_gold_answers(task, gold_answers):
if encrypted():
url = upload_files_priv(task, task.project_id, gold_answers, TASK_PRIVATE_GOLD_ANSWER_FILE_NAME)['externalUrl']
gold_answers = dict([(TASK_GOLD_ANSWER_URL_KEY, url)])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think setting gold task should not be setting task expiration as both operations are independent and hence task expiration not to be modified with setting gold task.

@kbecker42 , @XiChenn , @n00rsy thoughts?

task.expiration = get_task_expiration(task.expiration)

task.gold_answers = gold_answers
task.calibration = 1
Expand Down