排课优化 #3
No files matched your search
@@ -743,6 +743,8 @@ public sealed class SchedulesController(
|
|||||||
job.ProcessedTasks,
|
job.ProcessedTasks,
|
||||||
job.CreatedEntries,
|
job.CreatedEntries,
|
||||||
job.CompletedTasks,
|
job.CompletedTasks,
|
||||||
|
job.CurrentGeneration,
|
||||||
|
job.TotalGenerations,
|
||||||
messages,
|
messages,
|
||||||
job.ErrorMessage,
|
job.ErrorMessage,
|
||||||
job.CreatedAt,
|
job.CreatedAt,
|
||||||
@@ -802,6 +804,8 @@ public sealed record AutomaticScheduleJobResponse(
|
|||||||
int ProcessedTasks,
|
int ProcessedTasks,
|
||||||
int CreatedEntries,
|
int CreatedEntries,
|
||||||
int CompletedTasks,
|
int CompletedTasks,
|
||||||
|
int CurrentGeneration,
|
||||||
|
int TotalGenerations,
|
||||||
IReadOnlyList<string> Messages,
|
IReadOnlyList<string> Messages,
|
||||||
string? ErrorMessage,
|
string? ErrorMessage,
|
||||||
DateTime CreatedAt,
|
DateTime CreatedAt,
|
||||||
|
|||||||
@@ -136,6 +136,8 @@ public sealed class AutomaticScheduleJob : EntityBase
|
|||||||
public int ProcessedTasks { get; set; }
|
public int ProcessedTasks { get; set; }
|
||||||
public int CreatedEntries { get; set; }
|
public int CreatedEntries { get; set; }
|
||||||
public int CompletedTasks { get; set; }
|
public int CompletedTasks { get; set; }
|
||||||
|
public int CurrentGeneration { get; set; }
|
||||||
|
public int TotalGenerations { get; set; }
|
||||||
public string? MessagesJson { get; set; }
|
public string? MessagesJson { get; set; }
|
||||||
public string? ErrorMessage { get; set; }
|
public string? ErrorMessage { get; set; }
|
||||||
public DateTime? StartedAt { get; set; }
|
public DateTime? StartedAt { get; set; }
|
||||||
|
|||||||
@@ -116,6 +116,8 @@ public sealed class DevelopmentSqliteMigrator(
|
|||||||
"20260817_60_schedule_genetic_preferences";
|
"20260817_60_schedule_genetic_preferences";
|
||||||
private const string ScheduleGeneticSearchSettingsMigration =
|
private const string ScheduleGeneticSearchSettingsMigration =
|
||||||
"20260817_61_schedule_genetic_search_settings";
|
"20260817_61_schedule_genetic_search_settings";
|
||||||
|
private const string AutomaticScheduleGeneticProgressMigration =
|
||||||
|
"20260817_62_automatic_schedule_genetic_progress";
|
||||||
|
|
||||||
public async Task MigrateAsync(CancellationToken cancellationToken = default)
|
public async Task MigrateAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
@@ -830,6 +832,21 @@ public sealed class DevelopmentSqliteMigrator(
|
|||||||
ScheduleGeneticSearchSettingsMigration,
|
ScheduleGeneticSearchSettingsMigration,
|
||||||
geneticSearchSettingStatements,
|
geneticSearchSettingStatements,
|
||||||
cancellationToken);
|
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(
|
private async Task ApplyMigrationAsync(
|
||||||
@@ -3316,6 +3333,12 @@ public sealed class DevelopmentSqliteMigrator(
|
|||||||
"ALTER TABLE \"ScheduleOptimizationSettings\" ADD COLUMN \"GeneticMutationRatePercent\" INTEGER NOT NULL DEFAULT 12;"
|
"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 =
|
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
Reference in new issue
Block a user