Skip to content

Commit

Permalink
Fix cumulative time sort on enrollment report
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-bstein committed Feb 17, 2025
1 parent c7f895a commit 9280a14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ await _store
.Where(b => b.Id == exportBatchId)
.ExecuteDeleteAsync(cancellationToken);

if (File.Exists(GetExportBatchPackagePath(exportBatchId)))
var packagePath = GetExportBatchPackagePath(exportBatchId);
if (File.Exists(packagePath))
{
File.Delete(GetExportBatchPackagePath(exportBatchId));
File.Delete(packagePath);
}
}

Expand Down Expand Up @@ -396,18 +397,16 @@ public async Task<ImportedGame[]> ImportPackage(byte[] package, CancellationToke

using (var tempArchiveStream = File.OpenRead(tempArchivePath))
{
using (var reader = ReaderFactory.Open(tempArchiveStream))
using var reader = ReaderFactory.Open(tempArchiveStream);
while (reader.MoveToNextEntry())
{
while (reader.MoveToNextEntry())
if (!reader.Entry.IsDirectory)
{
if (!reader.Entry.IsDirectory)
reader.WriteEntryToDirectory(GetImportBatchRoot(importBatchId), new ExtractionOptions()
{
reader.WriteEntryToDirectory(GetImportBatchRoot(importBatchId), new ExtractionOptions()
{
ExtractFullPath = true,
Overwrite = true
});
}
ExtractFullPath = true,
Overwrite = true
});
}
}
}
Expand Down Expand Up @@ -585,12 +584,7 @@ await _store.SaveAddRange

await _store.SaveAddRange(importedGames);

return importedGames.Select(g => new ImportedGame
{
Id = g.Id,
Name = g.Name
})
.ToArray();
return [.. importedGames.Select(g => new ImportedGame { Id = g.Id, Name = g.Name })];
}

private string GetExportBatchPackageName(string exportBatchId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public async Task<ReportResults<EnrollmentReportRecord>> Handle(EnrollmentReport
records = records.Sort(r => r.Game.Name, sortDirection);
break;
case "time":
records = records.Sort(r => r.PlayTime, sortDirection);
records = records.Sort(r => r.PlayTime.DurationMs, sortDirection);
break;
}

Expand Down

0 comments on commit 9280a14

Please sign in to comment.