From af23c6d54114347b27dc6aed4ee552b748c62b28 Mon Sep 17 00:00:00 2001 From: Jason Dove <1695733+jasongdove@users.noreply.github.com> Date: Sat, 23 Aug 2025 07:51:04 -0500 Subject: [PATCH] copy watermark overrides when copying schedule (#2334) --- .../Commands/CopyProgramScheduleHandler.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ErsatzTV.Application/ProgramSchedules/Commands/CopyProgramScheduleHandler.cs b/ErsatzTV.Application/ProgramSchedules/Commands/CopyProgramScheduleHandler.cs index 2c988cd99..7b6cabd0d 100644 --- a/ErsatzTV.Application/ProgramSchedules/Commands/CopyProgramScheduleHandler.cs +++ b/ErsatzTV.Application/ProgramSchedules/Commands/CopyProgramScheduleHandler.cs @@ -49,6 +49,13 @@ public class DetachEntity(dbContext, item); item.ProgramScheduleId = 0; item.ProgramSchedule = schedule; + + foreach (ProgramScheduleItemWatermark watermark in item.ProgramScheduleItemWatermarks) + { + DetachEntity(dbContext, watermark); + watermark.ProgramScheduleItemId = 0; + watermark.ProgramScheduleItem = item; + } } await dbContext.ProgramSchedules.AddAsync(schedule, cancellationToken); @@ -71,6 +78,7 @@ public class dbContext.ProgramSchedules .AsNoTracking() .Include(ps => ps.Items) + .ThenInclude(ps => ps.ProgramScheduleItemWatermarks) .SelectOneAsync(p => p.Id, p => p.Id == request.ProgramScheduleId) .Map(o => o.ToValidation("Schedule does not exist."));