Skip to content

Commit

Permalink
Merge pull request #732 from Project-MONAI/AC-2032-ReaddNotificationP…
Browse files Browse the repository at this point in the history
…references

AC-2032 Readded the notification preferences validation
  • Loading branch information
woodheadio authored Apr 6, 2023
2 parents 0833d1d + 8953e5b commit a9b9ae9
Show file tree
Hide file tree
Showing 6 changed files with 1,536 additions and 1,052 deletions.
11 changes: 11 additions & 0 deletions src/Shared/Shared/ValidationConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,24 @@ public static class ValidationConstants
/// </summary>
public static readonly string Mode = "mode";

/// <summary>
/// Key for the notifications.
/// </summary>
public static readonly string Notifications = "notifications";

public enum ModeValues
{
QA,
Research,
Clinical
}

public enum NotificationValues
{
True,
False
}

/// <summary>
/// Required arguments to run the clinical review task workflow args.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,16 @@ private void ValidateClinicalReviewRequiredFields(TaskObject[] tasks, TaskObject
return;
}

if (!currentTask.Args.ContainsKey(Notifications))
{
Errors.Add($"Task: '{currentTask.Id}' notifications must be specified.");
return;
}
else if (!Enum.TryParse(typeof(NotificationValues), currentTask.Args[Notifications], true, out var _))
{
Errors.Add($"Task: '{currentTask.Id}' notifications is incorrectly specified{Comma}please specify 'true' or 'false'");
}

var reviewedTask = tasks.First(t => t.Id.ToLower() == currentTask.Args[ReviewedTaskId].ToLower());

if (reviewedTask.Type.Equals(ArgoTaskType, StringComparison.OrdinalIgnoreCase) is false)
Expand Down
Loading

0 comments on commit a9b9ae9

Please sign in to comment.