Browse Source

fix overlapping playout items check (#2303)

pull/2304/head
Jason Dove 5 days ago committed by GitHub
parent
commit
b149f7f2a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 13
      ErsatzTV.Application/Playouts/Queries/CheckForOverlappingPlayoutItemsHandler.cs

13
ErsatzTV.Application/Playouts/Queries/CheckForOverlappingPlayoutItemsHandler.cs

@ -15,11 +15,14 @@ public class CheckForOverlappingPlayoutItemsHandler(
bool hasConflict = await dbContext.PlayoutItems bool hasConflict = await dbContext.PlayoutItems
.Where(pi => pi.PlayoutId == request.PlayoutId) .Where(pi => pi.PlayoutId == request.PlayoutId)
.AnyAsync(a => dbContext.PlayoutItems .AnyAsync(
.Any(b => a => dbContext.PlayoutItems
a.Id < b.Id && .Where(b => b.PlayoutId == a.PlayoutId)
a.Start < b.Finish && .Any(
a.Finish > b.Start), b =>
a.Id < b.Id &&
a.Start < b.Finish &&
a.Finish > b.Start),
cancellationToken); cancellationToken);
if (hasConflict) if (hasConflict)

Loading…
Cancel
Save