Ry3nG / MOBLIMA

Console-based Movie Booking and LIsting Management Application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Input checking behavior for menus inconsistent

yay1243 opened this issue · comments

Menus have inconsistent behavior when menuChoice == (menu_size + 1) and menuChoice == 0
(Tested with staff menus)

The returns can be categorized as such:

For menuChoice == (menu_size + 1):

Works as expected:

  • Main menu
  • View and update movie details -> movie selection menu
  • View and update showtimes -> movie selection menu
  • View and update showtimes -> select showtime slot menu
  • View and update cinemas -> set showtimes
  • View and update system settings -> setting selection menu

Allows selection to go through:

  • View and update movie details -> edit movie details menu (Returns to previous menu)
  • View and update movie details -> change blockbuster status (Sets to non-blockbuster)
  • View and update showtimes -> edit showtime details menu (Returns to previous menu)
  • View and update showtimes -> set Cinema ID (Sets the cinema ID of showtime to Cinema ID (menu_size + 1), even when no cinema of that ID exists)
  • View and update cinemas -> edit cinema details menu (Returns to previous menu)

Produces index_out_of_bound exception, exits to main menu:

  • View and update movie details -> change showing status
  • View and update movie details -> change content rating
  • View and update showtimes -> set Movie ID
  • View and update cinemas -> cinema selection menu
  • View and update cinemas -> set class
  • View and update cinemas -> add new cinema (Does not exit to main menu, stays in add new cinema menu)

For menuChoice == 0:

Works as expected:

  • Main menu
  • View and update system settings -> setting selection menu

Produces wrong error:

  • Every other menu

Standardised all menu selection idx as choice - 1 across all menu components