From 0f2607bb19d49352eea126f5073ee4ba1d8677c3 Mon Sep 17 00:00:00 2001 From: Pete ba Date: Sun, 27 Oct 2019 14:29:37 +0000 Subject: [PATCH] Add attribution to Watering Data --- routes/adjustmentMethods/EToAdjustmentMethod.ts | 1 + routes/adjustmentMethods/ManualAdjustmentMethod.ts | 3 +++ routes/adjustmentMethods/RainDelayAdjustmentMethod.ts | 5 ++++- routes/adjustmentMethods/ZimmermanAdjustmentMethod.ts | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/routes/adjustmentMethods/EToAdjustmentMethod.ts b/routes/adjustmentMethods/EToAdjustmentMethod.ts index abfba8a..d1c0fa2 100644 --- a/routes/adjustmentMethods/EToAdjustmentMethod.ts +++ b/routes/adjustmentMethods/EToAdjustmentMethod.ts @@ -54,6 +54,7 @@ async function calculateEToWateringScale( return { scale: scale, rawData: { + weatherProvider: etoData.weatherProvider, eto: Math.round( eto * 1000) / 1000, radiation: Math.round( etoData.solarRadiation * 100) / 100, minT: Math.round( etoData.minTemp ), diff --git a/routes/adjustmentMethods/ManualAdjustmentMethod.ts b/routes/adjustmentMethods/ManualAdjustmentMethod.ts index 7c9e8f7..701123f 100644 --- a/routes/adjustmentMethods/ManualAdjustmentMethod.ts +++ b/routes/adjustmentMethods/ManualAdjustmentMethod.ts @@ -7,6 +7,9 @@ import { AdjustmentMethod, AdjustmentMethodResponse } from "./AdjustmentMethod"; async function calculateManualWateringScale( ): Promise< AdjustmentMethodResponse > { return { scale: undefined, + rawData: { + weatherProvider: "Manual", + }, wateringData: undefined } } diff --git a/routes/adjustmentMethods/RainDelayAdjustmentMethod.ts b/routes/adjustmentMethods/RainDelayAdjustmentMethod.ts index bfa1348..da6249d 100644 --- a/routes/adjustmentMethods/RainDelayAdjustmentMethod.ts +++ b/routes/adjustmentMethods/RainDelayAdjustmentMethod.ts @@ -12,7 +12,10 @@ async function calculateRainDelayWateringScale( adjustmentOptions: RainDelayAdju const d = adjustmentOptions.hasOwnProperty( "d" ) ? adjustmentOptions.d : 24; return { scale: undefined, - rawData: { raining: raining ? 1 : 0 }, + rawData: { + weatherProvider: wateringData.weatherProvider, + raining: raining ? 1 : 0, + }, rainDelay: raining ? d : undefined, wateringData: wateringData } diff --git a/routes/adjustmentMethods/ZimmermanAdjustmentMethod.ts b/routes/adjustmentMethods/ZimmermanAdjustmentMethod.ts index 59375e1..ccc0852 100644 --- a/routes/adjustmentMethods/ZimmermanAdjustmentMethod.ts +++ b/routes/adjustmentMethods/ZimmermanAdjustmentMethod.ts @@ -30,6 +30,7 @@ async function calculateZimmermanWateringScale( */ const rawData = { + weatherProvider: wateringData.weatherProvider, h: wateringData ? Math.round( wateringData.humidity * 100) / 100 : null, p: wateringData ? Math.round( wateringData.precip * 100 ) / 100 : null, t: wateringData ? Math.round( wateringData.temp * 10 ) / 10 : null,