-
Notifications
You must be signed in to change notification settings - Fork 12
Added submissions archives. #1656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v2-development
Are you sure you want to change the base?
Conversation
public static Expression<Func<Submission, ArchivedSubmission>> FromSubmission => | ||
submission => new ArchivedSubmission | ||
{ | ||
Id = submission.Id, | ||
ParticipantId = submission.ParticipantId, | ||
ProblemId = submission.ProblemId, | ||
SubmissionTypeId = submission.SubmissionTypeId, | ||
Content = submission.Content, | ||
FileExtension = submission.FileExtension, | ||
SolutionSkeleton = submission.SolutionSkeleton, | ||
StartedExecutionOn = submission.StartedExecutionOn, | ||
CompletedExecutionOn = submission.CompletedExecutionOn, | ||
IpAddress = submission.IpAddress, | ||
WorkerName = submission.WorkerName, | ||
ExceptionType = submission.ExceptionType, | ||
Processed = submission.Processed, | ||
Points = submission.Points, | ||
ProcessingComment = submission.ProcessingComment, | ||
TestRunsCache = submission.TestRunsCache, | ||
CreatedOn = submission.CreatedOn, | ||
ModifiedOn = submission.ModifiedOn, | ||
IsHardDeletedFromMainDatabase = false, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure it has all the properties.. legacy and alpha might have slight differences already.
@@ -34,6 +34,7 @@ public static void Main(string[] args) | |||
.AddTransient(typeof(IDataService<>), typeof(DataService<>)) | |||
.AddTransient<ITransactionsProvider, TransactionsProvider<OjsDbContext>>() | |||
.AddIdentityDatabase<OjsDbContext, UserProfile, Role, UserInRole>(configuration) | |||
.AddArchivesDatabase(configuration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now we don't need this db in ui
|
||
public async Task<int> ArchiveOldSubmissionsDailyBatch(int limit, int maxSubBatchSize) | ||
{ | ||
await this.archivesData.CreateDatabaseIfNotExists(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use MigrateDatabase
in Program.cs like for the OjsDbContext.
var submissionBatches = deleteCountLimit > 0 | ||
? this.archivesDataService | ||
.GetAllNotHardDeletedFromMainDatabase() | ||
.Distinct() | ||
.OrderBy(x => x.Id) | ||
.InSelfModifyingBatches(GlobalConstants.BatchOperationsChunkSize, deleteCountLimit) | ||
: this.archivesDataService | ||
.GetAllNotHardDeletedFromMainDatabase() | ||
.Distinct() | ||
.OrderBy(x => x.Id) | ||
.InSelfModifyingBatches(GlobalConstants.BatchOperationsChunkSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting is off
@@ -40,12 +40,14 @@ public static void ConfigureServices( | |||
.AddHttpClients(configuration) | |||
.AddTransient(typeof(IDataService<>), typeof(AdministrationDataService<>)) | |||
.AddTransient<ITransactionsProvider, TransactionsProvider<OjsDbContext>>() | |||
.AddTransient<IArchivesDataService, ArchivesDataService>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't this autoregistered?
private readonly string archiveOldSubmissionsWithLimitCronExpression = Cron.Yearly(1, 1, 2, 30); | ||
private readonly string hardDeleteArchivedSubmissionsCronExpression = Cron.Yearly(1, 1, 2, 30); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these jobs added? We don't need a job that executes once a year..
Closes https://github.com/SoftUni-Internal/exam-systems-issues/issues/1726