Make updating converted prices more robust #92
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Right now the code is quite fragile:
save()
method if the converted price or currency is different, if it is, it sets both to default.convert_prices
method, and this uses the same way as in thesave()
method, which means code duplication.calculate_price_per_game
also depends on this and is itself very hacky way of determining if an update is needed. It does this by directly querying Django-Q's tableTasks
and comparing its last run timestamp with theupdated_at
field of Purchase model.Solutions
needs_price_update
field to Purchase which would be reset in the model's save method. Being boolean it's unlikely to ever change, and the brittle check inconvert_prices
would just check the value of this field.calculate_price_per_game
because if a price has changed we also need to recalculate this.