From 33886acd9f33bc2451be8264ebf6a31bf7aec6cd Mon Sep 17 00:00:00 2001
From: Heinrichs <Heinrichs@itc.rwth-aachen.de>
Date: Mon, 12 Apr 2021 12:52:53 +0200
Subject: [PATCH] Create Testing Branch

---
 src/KpiGenerator/Program.cs                  | 24 +-------------------
 src/KpiGenerator/Reporter/HamsterReporter.cs |  2 +-
 2 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/src/KpiGenerator/Program.cs b/src/KpiGenerator/Program.cs
index 90abb10..e95d067 100644
--- a/src/KpiGenerator/Program.cs
+++ b/src/KpiGenerator/Program.cs
@@ -17,8 +17,6 @@ namespace Coscine.KpiGenerator
             ConsulConfiguration configuration = new ConsulConfiguration();
             DataConnection.DefaultSettings = new CoscineSettings(configuration);
 
-            var liveMode = configuration.GetStringAndWait("coscine/global/reporting/live");
-
             // Run all Generators for the KPI
             // each Generator returns a list of KPI, it can have zero entries.
             List<Kpi> newKpis = new List<Kpi>();
@@ -27,29 +25,9 @@ namespace Coscine.KpiGenerator
             newKpis.AddRange(new GenerateRDSQuotasPerIkz(configuration, "2973").GenerateKpis());
             newKpis.AddRange(new GenerateUsersPerIkz(configuration, "2967").GenerateKpis());
 
-            // when all generators are done
-            var kpiModel = new KpiModel();
-            // each value is stored within the database
-            foreach (Kpi kpi in newKpis)
-            {
-                kpiModel.Insert(kpi);
-            }
-
-            // get all values from the database that have not been successfully sent yet
-            var kpiToProcess = kpiModel.GetAllWhere((kpi) => (kpi.SentSuccessfully == false)).ToList();
-
             // try to sent them
             HamsterReporter hamsterReporter = new HamsterReporter(configuration);
-            if (liveMode == "1")
-            {
-                hamsterReporter.Send(kpiToProcess);
-            }
-
-            // if the kpi were sent successful mark all values within the database as successfully sent
-            foreach (Kpi kpi in kpiToProcess)
-            {
-                kpiModel.MarkAsSent(kpi);
-            }
+            hamsterReporter.Send(newKpis);
         }
     }
 }
diff --git a/src/KpiGenerator/Reporter/HamsterReporter.cs b/src/KpiGenerator/Reporter/HamsterReporter.cs
index 036acec..a532b5f 100644
--- a/src/KpiGenerator/Reporter/HamsterReporter.cs
+++ b/src/KpiGenerator/Reporter/HamsterReporter.cs
@@ -17,7 +17,7 @@ namespace Coscine.KpiGenerator.Reporter
         public HamsterReporter(IConfiguration configuration)
         {
             _password = configuration.GetStringAndWait("coscine/global/reporting/password");
-            _liveMode = configuration.GetStringAndWait("coscine/global/reporting/live");
+            _liveMode = "0";
             _restClient = new RestClient();
         }
 
-- 
GitLab