diff options
Autocommit at 08.05.2022 @ 08:32
2 files changed, 7 insertions, 1 deletions
| -rw-r--r-- | src/Services/EventService.cpp | 2 | ||||
| -rw-r--r-- | src/UserInterface/VenueConsoleUI.cpp | 6 |
diff --git a/src/Services/EventService.cpp b/src/Services/EventService.cpp index 5b79faa..f220089 100644 --- a/src/Services/EventService.cpp +++ b/src/Services/EventService.cpp @@ -171,7 +171,7 @@ List<Event> EventService::queryMostWatched(unsigned topN) { List<Event> result; for (unsigned i = 0; i < events.get_count(); i++) { unsigned ind = indexToInsertWhenTicketSort(result, topN, events[i].get_tickets().get_count()); - if (ind < topN) + if (ind < topN || events.get_count() < topN) result.insertAt(events[i], ind); if (result.get_count() == topN) result.removeAt(topN); diff --git a/src/UserInterface/VenueConsoleUI.cpp b/src/UserInterface/VenueConsoleUI.cpp index 71f302e..db9b58b 100644 --- a/src/UserInterface/VenueConsoleUI.cpp +++ b/src/UserInterface/VenueConsoleUI.cpp @@ -146,6 +146,12 @@ void command_cancelEvent() { void command_mostWatched() { List<Event> top = es->queryMostWatched(10); + + resetOrderedList(1); + for (unsigned i = 0; i < top.get_count(); i++) + printOrderedListElem(top[i].get_name()); + + pressEnterToContinue(); } void command_belowWatchers() { |
