* Better logs in check_cdek_status() task
This commit is contained in:
parent
683da45e7d
commit
8e49176351
|
|
@ -18,6 +18,7 @@ def check_cdek_status(order_id):
|
||||||
if not statuses:
|
if not statuses:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
old_status = obj.status
|
||||||
new_status = obj.status
|
new_status = obj.status
|
||||||
if CDEKStatus.DELIVERED in statuses:
|
if CDEKStatus.DELIVERED in statuses:
|
||||||
new_status = Checklist.Status.COMPLETED
|
new_status = Checklist.Status.COMPLETED
|
||||||
|
|
@ -25,11 +26,12 @@ def check_cdek_status(order_id):
|
||||||
new_status = Checklist.Status.CDEK
|
new_status = Checklist.Status.CDEK
|
||||||
|
|
||||||
# Update status
|
# Update status
|
||||||
if obj.status != new_status:
|
if old_status != new_status:
|
||||||
print(f'Order [{obj.id}] status: {obj.status} -> {new_status}')
|
print(f'Order [{obj.id}] status: {old_status} -> {new_status}')
|
||||||
obj.status = new_status
|
obj.status = new_status
|
||||||
obj.save()
|
obj.save()
|
||||||
return new_status
|
|
||||||
|
return f"{old_status} —> {new_status}"
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user