考试计划草稿、场次配置与正式发布。 教学班、考试时间、考场、监考教师关联。 自动校验考场容量。 阻止考场、监考教师和学生考试时间冲突。 管理员查看考生名单。 教师查看个人监考安排。 学生查看已发布考试日程。 SQLite 增量升级和 MySQL 正式迁移。
59 lines
2.7 KiB
C#
59 lines
2.7 KiB
C#
using Jiaowu.Api.Domain.Academic;
|
|
using Jiaowu.Api.Infrastructure.Persistence;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Jiaowu.Api.Controllers;
|
|
|
|
[ApiController]
|
|
[Authorize]
|
|
[Route("api/dashboard")]
|
|
public sealed class DashboardController(AppDbContext db) : ControllerBase
|
|
{
|
|
[HttpGet]
|
|
public async Task<ActionResult<object>> Get(CancellationToken cancellationToken)
|
|
{
|
|
var currentTerm = await db.AcademicTerms
|
|
.AsNoTracking()
|
|
.Where(x => x.IsCurrent)
|
|
.Select(x => new { x.Id, x.Name, x.StartDate, x.EndDate })
|
|
.FirstOrDefaultAsync(cancellationToken);
|
|
|
|
return new
|
|
{
|
|
CurrentTerm = currentTerm,
|
|
Counts = new
|
|
{
|
|
Campuses = await db.Campuses.CountAsync(cancellationToken),
|
|
Colleges = await db.Colleges.CountAsync(cancellationToken),
|
|
Majors = await db.Majors.CountAsync(cancellationToken),
|
|
Classes = await db.AdministrativeClasses.CountAsync(cancellationToken),
|
|
Classrooms = await db.Classrooms.CountAsync(cancellationToken),
|
|
Teachers = await db.Teachers.CountAsync(cancellationToken),
|
|
Students = await db.Students.CountAsync(cancellationToken),
|
|
Courses = await db.Courses.CountAsync(cancellationToken),
|
|
CurriculumPlans = await db.CurriculumPlans.CountAsync(cancellationToken),
|
|
TeachingTasks = await db.TeachingTasks.CountAsync(cancellationToken),
|
|
SchedulePlans = await db.SchedulePlans.CountAsync(cancellationToken),
|
|
CourseSelectionRounds = await db.CourseSelectionRounds
|
|
.CountAsync(cancellationToken),
|
|
CourseSelectionOfferings = await db.CourseSelectionOfferings
|
|
.CountAsync(cancellationToken),
|
|
CourseEnrollments = await db.CourseEnrollments
|
|
.CountAsync(
|
|
x => x.Status == CourseEnrollmentStatus.Enrolled,
|
|
cancellationToken),
|
|
GradeSheets = await db.GradeSheets.CountAsync(cancellationToken),
|
|
PublishedGradeSheets = await db.GradeSheets.CountAsync(
|
|
x => x.Status == GradeSheetStatus.Published,
|
|
cancellationToken),
|
|
GradeRecords = await db.GradeRecords.CountAsync(cancellationToken),
|
|
ExamPlans = await db.ExamPlans.CountAsync(cancellationToken),
|
|
ExamSessions = await db.ExamSessions.CountAsync(cancellationToken),
|
|
Users = await db.Users.CountAsync(cancellationToken)
|
|
}
|
|
};
|
|
}
|
|
}
|