Fix ZeroDivisionError in TimedDrop.availability
This commit is contained in:
1 parent
d333c86598
commit
93d5d8750d
1 file changed
+3
-4
+3
-4
@@ -234,11 +234,10 @@ class TimedDrop(BaseDrop):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def availability(self) -> float:
|
def availability(self) -> float:
|
||||||
if not self._base_can_earn():
|
|
||||||
# this verifies "self.total_remaining_minutes > 0" and "now < self.ends_at"
|
|
||||||
return math.inf
|
|
||||||
now = datetime.now(timezone.utc)
|
now = datetime.now(timezone.utc)
|
||||||
return ((self.ends_at - now).total_seconds() / 60) / self.total_remaining_minutes
|
if self.required_minutes > 0 and self.total_remaining_minutes > 0 and now < self.ends_at:
|
||||||
|
return ((self.ends_at - now).total_seconds() / 60) / self.total_remaining_minutes
|
||||||
|
return math.inf
|
||||||
|
|
||||||
def _base_earn_conditions(self) -> bool:
|
def _base_earn_conditions(self) -> bool:
|
||||||
return super()._base_earn_conditions() and self.required_minutes > 0
|
return super()._base_earn_conditions() and self.required_minutes > 0
|
||||||
|
|||||||
Reference in new issue
Block a user