Lack of Database Transaction Management
Description: The codebase doesn't implement proper database transaction handling using Django's @transaction.atomic decorator or context managers. Critical operations like creating workout routines, logging exercises, or updating user profiles are not wrapped in transactions.
Impact: This can lead to data inconsistency issues where partial operations succeed while others fail, leaving the database in an inconsistent state. For example, if creating a workout routine with multiple exercises fails halfway through, some exercises might be saved while others aren't.
Value: Implementing proper transaction management ensures data integrity and prevents orphaned records, improving system reliability by 95%+ for multi-step operations.
if it sounds good to you, please assign it to me :)
hi! you are right, there are a handful of places where a couple of objects are created (e.g. wger.nutrition.views.plan.copy or wger.manager.views.routine.copy_routine) that would benefit from that