Website Summary Files Commits Branches @commit @diff @stats
path: root / src / UserInterface / VenueConsoleUI.cpp
diff options
context:
space:
mode:
Commit86c72400cf810dc9234146a9a47735f7669b2cd6 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-08 09:03:06 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-08 09:03:06 +0300
Filesa44d9f5fcb6aa6da22fd5372a7445fcf1e98b504 /src/UserInterface/VenueConsoleUI.cpp
FMI-OOP-P1_TicketSystem-86c72400cf810dc9234146a9a47735f7669b2cd6.tar
FMI-OOP-P1_TicketSystem-86c72400cf810dc9234146a9a47735f7669b2cd6.tar.gz
FMI-OOP-P1_TicketSystem-86c72400cf810dc9234146a9a47735f7669b2cd6.zip
Parent5ec0447c56af115cb1c1cd8b76a5d95231bb3917 (diff)
Autocommit at 08.05.2022 @ 09:03
1 files changed, 23 insertions, 5 deletions
-rw-r--r--src/UserInterface/VenueConsoleUI.cpp28
diff --git a/src/UserInterface/VenueConsoleUI.cpp b/src/UserInterface/VenueConsoleUI.cpp
index d2c4d24..e4744fa 100644
--- a/src/UserInterface/VenueConsoleUI.cpp
+++ b/src/UserInterface/VenueConsoleUI.cpp
@@ -144,6 +144,14 @@ void command_cancelEvent() {
handleStatusCode(s, eventManagementMenu);
}
+void customPrintEvent(const Event& ev) {
+ print(ev.get_name());
+ print(" || Hall ");
+ print(ev.get_hall().get_number());
+ print(" @ ");
+ printLine(ev.get_date());
+}
+
void command_mostWatched() {
unsigned topN;
inputSubBox("How many to take?: ", &topN);
@@ -158,18 +166,28 @@ void command_mostWatched() {
resetOrderedList(1);
for (unsigned i = 0; i < top.get_count(); i++) {
_printOrderedListBeginning();
- print(top[i].get_name());
- print(" || Hall ");
- print(top[i].get_hall().get_number());
- print(" @ ");
- printLine(top[i].get_date());
+ customPrintEvent(top[i]);
}
pressEnterToContinue();
}
void command_belowWatchers() {
+ printLine("Events with less than 10% bought tickets in hall:");
+ List<Event> least = es->queryInsufficientlyVisited();
+ for (unsigned i = 0; i < least.get_count(); i++) {
+ customPrintEvent(least[i]);
+ }
+
+ bool toDelete;
+ inputBox("Do you want to cancel them? [0/1]: ", &toDelete);
+ if (toDelete) {
+ StatusCode s;
+ for (unsigned i = 0; i < least.get_count(); i++)
+ s = es->cancelEvent(least[i].get_name().get_cstr(), least[i].get_date());
+ handleStatusCode(s, eventManagementMenu);
+ }
}
void submenu_eventManagement() {