diff options
Autocommit at 07.05.2022 @ 09:47
3 files changed, 5 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 |
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 |
