-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing exit
command on forecast menu
#3421
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works for me both from /forecast and /stocks/forecast
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works for me too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So actually thinking about this more -- this is the only place this is needed. And it arises because we call PATH = "/forecast/"
in this controller.
Instead of rewriting the base class, which changes every class (hence why you are failing 100 tests), I think we can overwrite the exit function for forecasting menu only.
92ad59c
to
3d24330
Compare
Description
Fixes #3415.
The forecast menu exhibits a bug where if the user uses the
exit
command, they are directed back to the base menu. This occurs only when loading in data from another menu like stocks with the following commandsstocks/load aapl/forecast
. However, this error does not occur if they user navigates to the forecast menu first to load in their own dataset. Additionally, this error does not occur if the user inputs a ticker from another menu, navigates to the base menu, and then navigates to the forecast menu.Source of the bug
This error occurs due to the number of times
quit
is called relative to the menu path. Theexit
command is used to leave the entire application and the backend of the exit command is simply X number of quits where X represents how "deep" in the terminal the user is, i.e what menu or sub-menu. For example, if the user is at thecrypto/dd
menu, then they are 3 deep: base->crypto->dd.When applying this to forecasting where the user loads the ticker
aapl
and then calls forecasting, it is synonymous to being 3 menus deep because the user is going from base->stocks->forecasting. This seems to be true because if the user uses thequit
command, they will be directed back to thestocks
menu, and then if they use it twice more, they will be directed back to the base menu and then out of the terminal.However, the
exit
command directs the user back only to the base menu. This means that there is one missingquit
call. This occurs because forecasting is a primary menu option off of the base menu and its path isforecast/
, (base->forecast). Theexit
function utilizes this path and thus only callsquit
twice.Solution
The solution is to simply increase the total number of quits used when exiting. This will cover the forecast edge case when there are not enough quits. However, this means that all other
exit
calls will have one additional, unneededquit
. This does not seem to cause any errors or lead to adverse functionality.Others