Skip to content

Commit

Permalink
reset exported flag upon taskrun edit (#821)
Browse files Browse the repository at this point in the history
  • Loading branch information
dchhabda committed Mar 2, 2023
1 parent ad4003a commit b6b3202
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pybossa/model/event_listeners.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from flask import current_app

from rq import Queue
from sqlalchemy import event
from sqlalchemy import event, text

from flask import url_for

Expand Down Expand Up @@ -294,6 +294,13 @@ def on_taskrun_submit(mapper, conn, target):
push_webhook(project_private, target.task_id, result_id)


@event.listens_for(TaskRun, 'after_update')
def on_taskrun_resubmit(mapper, conn, target):
"""Reset task exported flag when taskrun is modified."""
sql_query = text("UPDATE task SET exported = False where id=:task_id")
conn.execute(sql_query, dict(task_id=target.task_id))


@event.listens_for(Blogpost, 'after_insert')
@event.listens_for(Blogpost, 'after_update')
@event.listens_for(Task, 'after_insert')
Expand Down

0 comments on commit b6b3202

Please sign in to comment.