Readd campaign's get_drop

This commit is contained in:
DevilXD
2022-02-10 20:10:17 +01:00
parent d90d20a42c
commit 3ccbd4c3db
2 changed files with 5 additions and 4 deletions

View File

@@ -251,3 +251,6 @@ class DropsCampaign:
def _on_minutes_changed(self) -> None:
invalidate_cache(self, "progress", "remaining_minutes")
def get_drop(self, drop_id: str) -> Optional[TimedDrop]:
return self.timed_drops.get(drop_id)

View File

@@ -828,13 +828,11 @@ class Twitch:
# try it with the currently selected game first
if self.game is not None:
for campaign in self.inventory[self.game]:
drop = campaign.timed_drops.get(drop_id)
if drop is not None:
if (drop := campaign.get_drop(drop_id)) is not None:
return drop
# fallback to checking all campaigns
for campaign in chain(*self.inventory.values()):
drop = campaign.timed_drops.get(drop_id)
if drop is not None:
if (drop := campaign.get_drop(drop_id)) is not None:
return drop
return None