场次显示兼容+号
This commit is contained in:
parent
8014397f3f
commit
14e6d42c71
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user