Skip to content

Commit

Permalink
only auto-remove non-manually added rosters and not turn 20
Browse files Browse the repository at this point in the history
  • Loading branch information
dlidstrom committed Apr 29, 2023
1 parent 386c11c commit a9349a7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Snittlistan.Web/Areas/V2/Controllers/RosterController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ public ActionResult Create(CreateRosterViewModel vm)
vm.Opponent,
ParseDate(vm.Date),
vm.IsFourPlayer,
new OilPatternInformation(vm.OilPatternName!, vm.OilPatternUrl!));
new OilPatternInformation(vm.OilPatternName!, vm.OilPatternUrl!))
{
ManuallyAdded = true
};
CompositionRoot.DocumentSession.Store(roster);
return RedirectToAction("Index");
}
Expand Down
1 change: 1 addition & 0 deletions Snittlistan.Web/Areas/V2/Domain/Roster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public string? TeamLevel
public List<AuditLogEntry> AuditLogEntries { get; }
public int Version => AuditLogEntries.Count;
public bool Preliminary { get; set; }
public bool ManuallyAdded { get; set; }

public List<string> Players { get; set; } = new List<string>();

Expand Down
3 changes: 2 additions & 1 deletion Snittlistan.Web/Commands/GetRostersFromBitsCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ public override async Task Handle(HandlerContext<Command> context)
Roster[] toRemove = rosters
.Where(x => foundMatchIds.Contains(x.BitsMatchId) == false
&& x.MatchResultId is null
&& x.Turn <= 20)
&& x.Turn < 20
&& x.ManuallyAdded == false)
.ToArray();
if (toRemove.Any())
{
Expand Down

0 comments on commit a9349a7

Please sign in to comment.