Skip to content

Commit

Permalink
Upgrade num validation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeee committed Feb 14, 2024
1 parent 6faeeb2 commit 80047fc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions buildstock_query/tools/upgrades_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,8 @@ def get_report(self, upgrade_num: Optional[int] = None) -> pd.DataFrame:
"""

self._logic_cache = {}
max_upg = len(self.upgrade_names) + 1
if upgrade_num is not None:
if upgrade_num <= 0 or upgrade_num > max_upg:
raise ValueError(f"Invalid upgrade {upgrade_num}. Valid upgrade_num = {list(range(1, max_upg))}.")
if upgrade_num not in self.upgrade_names:
raise ValueError(f"Invalid upgrade {upgrade_num}. Valid upgrade_num = {self.upgrade_names.keys()}.")

record_dfs = []
for indx, upgrade_names in self.upgrade_names.items():
Expand Down

0 comments on commit 80047fc

Please sign in to comment.