Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Services / EventService.cpp
diff options
context:
space:
mode:
Commite3883be7106e667322d51e35aa124ee7298125cb (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 16:08:36 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 16:08:36 +0300
Files90e06f660d37607494d38658e284de88e4d9b050 /src/Services/EventService.cpp
FMI-OOP-P1_TicketSystem-e3883be7106e667322d51e35aa124ee7298125cb.tar
FMI-OOP-P1_TicketSystem-e3883be7106e667322d51e35aa124ee7298125cb.tar.gz
FMI-OOP-P1_TicketSystem-e3883be7106e667322d51e35aa124ee7298125cb.zip
Parent4c1f8f7c13f22fc701206ea56dae30d26aca9bda (diff)
Autocommit at 07.05.2022 @ 16:08
1 files changed, 9 insertions, 2 deletions
-rw-r--r--src/Services/EventService.cpp11
diff --git a/src/Services/EventService.cpp b/src/Services/EventService.cpp
index 26c9bb6..926aadf 100644
--- a/src/Services/EventService.cpp
+++ b/src/Services/EventService.cpp
@@ -173,7 +173,7 @@ bool cond_event_date(const Event& e, const Date& date) {
}
StatusCode EventService::reportReservations(const char* name, const Date& date) {
- List<Reservation> result;
+ List<Event> result;
bool (*cond_name)(const Event&, const char*) = cond_event_name;
bool (*cond_date)(const Event&, const Date&) = cond_event_date;
@@ -182,8 +182,15 @@ StatusCode EventService::reportReservations(const char* name, const Date& date)
for (unsigned i = 0; i < events.get_count(); i++) {
if (cond_name(events[i], name) && cond_date(events[i], date))
- result += events[i].get_reservations();
+ result.add(events[i]);
}
+ std::ofstream outFile("report.txt");
+ if (!outFile.is_open())
+ return E_FileCouldNotBeOpened;
+ outFile << result;
+ outFile.close();
+
+ return Success;
}