Skip to content

Commit

Permalink
fix wrong calculation for attempts, update date_modified in AbstractT…
Browse files Browse the repository at this point in the history
…imeStampedModel
  • Loading branch information
noliveleger committed Dec 18, 2024
1 parent d5181d7 commit 2a50088
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kobo/apps/long_running_migrations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def execute(self):
return

self.status = LongRunningMigrationStatus.IN_PROGRESS
self.attempts += self.attempts
self.attempts += 1
self.save(update_fields=['status', 'attempts'])

try:
Expand Down
2 changes: 2 additions & 0 deletions kpi/models/abstract_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ def save(self, *args, **kwargs):
update_fields = kwargs.get('update_fields', None)
if update_fields is None or 'date_modified' not in update_fields:
self.date_modified = timezone.now()
if update_fields:
update_fields.append('date_modified')
super().save(*args, **kwargs)

0 comments on commit 2a50088

Please sign in to comment.