Skip to content

Commit

Permalink
fix part to CSV command
Browse files Browse the repository at this point in the history
  • Loading branch information
OliBomby committed Jul 29, 2023
1 parent 6966cad commit 5ec2e09
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions osu-collaboration-bot/Commands/PartModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -422,18 +422,18 @@ public async Task ToCSV([RequireProjectMember][Autocomplete(typeof(ProjectAutoco

parts.Sort();

FileHandlingService.PartRecord selector(Part o) => new() {
async Task<FileHandlingService.PartRecord> selector(Part o) => new() {
Name = o.Name,
Start = o.Start,
End = o.End,
Status = o.Status,
MapperNames = includeMappers ? string.Join(";", o.Assignments.Select(a => _resourceService.MemberAliasOrName(a.Member))) : null
MapperNames = includeMappers ? string.Join(";", await Task.WhenAll(o.Assignments.Select(async a => await _resourceService.MemberAliasOrName(a.Member)))) : null
};

await using var dataStream = new MemoryStream();
var writer = new StreamWriter(dataStream);
await using var csv = new CsvWriter(writer, CultureInfo.InvariantCulture);
await csv.WriteRecordsAsync(parts.Select(selector));
await csv.WriteRecordsAsync(await Task.WhenAll(parts.Select(selector)));

await writer.FlushAsync();
dataStream.Position = 0;
Expand Down

0 comments on commit 5ec2e09

Please sign in to comment.