Update last report date only in non-debug mode

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
Yohann D'ANELLO 2021-04-08 17:38:25 +02:00
parent 7676f69216
commit 13322189dc
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 3 additions and 2 deletions

View File

@ -33,8 +33,9 @@ class Command(BaseCommand):
delta = now.date() - last_report.date() delta = now.date() - last_report.date()
if delta.days < note.user.profile.report_frequency: if delta.days < note.user.profile.report_frequency:
continue continue
note.user.profile.last_report = now if not options["debug"]:
note.user.profile.save() note.user.profile.last_report = now
note.user.profile.save()
last_transactions = Transaction.objects.filter( last_transactions = Transaction.objects.filter(
Q(source=note) | Q(destination=note), Q(source=note) | Q(destination=note),
created_at__gte=last_report, created_at__gte=last_report,