Skip to content

Commit

Permalink
{Interactive} Fix Scenario Idx out of bound when selecting recommende…
Browse files Browse the repository at this point in the history
…d scenario (#6535)

* Fix Scenario Idx out of bound when selecting recommended scenario

* Add message in `HISTORY.rst`
  • Loading branch information
ReaNAiveD authored Aug 1, 2023
1 parent 16b8e3b commit 8e16b69
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/interactive/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Release History

upcoming
+++++
* Fix Scenario Idx out of bound when selecting recommended scenario
* Add command skipped message in Scenario Execution Mode

0.5.1
Expand Down
4 changes: 2 additions & 2 deletions src/interactive/azext_interactive/azclishell/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,11 +536,11 @@ def handle_scenario(self, text):
# e.g. :: 1 => `selected_option='1'`
selected_option = text.partition(SELECT_SYMBOL['example'])[2].strip()
try:
selected_option = int(selected_option)
selected_option = int(selected_option) - 1
except ValueError:
print("An Integer should follow the colon", file=self.output)
return
if 0 <= selected_option <= len(self.recommender.get_scenarios() or []):
if 0 <= selected_option < len(self.recommender.get_scenarios() or []):
scenario = self.recommender.get_scenarios()[selected_option]
self.recommender.feedback_scenario(selected_option, scenario)
else:
Expand Down

0 comments on commit 8e16b69

Please sign in to comment.