Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Services / EventService.cpp
diff options
context:
space:
mode:
Commit8fdd50592e1f9fef9a4ff261e771924d7c688741 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-08 08:22:53 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-08 08:22:53 +0300
Files83a054973ce5bc3ec3855b585a66213cb1f01c36 /src/Services/EventService.cpp
FMI-OOP-P1_TicketSystem-8fdd50592e1f9fef9a4ff261e771924d7c688741.tar
FMI-OOP-P1_TicketSystem-8fdd50592e1f9fef9a4ff261e771924d7c688741.tar.gz
FMI-OOP-P1_TicketSystem-8fdd50592e1f9fef9a4ff261e771924d7c688741.zip
Parent3096685a17b3321d26766e5ed91abbab6572d5c1 (diff)
Autocommit at 08.05.2022 @ 08:22
1 files changed, 13 insertions, 2 deletions
-rw-r--r--src/Services/EventService.cpp15
diff --git a/src/Services/EventService.cpp b/src/Services/EventService.cpp
index 4c89ae8..eb57f41 100644
--- a/src/Services/EventService.cpp
+++ b/src/Services/EventService.cpp
@@ -159,10 +159,21 @@ String EventService::createSeatingString(const char* name, const Date& date, uns
return out;
}
-StatusCode EventService::queryMostWatched() {
+unsigned indexToInsertWhenTicketSort(const List<Event>& elem, unsigned topN, unsigned ticketCount) {
+ for (unsigned i = 0; i < elem.get_count() && i < topN; i++) {
+ if (elem[i].get_tickets().get_count() < ticketCount)
+ return i;
+ }
+ return topN;
+}
+
+StatusCode EventService::queryMostWatched(unsigned topN) {
List<Event> result;
for (unsigned i = 0; i < events.get_count(); i++) {
- if (result.get_count() > 10 && result[10])
+ if (result.get_count() > 10 && result[10].get_tickets().get_count() > events[i].get_tickets().get_count())
+ continue;
+
+
}
}