Website Summary Files Commits Branches @commit @diff @stats
path: root / src / EventSystem
diff options
context:
space:
mode:
Commit57ad84517cd258d7df6ef8b63fbac6c9cb6fcba9 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-05 16:58:16 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-05 16:58:16 +0300
Files16768dac5ed21c69224282560e0bc7e788c39f17 /src/EventSystem
FMI-OOP-P1_TicketSystem-57ad84517cd258d7df6ef8b63fbac6c9cb6fcba9.tar
FMI-OOP-P1_TicketSystem-57ad84517cd258d7df6ef8b63fbac6c9cb6fcba9.tar.gz
FMI-OOP-P1_TicketSystem-57ad84517cd258d7df6ef8b63fbac6c9cb6fcba9.zip
Parenta10d94997c0019f815d83da5dc2ff07167868957 (diff)
Autocommit at 05.05.2022 @ 16:58
3 files changed, 16 insertions, 5 deletions
-rw-r--r--src/EventSystem/Event.cpp4
-rw-r--r--src/EventSystem/Event.h3
-rw-r--r--src/EventSystem/EventSystem.cpp14
diff --git a/src/EventSystem/Event.cpp b/src/EventSystem/Event.cpp
index 63ac8e3..6940aed 100644
--- a/src/EventSystem/Event.cpp
+++ b/src/EventSystem/Event.cpp
@@ -10,6 +10,10 @@ Event::Event(const Hall* hall, String name, Date date) : tickets(), reservations
this->date = date;
}
+const Hall& Event::get_hall() const {
+ return *hall;
+}
+
const String& Event::get_name() const {
return name;
}
diff --git a/src/EventSystem/Event.h b/src/EventSystem/Event.h
index efe0c00..800a1ea 100644
--- a/src/EventSystem/Event.h
+++ b/src/EventSystem/Event.h
@@ -22,6 +22,7 @@ public:
Event();
Event(const Hall* hall, String name, Date date);
+ const Hall& get_hall() const;
const String& get_name() const;
const Date& get_date() const;
@@ -33,8 +34,6 @@ public:
StatusCode buyTicketFromReservation(const Reservation& reservation, const char* password);
- unsigned queryFreeSeats() const;
-
int compare(const Event& other);
};
diff --git a/src/EventSystem/EventSystem.cpp b/src/EventSystem/EventSystem.cpp
index 2f14707..dc64c3b 100644
--- a/src/EventSystem/EventSystem.cpp
+++ b/src/EventSystem/EventSystem.cpp
@@ -33,11 +33,19 @@ StatusCode EventSystem::createEvent(const Hall* hall, String name, Date date) {
}
List<Ticket> EventSystem::queryFreeTickets(const char* name, const Date& dt) {
- List<Ticket> freeTickets();
unsigned ind = indexOfEvent(name, dt);
- if (ind < events[ind].get_count()) {
-
+ if (ind == events[ind].get_count())
+ return List<Ticket>();
+
+ List<Ticket> freeTickets = List<Ticket>();
+
+ unsigned nextInd = 0;
+ for (unsigned r = 1; r <= events[ind].get_hall().get_rowCount(); r++) {
+ for (unsigned s = 1; s <= events[ind].get_hall().get_seatsPerRow(); s++) {
+
+ }
}
+
return freeTickets;
}