Skip to content

AC-2032 Readded the notification preferences validation #732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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