From 505e716ef5298dc99bcfd5d05c5d3912908e5c69 Mon Sep 17 00:00:00 2001 From: Yossi Tamari Date: Wed, 24 Apr 2024 16:42:15 -0700 Subject: [PATCH] fixed bug in saving non bcsc registrant --- .../GeocoderApi/IGeocoderApi.cs | 4 ++-- ess/src/API/EMBC.ESS/Managers/Events/EventsManager.cs | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ess/src/API/EMBC.ESS.Utilities.Spatial/GeocoderApi/IGeocoderApi.cs b/ess/src/API/EMBC.ESS.Utilities.Spatial/GeocoderApi/IGeocoderApi.cs index e55b8bd8f..3a02a9a07 100644 --- a/ess/src/API/EMBC.ESS.Utilities.Spatial/GeocoderApi/IGeocoderApi.cs +++ b/ess/src/API/EMBC.ESS.Utilities.Spatial/GeocoderApi/IGeocoderApi.cs @@ -64,9 +64,9 @@ internal record Geometry internal record Properties2 { public string? accessNotes { get; set; } - public string? blockID { get; set; } + // public string? blockID { get; set; } public string? changeDate { get; set; } - public string? civicNumber { get; set; } + //public string? civicNumber { get; set; } public string? civicNumberSuffix { get; set; } public string? electoralArea { get; set; } public object[]? faults { get; set; } diff --git a/ess/src/API/EMBC.ESS/Managers/Events/EventsManager.cs b/ess/src/API/EMBC.ESS/Managers/Events/EventsManager.cs index e59e8499e..5c3144167 100644 --- a/ess/src/API/EMBC.ESS/Managers/Events/EventsManager.cs +++ b/ess/src/API/EMBC.ESS/Managers/Events/EventsManager.cs @@ -118,9 +118,12 @@ public async Task Handle(SaveRegistrantCommand cmd) { var ct = CancellationToken.None; var evacuee = mapper.Map(cmd.Profile); - var existingEvacuee = evacuee.Id == null && evacuee.UserId != null - ? (await evacueesRepository.Query(new EvacueeQuery { UserId = evacuee.UserId })).Items.SingleOrDefault() - : (await evacueesRepository.Query(new EvacueeQuery { EvacueeId = evacuee.Id })).Items.SingleOrDefault(); + + Evacuee existingEvacuee = null; + if (evacuee.Id == null && evacuee.UserId != null) + existingEvacuee = (await evacueesRepository.Query(new EvacueeQuery { UserId = evacuee.UserId })).Items.SingleOrDefault(); + else if (evacuee.Id != null) + existingEvacuee = (await evacueesRepository.Query(new EvacueeQuery { EvacueeId = evacuee.Id })).Items.SingleOrDefault(); evacuee.Id ??= existingEvacuee?.Id; //fill last login for new registrants from registrants portal - need to split this command into separate use cases