教师成绩报告
This commit is contained in:
@@ -68,6 +68,10 @@ public sealed class AppDbContext(DbContextOptions<AppDbContext> options)
|
||||
public DbSet<GradeItemScore> GradeItemScores => Set<GradeItemScore>();
|
||||
public DbSet<CourseGradeStatistic> CourseGradeStatistics =>
|
||||
Set<CourseGradeStatistic>();
|
||||
public DbSet<TeachingTaskGradeStatistic> TeachingTaskGradeStatistics =>
|
||||
Set<TeachingTaskGradeStatistic>();
|
||||
public DbSet<TeachingTaskGradeScoreBand> TeachingTaskGradeScoreBands =>
|
||||
Set<TeachingTaskGradeScoreBand>();
|
||||
public DbSet<CourseGradeStatisticsRefreshJob> CourseGradeStatisticsRefreshJobs =>
|
||||
Set<CourseGradeStatisticsRefreshJob>();
|
||||
public DbSet<OtherExamBatch> OtherExamBatches => Set<OtherExamBatch>();
|
||||
@@ -868,6 +872,46 @@ public sealed class AppDbContext(DbContextOptions<AppDbContext> options)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
builder.Entity<TeachingTaskGradeStatistic>(entity =>
|
||||
{
|
||||
entity.Property(x => x.HighestScore).HasPrecision(5, 1);
|
||||
entity.Property(x => x.AverageScore).HasPrecision(5, 1);
|
||||
entity.Property(x => x.MedianScore).HasPrecision(5, 1);
|
||||
entity.Property(x => x.LowestScore).HasPrecision(5, 1);
|
||||
entity.Property(x => x.StandardDeviation).HasPrecision(6, 2);
|
||||
entity.Property(x => x.PassRate).HasPrecision(5, 2);
|
||||
entity.Property(x => x.ExcellentRate).HasPrecision(5, 2);
|
||||
entity.HasIndex(x => x.GradeSheetId).IsUnique();
|
||||
entity.HasIndex(x => x.TeachingTaskId).IsUnique();
|
||||
entity.HasIndex(x => new { x.CourseId, x.AcademicTermId });
|
||||
entity.HasOne(x => x.GradeSheet).WithOne()
|
||||
.HasForeignKey<TeachingTaskGradeStatistic>(x => x.GradeSheetId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
entity.HasOne(x => x.TeachingTask).WithOne()
|
||||
.HasForeignKey<TeachingTaskGradeStatistic>(x => x.TeachingTaskId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
entity.HasOne<Course>().WithMany().HasForeignKey(x => x.CourseId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
entity.HasOne<AcademicTerm>().WithMany().HasForeignKey(x => x.AcademicTermId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
builder.Entity<TeachingTaskGradeScoreBand>(entity =>
|
||||
{
|
||||
entity.Property(x => x.Label).HasMaxLength(30);
|
||||
entity.Property(x => x.LowerBound).HasPrecision(5, 1);
|
||||
entity.Property(x => x.UpperBound).HasPrecision(5, 1);
|
||||
entity.HasIndex(x => new
|
||||
{
|
||||
x.TeachingTaskGradeStatisticId,
|
||||
x.SortOrder
|
||||
}).IsUnique();
|
||||
entity.HasOne(x => x.TeachingTaskGradeStatistic)
|
||||
.WithMany(x => x.ScoreBands)
|
||||
.HasForeignKey(x => x.TeachingTaskGradeStatisticId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
builder.Entity<CourseGradeStatisticsRefreshJob>(entity =>
|
||||
{
|
||||
entity.Property(x => x.ErrorMessage).HasMaxLength(2000);
|
||||
|
||||
Reference in New Issue
Block a user