mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-09 19:40:19 +00:00
Free subscription for jewels
This commit is contained in:
@ -104,6 +104,7 @@ class Subscription(models.Model):
|
||||
'sbarro/esta': 9,
|
||||
'cursus-alternant': 10,
|
||||
'welcome-semestre': 11,
|
||||
'un-mois': 12,
|
||||
}
|
||||
PAYMENT = {
|
||||
"CHECK": 1,
|
||||
@ -168,11 +169,11 @@ class Subscription(models.Model):
|
||||
start = Subscription.compute_start(duration=duration)
|
||||
# This can certainly be simplified, but it works like this
|
||||
try:
|
||||
return start.replace(month=(start.month - 1 + 6 * duration) % 12 + 1,
|
||||
year=start.year + int(duration / 2) + (1 if start.month > 6 and duration % 2 == 1 else 0))
|
||||
return start.replace(month=int((start.month - 1 + 6 * duration) % 12 + 1),
|
||||
year=int(start.year + int(duration / 2) + (1 if start.month > 6 and duration % 2 == 1 else 0)))
|
||||
except ValueError as e:
|
||||
return start.replace(day=1, month=(start.month + 6 * duration) % 12 + 1,
|
||||
year=start.year + int(duration / 2) + (1 if start.month > 6 and duration % 2 == 1 else 0))
|
||||
return start.replace(day=1, month=int((start.month + 6 * duration) % 12 + 1),
|
||||
year=int(start.year + int(duration / 2) + (1 if start.month > 6 and duration % 2 == 1 else 0)))
|
||||
|
||||
def can_be_edited_by(self, user):
|
||||
return user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) or user.is_root
|
||||
|
Reference in New Issue
Block a user