场次显示兼容+号

This commit is contained in:
马梓彭 2026-11-05 09:11:46 +08:00
parent 8014397f3f
commit 14e6d42c71
3 changed files with 3 additions and 2 deletions

View File

@ -262,6 +262,7 @@ public class CheckinScheduleService : ITransient
var normalized = sessionName.Trim(); var normalized = sessionName.Trim();
if (normalized.StartsWith('第') && normalized.EndsWith('场')) if (normalized.StartsWith('第') && normalized.EndsWith('场'))
normalized = normalized[1..^1].Trim(); normalized = normalized[1..^1].Trim();
if (normalized.EndsWith('+')) normalized = normalized[..^1].Trim();
return int.TryParse(normalized, out var value) && value > 0 ? value : fallback; return int.TryParse(normalized, out var value) && value > 0 ? value : fallback;
} }

View File

@ -1693,7 +1693,7 @@ public class JudgeScoringController : IDynamicApiController
private static int GetImportedSessionOrder(string? sessionName, int fallback) private static int GetImportedSessionOrder(string? sessionName, int fallback)
{ {
if (string.IsNullOrWhiteSpace(sessionName)) return fallback; if (string.IsNullOrWhiteSpace(sessionName)) return fallback;
var match = Regex.Match(sessionName, @"^\s*(?:第\s*)?(?<sequence>\d+)(?:\s*场)?\s*$", var match = Regex.Match(sessionName, @"^\s*(?:第\s*)?(?<sequence>\d+)(?:\s*\+)?(?:\s*场)?\s*$",
RegexOptions.CultureInvariant); RegexOptions.CultureInvariant);
return match.Success && int.TryParse(match.Groups["sequence"].Value, out var sequence) && sequence > 0 return match.Success && int.TryParse(match.Groups["sequence"].Value, out var sequence) && sequence > 0
? sequence ? sequence

View File

@ -2219,7 +2219,7 @@ public partial class WorkbenchController : IDynamicApiController
private static int GetImportedSessionOrder(string? sessionName, int fallback) private static int GetImportedSessionOrder(string? sessionName, int fallback)
{ {
if (string.IsNullOrWhiteSpace(sessionName)) return fallback; if (string.IsNullOrWhiteSpace(sessionName)) return fallback;
var match = Regex.Match(sessionName, @"^\s*(?:第\s*)?(?<sequence>\d+)(?:\s*场)?\s*$", var match = Regex.Match(sessionName, @"^\s*(?:第\s*)?(?<sequence>\d+)(?:\s*\+)?(?:\s*场)?\s*$",
RegexOptions.CultureInvariant); RegexOptions.CultureInvariant);
return match.Success && int.TryParse(match.Groups["sequence"].Value, out var sequence) && sequence > 0 return match.Success && int.TryParse(match.Groups["sequence"].Value, out var sequence) && sequence > 0
? sequence ? sequence