修复Mysql
This commit is contained in:
@@ -39,12 +39,19 @@ public sealed class EvaluationsController(
|
||||
.OrderByDescending(x => x.AcademicTerm!.StartDate)
|
||||
.Select(x => new
|
||||
{
|
||||
x.Id, x.Name, x.Status,
|
||||
x.AcademicTermId, TermName = x.AcademicTerm!.Name,
|
||||
x.StartsAt, x.EndsAt,
|
||||
x.Id,
|
||||
x.Name,
|
||||
x.Status,
|
||||
x.AcademicTermId,
|
||||
TermName = x.AcademicTerm!.Name,
|
||||
x.StartsAt,
|
||||
x.EndsAt,
|
||||
Dimensions = x.Dimensions.Select(d => new
|
||||
{
|
||||
d.Id, d.Name, d.MaxScore, d.SortOrder
|
||||
d.Id,
|
||||
d.Name,
|
||||
d.MaxScore,
|
||||
d.SortOrder
|
||||
}),
|
||||
RecordCount = x.Records.Count,
|
||||
x.CreatedAt
|
||||
@@ -194,8 +201,10 @@ public sealed class EvaluationsController(
|
||||
var enrollments = await db.CourseEnrollments.AsNoTracking()
|
||||
.Where(e =>
|
||||
e.Status == CourseEnrollmentStatus.Enrolled &&
|
||||
e.StudentId == studentId.Value &&
|
||||
termIds.Contains(e.CourseSelectionOffering!.TeachingTask!.AcademicTermId))
|
||||
e.StudentId == studentId.Value)
|
||||
.WhereIn(
|
||||
termIds,
|
||||
e => e.CourseSelectionOffering!.TeachingTask!.AcademicTermId)
|
||||
.Select(e => new
|
||||
{
|
||||
e.CourseSelectionOffering!.TeachingTaskId,
|
||||
@@ -211,9 +220,10 @@ public sealed class EvaluationsController(
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
// Check which tasks have already been evaluated
|
||||
var setupIds = openSetups.Select(s => s.Id).ToArray();
|
||||
var evaluatedIds = await db.EvaluationRecords.AsNoTracking()
|
||||
.Where(r => r.StudentId == studentId.Value &&
|
||||
openSetups.Select(s => s.Id).Contains(r.EvaluationSetupId))
|
||||
.Where(r => r.StudentId == studentId.Value)
|
||||
.WhereIn(setupIds, r => r.EvaluationSetupId)
|
||||
.Select(r => r.TeachingTaskId)
|
||||
.ToHashSetAsync(cancellationToken);
|
||||
|
||||
@@ -251,7 +261,9 @@ public sealed class EvaluationsController(
|
||||
.Where(x => x.Id == teachingTaskId)
|
||||
.Select(x => new
|
||||
{
|
||||
x.Id, x.TaskNumber, x.Name,
|
||||
x.Id,
|
||||
x.TaskNumber,
|
||||
x.Name,
|
||||
x.AcademicTermId,
|
||||
CourseCode = x.Course!.Code,
|
||||
CourseName = x.Course.Name,
|
||||
@@ -283,7 +295,10 @@ public sealed class EvaluationsController(
|
||||
setup.Name,
|
||||
Dimensions = setup.Dimensions.Select(d => new
|
||||
{
|
||||
d.Id, d.Name, d.MaxScore, d.SortOrder
|
||||
d.Id,
|
||||
d.Name,
|
||||
d.MaxScore,
|
||||
d.SortOrder
|
||||
}),
|
||||
Task = task
|
||||
});
|
||||
@@ -384,8 +399,8 @@ public sealed class EvaluationsController(
|
||||
foreach (var setup in setups)
|
||||
{
|
||||
var setupTaskIds = await db.EvaluationRecords.AsNoTracking()
|
||||
.Where(r => r.EvaluationSetupId == setup.Id &&
|
||||
taskIds.Contains(r.TeachingTaskId))
|
||||
.Where(r => r.EvaluationSetupId == setup.Id)
|
||||
.WhereIn(taskIds, r => r.TeachingTaskId)
|
||||
.Select(r => r.TeachingTaskId)
|
||||
.Distinct()
|
||||
.ToListAsync(cancellationToken);
|
||||
@@ -396,7 +411,9 @@ public sealed class EvaluationsController(
|
||||
.Where(x => x.Id == taskId)
|
||||
.Select(x => new
|
||||
{
|
||||
x.Id, x.TaskNumber, x.Name,
|
||||
x.Id,
|
||||
x.TaskNumber,
|
||||
x.Name,
|
||||
x.AcademicTermId,
|
||||
CourseCode = x.Course!.Code,
|
||||
CourseName = x.Course.Name
|
||||
@@ -525,12 +542,18 @@ public sealed class EvaluationsController(
|
||||
{
|
||||
Setup = new
|
||||
{
|
||||
setup.Id, setup.Name, setup.Status,
|
||||
setup.Id,
|
||||
setup.Name,
|
||||
setup.Status,
|
||||
TermName = setup.AcademicTerm!.Name,
|
||||
setup.StartsAt, setup.EndsAt,
|
||||
setup.StartsAt,
|
||||
setup.EndsAt,
|
||||
Dimensions = setup.Dimensions.Select(d => new
|
||||
{
|
||||
d.Id, d.Name, d.MaxScore, d.SortOrder
|
||||
d.Id,
|
||||
d.Name,
|
||||
d.MaxScore,
|
||||
d.SortOrder
|
||||
})
|
||||
},
|
||||
ByTask = byTask,
|
||||
|
||||
Reference in New Issue
Block a user