From ce469e447047a67792e93e76fabdf8d449454cc5 Mon Sep 17 00:00:00 2001
From: Dimitrios Stoupis <dimitris.apple@gmail.com>
Date: Sun, 17 Mar 2019 10:40:41 +0000
Subject: [PATCH] Corrected the message saving in the loop

---
 src/Services/TimeBasedSchedulingService.cpp | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/Services/TimeBasedSchedulingService.cpp b/src/Services/TimeBasedSchedulingService.cpp
index 4bff94b4..95df2a9e 100644
--- a/src/Services/TimeBasedSchedulingService.cpp
+++ b/src/Services/TimeBasedSchedulingService.cpp
@@ -1,6 +1,11 @@
 #include "Services/TimeBasedSchedulingService.hpp"
 
 
+TimeBasedSchedulingService::TimeBasedSchedulingService() {
+	serviceType = 11;
+}
+
+
 void TimeBasedSchedulingService::enableScheduleExecution(Message &request) {
 
 	// Check if the correct packet is being processed
@@ -205,18 +210,18 @@ void TimeBasedSchedulingService::detailReportAllActivities(Message &request) {
 	assert(request.serviceType == 11);
 	assert(request.messageType == 16);
 
+	// Create the report message object of telemetry message subtype 10 for each activity
+	Message report = createTM(10);
+	report.appendUint16(currentNumberOfActivities);
+
 	for (auto &activity : scheduledActivities) {
-		// Create the report message object of telemetry message subtype 10 for each activity
-		Message report = createTM(10);
 		// todo: append sub-schedule and group ID if they are defined
 
 		report.appendUint32(activity.requestReleaseTime); // todo: Replace with the time parser
 		report.appendString(msgParser.convertTCToStr(activity.request));
-
-		storeMessage(report); // Save the report
-		request.resetRead(); // todo: define if this statement is required
 	}
-
+	storeMessage(report); // Save the report
+	request.resetRead(); // todo: define if this statement is required
 }
 
 void TimeBasedSchedulingService::detailReporActivitiesByID(Message &request) {
-- 
GitLab