mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
Event cancellation: Fix DivisionByZero when cancelling empty events
This commit is contained in:
@@ -227,7 +227,7 @@ def cancel_event(self, event: Event, subevent: int, auto_refund: bool,
|
|||||||
if not self.request.called_directly and counter % max(10, total // 100) == 0:
|
if not self.request.called_directly and counter % max(10, total // 100) == 0:
|
||||||
self.update_state(
|
self.update_state(
|
||||||
state='PROGRESS',
|
state='PROGRESS',
|
||||||
meta={'value': round(counter / total * 100, 2)}
|
meta={'value': round(counter / total * 100 if total else 0, 2)}
|
||||||
)
|
)
|
||||||
except LockTimeoutException:
|
except LockTimeoutException:
|
||||||
logger.exception("Could not cancel order")
|
logger.exception("Could not cancel order")
|
||||||
@@ -285,7 +285,7 @@ def cancel_event(self, event: Event, subevent: int, auto_refund: bool,
|
|||||||
if not self.request.called_directly and counter % max(10, total // 100) == 0:
|
if not self.request.called_directly and counter % max(10, total // 100) == 0:
|
||||||
self.update_state(
|
self.update_state(
|
||||||
state='PROGRESS',
|
state='PROGRESS',
|
||||||
meta={'value': round(counter / total * 100, 2)}
|
meta={'value': round(counter / total * 100 if total else 0, 2)}
|
||||||
)
|
)
|
||||||
|
|
||||||
if send_waitinglist:
|
if send_waitinglist:
|
||||||
@@ -296,6 +296,6 @@ def cancel_event(self, event: Event, subevent: int, auto_refund: bool,
|
|||||||
if not self.request.called_directly and counter % max(10, total // 100) == 0:
|
if not self.request.called_directly and counter % max(10, total // 100) == 0:
|
||||||
self.update_state(
|
self.update_state(
|
||||||
state='PROGRESS',
|
state='PROGRESS',
|
||||||
meta={'value': round(counter / total * 100, 2)}
|
meta={'value': round(counter / total * 100 if total else 0, 2)}
|
||||||
)
|
)
|
||||||
return failed
|
return failed
|
||||||
|
|||||||
Reference in New Issue
Block a user