Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikhorluck committed Sep 2, 2024
1 parent 9087905 commit 7b98191
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
15 changes: 8 additions & 7 deletions apps/marks/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ def __str__(self):
def save(self, *args, **kwargs):
now = timezone.now()

if should_be_suspended(self.user, user_weight(self.user) + self.mark.weight, now.date()):
if should_be_suspended(
self.user, user_weight(self.user) + self.mark.weight, now.date()
):
s = Suspension(
title=_("For mange prikker på rad"),
description=_(
Expand Down Expand Up @@ -365,14 +367,13 @@ class Suspended:


def should_be_suspended(u: User, weight: int, today: date):
has_suspension = (Suspension.active_suspensions(u, today)
has_suspension = (
Suspension.active_suspensions(u, today)
.filter(cause=Suspension.Cause.MARKS)
.exists())
has_too_much_mark_weight = weight >= 6
should_be_suspended = (
has_too_much_mark_weight
and not has_suspension
.exists()
)
has_too_much_mark_weight = weight >= 6
should_be_suspended = has_too_much_mark_weight and not has_suspension
logger.info("Checking sanctions for %s. %s", u.pk, f"{weight=}; {has_suspension=}")
return should_be_suspended

Expand Down
2 changes: 1 addition & 1 deletion apps/marks/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_suspensions_and_marks_over_time(db):

assert type(user_sanctions(user, now.date())) is MarkDelay
sanction_users(m[1], [user], now)

assert type(user_sanctions(user, now.date())) is Suspended
sanction_users(m[2], [user], now)

Expand Down
1 change: 1 addition & 0 deletions apps/payment/mommy.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

logger = logging.getLogger(__name__)


def payment_reminder():
event_payments = Payment.objects.filter(
payment_type=PaymentTypes.DEADLINE,
Expand Down

0 comments on commit 7b98191

Please sign in to comment.