Skip to content

Commit

Permalink
a few misc nitpicks
Browse files Browse the repository at this point in the history
  • Loading branch information
adelikat committed Nov 9, 2024
1 parent 12a3cac commit 3431191
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
14 changes: 4 additions & 10 deletions TASVideos.Data/Entity/SubmissionStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion TASVideos.Data/Entity/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public enum UserDateFormat
MMDDY,

[Display(Name = "M/d/yyyy (2/29/2024)")]
MDY,
MDY
}

public enum UserTimeFormat
Expand Down
14 changes: 8 additions & 6 deletions TASVideos.Data/Helpers/SubmissionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3431191

Please sign in to comment.