From 29dbd46d8b70787c942c16bf0538884a28ed4796 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 8 May 2022 08:32:57 +0300 Subject: Autocommit at 08.05.2022 @ 08:32 --- src/Services/EventService.cpp | 2 +- src/UserInterface/VenueConsoleUI.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') 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 EventService::queryMostWatched(unsigned topN) { List 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 top = es->queryMostWatched(10); + + resetOrderedList(1); + for (unsigned i = 0; i < top.get_count(); i++) + printOrderedListElem(top[i].get_name()); + + pressEnterToContinue(); } void command_belowWatchers() { -- cgit v1.3.1-26-gb76a