diff options
Autocommit at 05.05.2022 @ 16:58
3 files changed, 16 insertions, 5 deletions
| -rw-r--r-- | src/EventSystem/Event.cpp | 4 | ||||
| -rw-r--r-- | src/EventSystem/Event.h | 3 | ||||
| -rw-r--r-- | src/EventSystem/EventSystem.cpp | 14 |
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; } |
