From 75ffda69d6907304f502b92309cbd3cbc9d099ee Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Fri, 3 Mar 2017 02:12:42 +0100 Subject: [PATCH] fixes no recipient at GCM for estimates --- Yavsc/ApiControllers/PdfEstimateController.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Yavsc/ApiControllers/PdfEstimateController.cs b/Yavsc/ApiControllers/PdfEstimateController.cs index 78e09c53..f87c932f 100644 --- a/Yavsc/ApiControllers/PdfEstimateController.cs +++ b/Yavsc/ApiControllers/PdfEstimateController.cs @@ -111,10 +111,12 @@ namespace Yavsc.ApiControllers var yaev = new EstimationEvent(dbContext,estimate,_localizer); var regids = estimate.Client.Devices.Select(d => d.GCMRegistrationId).ToArray(); - logger.LogWarning($"new regids: {regids}"); - var grep = await _GCMSender.NotifyEstimateAsync(_googleSettings,regids,yaev); - logger.LogWarning($"grep: {grep}"); - return Ok (new { ProviderValidationDate = estimate.ProviderValidationDate, GCMSent = grep.success }); + bool gcmSent = false; + if (regids.Length>0) { + var grep = await _GCMSender.NotifyEstimateAsync(_googleSettings,regids,yaev); + gcmSent = grep.success>0; + } + return Ok (new { ProviderValidationDate = estimate.ProviderValidationDate, GCMSent = gcmSent }); } [HttpGet("prosign/{id}")]