Skip to content

Commit 44d2563

Browse files
authored
Added CR notifications logic (#714)
* Added CR notifications logic Signed-off-by: Joe Batt <joe.batt@answerdigital.com> * Updated tests Signed-off-by: Joe Batt <joe.batt@answerdigital.com> * Updated tests Signed-off-by: Joe Batt <joe.batt@answerdigital.com> * Added unit tests for notifications functionality Signed-off-by: Joe Batt <joe.batt@answerdigital.com> --------- Signed-off-by: Joe Batt <joe.batt@answerdigital.com>
1 parent 201755c commit 44d2563

File tree

6 files changed

+1536
-1052
lines changed

6 files changed

+1536
-1052
lines changed

src/Shared/Shared/ValidationConstants.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,24 @@ public static class ValidationConstants
4848
/// </summary>
4949
public static readonly string Mode = "mode";
5050

51+
/// <summary>
52+
/// Key for the notifications.
53+
/// </summary>
54+
public static readonly string Notifications = "notifications";
55+
5156
public enum ModeValues
5257
{
5358
QA,
5459
Research,
5560
Clinical
5661
}
5762

63+
public enum NotificationValues
64+
{
65+
True,
66+
False
67+
}
68+
5869
/// <summary>
5970
/// Required arguments to run the clinical review task workflow args.
6071
/// </summary>

src/WorkflowManager/WorkflowManager/Validators/WorkflowValidator.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,16 @@ private void ValidateClinicalReviewRequiredFields(TaskObject[] tasks, TaskObject
407407
return;
408408
}
409409

410+
if (!currentTask.Args.ContainsKey(Notifications))
411+
{
412+
Errors.Add($"Task: '{currentTask.Id}' notifications must be specified.");
413+
return;
414+
}
415+
else if (!Enum.TryParse(typeof(NotificationValues), currentTask.Args[Notifications], true, out var _))
416+
{
417+
Errors.Add($"Task: '{currentTask.Id}' notifications is incorrectly specified{Comma}please specify 'true' or 'false'");
418+
}
419+
410420
var reviewedTask = tasks.First(t => t.Id.ToLower() == currentTask.Args[ReviewedTaskId].ToLower());
411421

412422
if (reviewedTask.Type.Equals(ArgoTaskType, StringComparison.OrdinalIgnoreCase) is false)

0 commit comments

Comments
 (0)