diff --git a/src/KpiGenerator/Program.cs b/src/KpiGenerator/Program.cs index 90abb10b9147fa3994d7e01597a923b99959fd92..e95d0674a3a76f4bbb0455d57faaa1be8534da70 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 036acec534080d6a5cdfb42776ff6bfb5f9f37ed..a532b5fecd916ec1843798886da62efee4e32336 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(); }