From 09903c1ac43c6c37a8986bd4f49a215c42c1aa41 Mon Sep 17 00:00:00 2001 From: Joe Batt Date: Mon, 17 Apr 2023 12:49:17 +0100 Subject: [PATCH] Updated CR boolean logic Signed-off-by: Joe Batt --- .../AideClinicalReview/AideClinicalReviewPlugin.cs | 8 ++++++-- .../TaskManager.IntegrationTests/Support/Assertions.cs | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/TaskManager/Plug-ins/AideClinicalReview/AideClinicalReviewPlugin.cs b/src/TaskManager/Plug-ins/AideClinicalReview/AideClinicalReviewPlugin.cs index 46273179a..f9ff45807 100644 --- a/src/TaskManager/Plug-ins/AideClinicalReview/AideClinicalReviewPlugin.cs +++ b/src/TaskManager/Plug-ins/AideClinicalReview/AideClinicalReviewPlugin.cs @@ -88,9 +88,13 @@ private void Initialize() _workflowName = Event.TaskPluginArguments[Keys.WorkflowName]; } - if (Event.TaskPluginArguments.ContainsKey(Keys.Notifications)) + if (Boolean.TryParse(Event.TaskPluginArguments[Keys.Notifications], out bool result)) { - _notifications = Boolean.TryParse(Event.TaskPluginArguments[Keys.Notifications], out bool result); + _notifications = Boolean.Parse(Event.TaskPluginArguments[Keys.Notifications]); + } + else + { + _notifications = true; } if (Event.TaskPluginArguments.ContainsKey(Keys.ReviewedExecutionId)) diff --git a/tests/IntegrationTests/TaskManager.IntegrationTests/Support/Assertions.cs b/tests/IntegrationTests/TaskManager.IntegrationTests/Support/Assertions.cs index 9ab70b518..73cf8a6db 100644 --- a/tests/IntegrationTests/TaskManager.IntegrationTests/Support/Assertions.cs +++ b/tests/IntegrationTests/TaskManager.IntegrationTests/Support/Assertions.cs @@ -40,12 +40,12 @@ public void AssertClinicalReviewEvent(ClinicalReviewRequestEvent clinicalReviewR clinicalReviewRequestEvent.PatientMetadata.PatientName.Should().Be(GetTaskPluginArguments(taskDispatchEvent, "patient_name")); clinicalReviewRequestEvent.PatientMetadata.PatientSex.Should().Be(GetTaskPluginArguments(taskDispatchEvent, "patient_sex")); clinicalReviewRequestEvent.PatientMetadata.PatientDob.Should().Be(GetTaskPluginArguments(taskDispatchEvent, "patient_dob")); - try + if (Boolean.TryParse(GetTaskPluginArguments(taskDispatchEvent, "notifications"), out bool result)) { - var notifications = GetTaskPluginArguments(taskDispatchEvent, "notifications"); - + var notifications = Boolean.Parse(GetTaskPluginArguments(taskDispatchEvent, "notifications")); + clinicalReviewRequestEvent.Notifications.Should().Be(notifications); } - catch (Exception ex) + else { clinicalReviewRequestEvent.Notifications.Should().Be(true); }