From d03a699114b806241e38cd8c53ca27e1a75c6986 Mon Sep 17 00:00:00 2001 From: Wilco Krikke Date: Tue, 13 Oct 2020 13:51:51 +0200 Subject: [PATCH] Added advice date (d) --- FarmMapsBlight/BlightApplication.cs | 3 ++- FarmMapsBlight/BlightService.cs | 3 ++- FarmMapsBlight/FarmMapsBlight.csproj | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/FarmMapsBlight/BlightApplication.cs b/FarmMapsBlight/BlightApplication.cs index 6d35d0d..8267744 100644 --- a/FarmMapsBlight/BlightApplication.cs +++ b/FarmMapsBlight/BlightApplication.cs @@ -74,10 +74,11 @@ namespace FarmMapsBlight cropfieldItem = await _farmmapsApiService.GetItemAsync(_settings.CropfieldItemCode); } + DateTime adviceDate = DateTime.Now.Date; DateTime plantingDate = new DateTime(2020, 3, 20); DateTime emergeDate = new DateTime(2020, 5, 20); - var blightItem = await _blightService.CreateAdvice(cropfieldItem, plantingDate, emergeDate); + var blightItem = await _blightService.CreateAdvice(cropfieldItem, adviceDate, plantingDate, emergeDate); if (blightItem == null) { return; diff --git a/FarmMapsBlight/BlightService.cs b/FarmMapsBlight/BlightService.cs index a7b95c8..fb050fb 100644 --- a/FarmMapsBlight/BlightService.cs +++ b/FarmMapsBlight/BlightService.cs @@ -25,13 +25,14 @@ namespace FarmMapsBlight _generalService = generalService; } - public async Task CreateAdvice(Item cropfieldItem, DateTime plantingDate, DateTime emergeDate) + public async Task CreateAdvice(Item cropfieldItem, DateTime adviceDate, DateTime plantingDate, DateTime emergeDate) { var taskRequest = new TaskRequest() { TaskType = "vnd.farmmaps.task.blight" }; + taskRequest.attributes["d"] = DateTime.Now.Date.ToString("o"); taskRequest.attributes["plantingDate"] = plantingDate.ToUniversalTime().ToString("o"); taskRequest.attributes["emergeDate"] = emergeDate.ToUniversalTime().ToString("o"); diff --git a/FarmMapsBlight/FarmMapsBlight.csproj b/FarmMapsBlight/FarmMapsBlight.csproj index e39b1b4..052b891 100644 --- a/FarmMapsBlight/FarmMapsBlight.csproj +++ b/FarmMapsBlight/FarmMapsBlight.csproj @@ -11,7 +11,7 @@ - Always + Never