mirror of
https://github.com/pretix/pretix.git
synced 2026-09-30 19:04:43 +00:00
Fix inefficient loop in compute_validity (Z#23245937 / PRT-013)
This commit is contained in:
committed by
Raphael Michel
parent
912851aa87
commit
b7117bb3a3
@@ -1070,10 +1070,8 @@ class Item(LoggedModel):
|
||||
|
||||
replace_year = valid_until.year
|
||||
replace_month = valid_until.month + self.validity_dynamic_duration_months
|
||||
|
||||
while replace_month > 12:
|
||||
replace_month -= 12
|
||||
replace_year += 1
|
||||
replace_year += (replace_month - 1) // 12
|
||||
replace_month = ((replace_month - 1) % 12) + 1
|
||||
max_day = calendar.monthrange(replace_year, replace_month)[1]
|
||||
replace_date = date(
|
||||
year=replace_year,
|
||||
|
||||
Reference in New Issue
Block a user