From 441c8b9659df820d4c1c5f310898571b0bbde520 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 25 Jul 2020 17:42:32 +0200 Subject: [PATCH] Fix linters --- management/commands/refresh_highlighted_buttons.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/management/commands/refresh_highlighted_buttons.py b/management/commands/refresh_highlighted_buttons.py index 10e13cd..6eb2bc0 100644 --- a/management/commands/refresh_highlighted_buttons.py +++ b/management/commands/refresh_highlighted_buttons.py @@ -18,10 +18,15 @@ class Command(BaseCommand): return parser def handle(self, *args, **kwargs): - queryset = RecurrentTransaction.objects.filter(template__display=True, created_at__gte=timezone.now() - timedelta(days=30)).values("template").annotate(transaction_count=Count("template")).order_by("-transaction_count")[:10] + queryset = RecurrentTransaction.objects.filter( + template__display=True, + valid=True, + created_at__gte=timezone.now() - timedelta(days=30), + ).values("template").annotate(transaction_count=Count("template")).order_by("-transaction_count")[:10] for d in queryset.all(): button_id = d["template"] button = TransactionTemplate.objects.get(pk=button_id) - self.stdout.write(self.style.WARNING("Highlight button {name} ({count:d} transactions)...".format(name=button.name, count=d["transaction_count"]))) + self.stdout.write(self.style.WARNING("Highlight button {name} ({count:d} transactions)..." + .format(name=button.name, count=d["transaction_count"]))) button.highlighted = True button.save()