From 343119106f4dd4ae5ebc31fff76b7558f5779e7a Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 9 Nov 2024 09:57:46 -0600 Subject: [PATCH] a few misc nitpicks --- TASVideos.Data/Entity/SubmissionStatus.cs | 14 ++++---------- TASVideos.Data/Entity/User.cs | 2 +- TASVideos.Data/Helpers/SubmissionHelper.cs | 14 ++++++++------ 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/TASVideos.Data/Entity/SubmissionStatus.cs b/TASVideos.Data/Entity/SubmissionStatus.cs index d6e100b9e..9d3843fe8 100644 --- a/TASVideos.Data/Entity/SubmissionStatus.cs +++ b/TASVideos.Data/Entity/SubmissionStatus.cs @@ -30,36 +30,30 @@ public enum SubmissionStatus Cancelled, [Display(Name = "Playground")] - Playground, + Playground } public static class SubmissionStatusExtensions { public static bool CanBeJudged(this SubmissionStatus status) - { - return status is SubmissionStatus.New + => status is SubmissionStatus.New or SubmissionStatus.Delayed or SubmissionStatus.NeedsMoreInfo or SubmissionStatus.JudgingUnderWay; - } public static bool IsWorkInProgress(this SubmissionStatus status) - { - return status is SubmissionStatus.New + => status is SubmissionStatus.New or SubmissionStatus.Delayed or SubmissionStatus.NeedsMoreInfo or SubmissionStatus.JudgingUnderWay or SubmissionStatus.Accepted or SubmissionStatus.PublicationUnderway; - } public static bool IsJudgeDecision(this SubmissionStatus status) - { - return status is SubmissionStatus.Accepted + => status is SubmissionStatus.Accepted or SubmissionStatus.Rejected or SubmissionStatus.Cancelled or SubmissionStatus.Delayed or SubmissionStatus.NeedsMoreInfo or SubmissionStatus.Playground; - } } diff --git a/TASVideos.Data/Entity/User.cs b/TASVideos.Data/Entity/User.cs index f5995ddc4..1c9b1cc57 100644 --- a/TASVideos.Data/Entity/User.cs +++ b/TASVideos.Data/Entity/User.cs @@ -157,7 +157,7 @@ public enum UserDateFormat MMDDY, [Display(Name = "M/d/yyyy (2/29/2024)")] - MDY, + MDY } public enum UserTimeFormat diff --git a/TASVideos.Data/Helpers/SubmissionHelper.cs b/TASVideos.Data/Helpers/SubmissionHelper.cs index 05bfd74e5..14309c9f7 100644 --- a/TASVideos.Data/Helpers/SubmissionHelper.cs +++ b/TASVideos.Data/Helpers/SubmissionHelper.cs @@ -20,13 +20,15 @@ public static class SubmissionHelper private static int? IsRawNumberedLink(string? link, string prefix) { link = link?.Trim('/'); - if (link != null && link.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) + if (link == null || !link.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) { - var numberText = link.Replace(prefix, ""); - if (int.TryParse(numberText, out int id)) - { - return id; - } + return null; + } + + var numberText = link.Replace(prefix, ""); + if (int.TryParse(numberText, out int id)) + { + return id; } return null;