Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models
diff options
context:
space:
mode:
Commit8843a8c5ac6e74b6dd241d345e84afe7078c4ab3 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 09:47:15 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 09:47:15 +0300
Filese9a2326d2467de2557f2541b76c771e9042e2588 /src/Models
FMI-OOP-P1_TicketSystem-8843a8c5ac6e74b6dd241d345e84afe7078c4ab3.tar
FMI-OOP-P1_TicketSystem-8843a8c5ac6e74b6dd241d345e84afe7078c4ab3.tar.gz
FMI-OOP-P1_TicketSystem-8843a8c5ac6e74b6dd241d345e84afe7078c4ab3.zip
Parentf217867b63fefdbd76ef77ad0957048520822add (diff)
Autocommit at 07.05.2022 @ 09:47
3 files changed, 5 insertions, 3 deletions
-rw-r--r--src/Models/Event.cpp4
-rw-r--r--src/Models/Hall.cpp2
-rw-r--r--src/Models/Hall.h2
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