已修复实验批量排课报错。
This commit is contained in:
@@ -574,7 +574,7 @@ public sealed class ExperimentsController(
|
||||
var projects = await ScopedProjects()
|
||||
.Include(x => x.TeachingTask)
|
||||
.ThenInclude(x => x!.AcademicTerm)
|
||||
.Where(x => projectIds.Contains(x.Id))
|
||||
.WhereIn(projectIds, x => x.Id)
|
||||
.ToDictionaryAsync(x => x.Id, cancellationToken);
|
||||
if (projects.Count != projectIds.Count)
|
||||
return ValidationProblem(
|
||||
|
||||
@@ -235,6 +235,39 @@ public sealed class MySqlMigrationTests
|
||||
StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MySql_experiment_batch_project_query_is_translatable()
|
||||
{
|
||||
using var db = new AppDbContext(CreateMySqlOptions());
|
||||
var projectIds = new[]
|
||||
{
|
||||
Guid.Parse("11111111-1111-1111-1111-111111111111"),
|
||||
Guid.Parse("22222222-2222-2222-2222-222222222222")
|
||||
};
|
||||
var accessibleTaskIds = db.TeachingTasks.Select(x => x.Id);
|
||||
|
||||
var sql = db.ExperimentProjects
|
||||
.Where(x => accessibleTaskIds.Contains(x.TeachingTaskId))
|
||||
.Include(x => x.TeachingTask)
|
||||
.ThenInclude(x => x!.AcademicTerm)
|
||||
.WhereIn(projectIds, x => x.Id)
|
||||
.ToQueryString();
|
||||
|
||||
Assert.Contains(
|
||||
"ExperimentProjects",
|
||||
sql,
|
||||
StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Contains(" IN (", sql, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Contains(
|
||||
projectIds[0].ToString(),
|
||||
sql,
|
||||
StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Contains(
|
||||
projectIds[1].ToString(),
|
||||
sql,
|
||||
StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MySql_index_names_fit_the_server_identifier_limit()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user