Implement comprehensive academic statistics and refresh workflows

This commit is contained in:
biss committed 2026-08-17 11:20:16 +08:00
1 parent b6dfdbfbbf
commit b4e5663c28
10 files changed
+7329 -22

No files matched your search

@@ -743,6 +743,8 @@ public sealed class SchedulesController(
job.ProcessedTasks,
job.CreatedEntries,
job.CompletedTasks,
job.CurrentGeneration,
job.TotalGenerations,
messages,
job.ErrorMessage,
job.CreatedAt,
@@ -802,6 +804,8 @@ public sealed record AutomaticScheduleJobResponse(
int ProcessedTasks,
int CreatedEntries,
int CompletedTasks,
int CurrentGeneration,
int TotalGenerations,
IReadOnlyList<string> Messages,
string? ErrorMessage,
DateTime CreatedAt,
@@ -136,6 +136,8 @@ public sealed class AutomaticScheduleJob : EntityBase
public int ProcessedTasks { get; set; }
public int CreatedEntries { get; set; }
public int CompletedTasks { get; set; }
public int CurrentGeneration { get; set; }
public int TotalGenerations { get; set; }
public string? MessagesJson { get; set; }
public string? ErrorMessage { get; set; }
public DateTime? StartedAt { get; set; }
@@ -116,6 +116,8 @@ public sealed class DevelopmentSqliteMigrator(
"20260817_60_schedule_genetic_preferences";
private const string ScheduleGeneticSearchSettingsMigration =
"20260817_61_schedule_genetic_search_settings";
private const string AutomaticScheduleGeneticProgressMigration =
"20260817_62_automatic_schedule_genetic_progress";
public async Task MigrateAsync(CancellationToken cancellationToken = default)
{
@@ -830,6 +832,21 @@ public sealed class DevelopmentSqliteMigrator(
ScheduleGeneticSearchSettingsMigration,
geneticSearchSettingStatements,
cancellationToken);
var automaticScheduleJobColumns = (await db.Database.SqlQueryRaw<string>(
"SELECT name AS \"Value\" FROM pragma_table_info('AutomaticScheduleJobs')")
.ToListAsync(cancellationToken))
.ToHashSet(StringComparer.OrdinalIgnoreCase);
var automaticScheduleGeneticProgressStatements = new List<string>();
if (!automaticScheduleJobColumns.Contains("CurrentGeneration"))
automaticScheduleGeneticProgressStatements.Add(
AutomaticScheduleGeneticProgressStatements[0]);
if (!automaticScheduleJobColumns.Contains("TotalGenerations"))
automaticScheduleGeneticProgressStatements.Add(
AutomaticScheduleGeneticProgressStatements[1]);
await ApplyMigrationAsync(
AutomaticScheduleGeneticProgressMigration,
automaticScheduleGeneticProgressStatements,
cancellationToken);
}
private async Task ApplyMigrationAsync(
@@ -3316,6 +3333,12 @@ public sealed class DevelopmentSqliteMigrator(
"ALTER TABLE \"ScheduleOptimizationSettings\" ADD COLUMN \"GeneticMutationRatePercent\" INTEGER NOT NULL DEFAULT 12;"
];
private static readonly string[] AutomaticScheduleGeneticProgressStatements =
[
"ALTER TABLE \"AutomaticScheduleJobs\" ADD COLUMN \"CurrentGeneration\" INTEGER NOT NULL DEFAULT 0;",
"ALTER TABLE \"AutomaticScheduleJobs\" ADD COLUMN \"TotalGenerations\" INTEGER NOT NULL DEFAULT 0;"
];
private static readonly string[] ReusableCourseGroupsStatements =
[
"""
Loaded 3 of 10 files, more files were not shown because too many files have changed in this diff. Show more