Skip to content

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

Open
wants to merge 1 commit into
base: v2-development
Choose a base branch
from

Conversation

deyordanov
Copy link

Comment on lines +13 to +35
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,
};
Copy link
Collaborator

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)
Copy link
Collaborator

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();
Copy link
Collaborator

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.

Comment on lines +132 to +142
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);
Copy link
Collaborator

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>()
Copy link
Collaborator

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?

Comment on lines +25 to +26
private readonly string archiveOldSubmissionsWithLimitCronExpression = Cron.Yearly(1, 1, 2, 30);
private readonly string hardDeleteArchivedSubmissionsCronExpression = Cron.Yearly(1, 1, 2, 30);
Copy link
Collaborator

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..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants