Штуки
Some checks failed
Build and Push Docker Images / build (src/LiquidCode.Tester.Gateway/Dockerfile, git.nullptr.top/liquidcode/liquidcode-tester-gateway-roman, gateway) (push) Successful in 1m12s
Build and Push Docker Images / build (src/LiquidCode.Tester.Worker/Dockerfile, git.nullptr.top/liquidcode/liquidcode-tester-worker-roman, worker) (push) Has been cancelled
Some checks failed
Build and Push Docker Images / build (src/LiquidCode.Tester.Gateway/Dockerfile, git.nullptr.top/liquidcode/liquidcode-tester-gateway-roman, gateway) (push) Successful in 1m12s
Build and Push Docker Images / build (src/LiquidCode.Tester.Worker/Dockerfile, git.nullptr.top/liquidcode/liquidcode-tester-worker-roman, worker) (push) Has been cancelled
This commit is contained in:
@@ -136,23 +136,37 @@ public class AnswerGenerationService
|
||||
return (null, "");
|
||||
}
|
||||
|
||||
if (solutionType.StartsWith("python."))
|
||||
if (solutionType.StartsWith("python"))
|
||||
{
|
||||
var parts = solutionType.Split('.');
|
||||
var version = parts.Length > 1 ? parts[1] : "3";
|
||||
return ("python", $"3.{version}"); // Map python.3 -> 3.3, python.2 -> 3.2 (approx)
|
||||
var versionPart = solutionType.Replace("python", string.Empty, StringComparison.OrdinalIgnoreCase)
|
||||
.Trim('.', ' ');
|
||||
|
||||
if (string.IsNullOrWhiteSpace(versionPart))
|
||||
{
|
||||
return ("python", "3");
|
||||
}
|
||||
|
||||
// Normalize python version; Polygon often uses python.3 or python3.10
|
||||
versionPart = versionPart.TrimStart('.');
|
||||
|
||||
if (!versionPart.Contains('.'))
|
||||
{
|
||||
// Assume major version provided, default to CPython minor 10
|
||||
versionPart = versionPart switch
|
||||
{
|
||||
"2" => "2.7",
|
||||
"3" => "3.10",
|
||||
_ => $"3.{versionPart}"
|
||||
};
|
||||
}
|
||||
|
||||
return ("python", versionPart);
|
||||
}
|
||||
|
||||
if (solutionType.StartsWith("cpp."))
|
||||
{
|
||||
// cpp.g++17, cpp.g++20, cpp.g++14
|
||||
if (solutionType.Contains("++20"))
|
||||
return ("cpp", "20");
|
||||
if (solutionType.Contains("++17"))
|
||||
return ("cpp", "17");
|
||||
if (solutionType.Contains("++14"))
|
||||
return ("cpp", "14");
|
||||
return ("cpp", "17"); // Default to C++17
|
||||
var standard = ExtractCppStandard(solutionType);
|
||||
return ("cpp", standard);
|
||||
}
|
||||
|
||||
if (solutionType.StartsWith("java"))
|
||||
@@ -178,4 +192,22 @@ public class AnswerGenerationService
|
||||
_logger.LogWarning("Unknown solution type: {Type}", solutionType);
|
||||
return (null, "");
|
||||
}
|
||||
|
||||
private static string ExtractCppStandard(string solutionType)
|
||||
{
|
||||
var knownStandards = new[] { "26", "23", "20", "17", "14", "11", "03", "98" };
|
||||
|
||||
foreach (var standard in knownStandards)
|
||||
{
|
||||
if (solutionType.Contains($"++{standard}", StringComparison.OrdinalIgnoreCase) ||
|
||||
solutionType.Contains($"c++{standard}", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Normalize 03 to 03, 98 stays 98
|
||||
return standard.TrimStart('0');
|
||||
}
|
||||
}
|
||||
|
||||
// Default to modern standard if not specified
|
||||
return "17";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user