Add a 'finished' inv view filter

This commit is contained in:
DevilXD committed 2022-07-31 22:36:34 +02:00
1 parent f919850ad2
commit 3dbe1f02be
2 files changed
+38 -17

No files matched your search

+6 -2
View File
@@ -252,6 +252,10 @@ class DropsCampaign:
def total_drops(self) -> int:
return len(self.timed_drops)
@cached_property
def finished(self) -> bool:
return all(d.is_claimed for d in self.drops)
@cached_property
def claimed_drops(self) -> int:
return sum(d.is_claimed for d in self.drops)
@@ -262,14 +266,14 @@ class DropsCampaign:
@cached_property
def remaining_minutes(self) -> int:
return sum(d.remaining_minutes for d in self.timed_drops.values())
return sum(d.remaining_minutes for d in self.drops)
@cached_property
def progress(self) -> float:
return sum(d.progress for d in self.drops) / self.total_drops
def _on_claim(self) -> None:
invalidate_cache(self, "claimed_drops", "remaining_drops")
invalidate_cache(self, "finished", "claimed_drops", "remaining_drops")
for drop in self.drops:
drop._on_claim()