Sobes.tech
Junior — Senior

Deferred status change of Feedback after its creation

livecode

Task condition

An instance of the Feedback model is created during the process, after which a Celery task change_status_feedback is initiated, which should toggle the status field to 'in_progress'. A code review is required: ensure that the task is called correctly, arguments are passed appropriately, interaction with the ORM is implemented without errors, and also assess potential exceptions during execution.

from asset_main.celery import app

@app.task(name='change_status_feedback')
def change_status_feedback(feedback):
    feedback.status = 'in_progress'
    feedback.save()

feedback = Feedback.objects.create(**validate_data)
change_status_feedback.delay(feedback)