Skip to content

Commit

Permalink
Fix autotags bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-bstein committed Sep 20, 2024
1 parent d11246e commit 17225e9
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/Gameboard.Api/Features/Ticket/TicketService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,17 @@ internal IEnumerable<string> TransformTicketLabels(string labels)

private async Task UpdatedSessionContext(Data.Ticket entity)
{
var autoTags = await _autoTagService.GetAutoTags(entity, CancellationToken.None);
var finalTags = new List<string>(entity.Label.Split(LABELS_DELIMITER, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries));

foreach (var autoTag in autoTags)
{
if (!finalTags.Contains(autoTag))
{
finalTags.Add(autoTag.Trim());
}
}

if (!entity.ChallengeId.IsEmpty())
{
var challenge = await _store
Expand All @@ -485,7 +496,6 @@ private async Task UpdatedSessionContext(Data.Ticket entity)
{
entity.TeamId = challenge.TeamId;
entity.PlayerId = challenge.PlayerId;
entity.Label = string.Empty;
return;
}
}
Expand All @@ -504,17 +514,6 @@ private async Task UpdatedSessionContext(Data.Ticket entity)
}
}

var autoTags = await _autoTagService.GetAutoTags(entity, CancellationToken.None);
var finalTags = new List<string>(entity.Label.Split(LABELS_DELIMITER, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries));

foreach (var autoTag in autoTags)
{
if (!finalTags.Contains(autoTag))
{
finalTags.Add(autoTag);
}
}

entity.Label = string.Join(LABELS_DELIMITER, finalTags);
entity.TeamId = null;
entity.ChallengeId = null;
Expand Down

0 comments on commit 17225e9

Please sign in to comment.