修复Mysql
This commit is contained in:
@@ -95,7 +95,12 @@ public sealed class StatisticsController(
|
||||
|
||||
return new
|
||||
{
|
||||
byCollege, byMajor, byClass, byGrade, byStatus, byGender,
|
||||
byCollege,
|
||||
byMajor,
|
||||
byClass,
|
||||
byGrade,
|
||||
byStatus,
|
||||
byGender,
|
||||
enrollmentTrend,
|
||||
totals = new { totalStudents }
|
||||
};
|
||||
@@ -255,7 +260,8 @@ public sealed class StatisticsController(
|
||||
|
||||
var passRateByCollegeResult = passRateByCollege.Select(x => new
|
||||
{
|
||||
x.collegeName, x.totalRecords,
|
||||
x.collegeName,
|
||||
x.totalRecords,
|
||||
passRate = x.totalRecords > 0 ? Math.Round((double)x.passedRecords / x.totalRecords, 4) : 0,
|
||||
averageScore = Math.Round(x.averageScore, 1)
|
||||
}).ToList();
|
||||
@@ -336,7 +342,8 @@ public sealed class StatisticsController(
|
||||
|
||||
var byCollegeResult = byCollege.Select(x => new
|
||||
{
|
||||
x.collegeName, x.total,
|
||||
x.collegeName,
|
||||
x.total,
|
||||
passRate = x.total > 0 ? Math.Round((double)x.passed / x.total, 4) : 0
|
||||
}).OrderByDescending(x => x.passRate).ToList();
|
||||
|
||||
@@ -353,7 +360,9 @@ public sealed class StatisticsController(
|
||||
|
||||
var byCourseResult = byCourse.Select(x => new
|
||||
{
|
||||
x.courseCode, x.courseName, x.total,
|
||||
x.courseCode,
|
||||
x.courseName,
|
||||
x.total,
|
||||
passRate = x.total > 0 ? Math.Round((double)x.passed / x.total, 4) : 0
|
||||
}).OrderByDescending(x => x.passRate).ToList();
|
||||
|
||||
@@ -567,7 +576,8 @@ public sealed class StatisticsController(
|
||||
// get entries
|
||||
var entries = await db.ScheduleEntries.AsNoTracking()
|
||||
.Where(e => e.SchedulePlanId == plan.Id)
|
||||
.Where(e => e.ClassroomId != null && classroomIds.Contains(e.ClassroomId.Value))
|
||||
.Where(e => e.ClassroomId != null)
|
||||
.WhereIn(classroomIds, e => e.ClassroomId!.Value)
|
||||
.Select(e => new
|
||||
{
|
||||
e.ClassroomId,
|
||||
@@ -633,7 +643,8 @@ public sealed class StatisticsController(
|
||||
var used = entries.Where(e => e.DayOfWeek == day).Sum(e => e.PeriodCount);
|
||||
return new
|
||||
{
|
||||
day, dayLabel = day < dayLabels.Length ? dayLabels[day] : $"周{day}",
|
||||
day,
|
||||
dayLabel = day < dayLabels.Length ? dayLabels[day] : $"周{day}",
|
||||
utilizationRate = dailyAvailable > 0 ? Math.Round((double)used / dailyAvailable, 4) : 0
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
Reference in New Issue
Block a user