Website Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
4 files changed, 8 insertions, 2 deletions
-rw-r--r--src/Models/Hall.cpp2
-rw-r--r--src/Models/Hall.h1
-rw-r--r--src/Services/EventService.cpp5
-rw-r--r--src/Services/HallService.h2
diff --git a/src/Models/Hall.cpp b/src/Models/Hall.cpp
index c3f96fd..a8231df 100644
--- a/src/Models/Hall.cpp
+++ b/src/Models/Hall.cpp
@@ -2,6 +2,8 @@
Hall::Hall() : Hall(0, 0, 0) {}
+Hall::Hall(int number) : Hall(number, 0, 0) {}
+
Hall::Hall(int number, unsigned rows, unsigned seatsPerRow) {
this->number = number;
this->rows = rows;
diff --git a/src/Models/Hall.h b/src/Models/Hall.h
index 346a063..4f2f1a1 100644
--- a/src/Models/Hall.h
+++ b/src/Models/Hall.h
@@ -8,6 +8,7 @@ class Hall {
public:
Hall();
+ Hall(int number);
Hall(int number, unsigned rows, unsigned seatsPerRow);
int get_number() const;
diff --git a/src/Services/EventService.cpp b/src/Services/EventService.cpp
index c3124cc..b7d54e1 100644
--- a/src/Services/EventService.cpp
+++ b/src/Services/EventService.cpp
@@ -39,7 +39,10 @@ EventService::EventService(const HallService* hs, const Event* events, unsigned
}
StatusCode EventService::createEvent(int hallNumber, const String& name, const Date& date) {
- if (indexOfEvent(date) < events.get_count())
+ unsigned hInd = hs->get_halls().findIndex(Hall(hallNumber));
+ if (hInd == hs->get_halls().get_count())
+ return E_HallDoesntExist;
+ if (true)
return E_EventWillOverlap;
events.insert(Event(*hall, name, date));
diff --git a/src/Services/HallService.h b/src/Services/HallService.h
index 88df0a3..4fdea1e 100644
--- a/src/Services/HallService.h
+++ b/src/Services/HallService.h
@@ -10,7 +10,7 @@ class HallService {
public:
HallService(const Hall* halls, unsigned hallCount);
- bool hallExists();
+ const OrderedList<Hall>& get_halls() const;
};
#endif