From 75b9a844bd634767e5ca49df87b031be5cf9bf29 Mon Sep 17 00:00:00 2001
From: athatheocsd <athatheo@csd.auth.gr>
Date: Thu, 27 Dec 2018 02:21:17 +0200
Subject: [PATCH] I'm stupid

---
 src/Services/EventActionService.cpp  | 8 +++++---
 src/Services/EventReportService.cpp  | 4 ++--
 test/Services/EventActionService.cpp | 5 +++--
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/Services/EventActionService.cpp b/src/Services/EventActionService.cpp
index edd688e4..2067190e 100644
--- a/src/Services/EventActionService.cpp
+++ b/src/Services/EventActionService.cpp
@@ -183,8 +183,10 @@ void EventActionService::executeAction(uint16_t eventID) {
 			}
 			i++;
 		}
-		MessageParser messageParser;
-		Message message = messageParser.parseRequestTC(eventActionDefinitionArray[i].request);
-		messageParser.execute(message);
+		if (i != 256){ // If i == 256 that means that no matching eventId was found
+			MessageParser messageParser;
+			Message message = messageParser.parseRequestTC(eventActionDefinitionArray[i].request);
+			messageParser.execute(message);
+		}
 	}
 }
diff --git a/src/Services/EventReportService.cpp b/src/Services/EventReportService.cpp
index 8190f87f..f24dfac7 100644
--- a/src/Services/EventReportService.cpp
+++ b/src/Services/EventReportService.cpp
@@ -12,10 +12,10 @@ void EventReportService::informativeEventReport(Event eventID, String<64> data)
 		Message report = createTM(1);
 		report.appendEnum16(eventID);
 		report.appendString(data);
+		EventActionService eventActionService;
+//		eventActionService.executeAction(eventID);
 
 		storeMessage(report);
-		EventActionService eventActionService;
-		eventActionService.executeAction(eventID);
 	}
 }
 
diff --git a/test/Services/EventActionService.cpp b/test/Services/EventActionService.cpp
index e783b1a1..3fe04d02 100644
--- a/test/Services/EventActionService.cpp
+++ b/test/Services/EventActionService.cpp
@@ -5,11 +5,12 @@
 #include <cstring>
 
 TEST_CASE("Add event-action definitions TC[19,1]", "[service][st09]") {
-
+	EventActionService eventActionService;
+	Message message(19, 1, Message::TC, 0);
 }
 
 TEST_CASE("Delete event-action definitions TC[19,2]", "[service][st09]") {
-
+	
 }
 
 TEST_CASE("Delete all event-action definitions TC[19,3]", "[service][st09]") {
-- 
GitLab