diff options
Autocommit at 07.05.2022 @ 09:47
4 files changed, 7 insertions, 3 deletions
| -rw-r--r-- | src/Models/Event.cpp | 4 | ||||
| -rw-r--r-- | src/Models/Hall.cpp | 2 | ||||
| -rw-r--r-- | src/Models/Hall.h | 2 | ||||
| -rw-r--r-- | src/Services/EventService.cpp | 2 |
diff --git a/src/Models/Event.cpp b/src/Models/Event.cpp index f570fbf..034e4b3 100644 --- a/src/Models/Event.cpp +++ b/src/Models/Event.cpp @@ -30,5 +30,7 @@ const Date& Event::get_date() const { } int Event::compare(const Event& other) { - return name.compare(other.name); + if (hall == other.hall) + return date.compare(other.date); + return hall->compare(*other.hall); } diff --git a/src/Models/Hall.cpp b/src/Models/Hall.cpp index a8231df..fbe482f 100644 --- a/src/Models/Hall.cpp +++ b/src/Models/Hall.cpp @@ -31,6 +31,6 @@ void Hall::set_seatsPerRow(unsigned seatsPerRow) { this->seatsPerRow = seatsPerRow; } -int Hall::compare(const Hall& other) { +int Hall::compare(const Hall& other) const { return (number > other.get_number()) - (number < other.get_number()); } diff --git a/src/Models/Hall.h b/src/Models/Hall.h index 4f2f1a1..a164a0b 100644 --- a/src/Models/Hall.h +++ b/src/Models/Hall.h @@ -20,7 +20,7 @@ public: unsigned get_seatsPerRow() const; void set_seatsPerRow(unsigned seatsPerRow); - int compare(const Hall& other); + int compare(const Hall& other) const; }; #endif diff --git a/src/Services/EventService.cpp b/src/Services/EventService.cpp index b7d54e1..fa50d0b 100644 --- a/src/Services/EventService.cpp +++ b/src/Services/EventService.cpp @@ -42,6 +42,8 @@ StatusCode EventService::createEvent(int hallNumber, const String& name, const D unsigned hInd = hs->get_halls().findIndex(Hall(hallNumber)); if (hInd == hs->get_halls().get_count()) return E_HallDoesntExist; + + unsigned eInd = indexOfEvent(date) if (true) return E_EventWillOverlap; |
