Disable show update rabbit message when updating an episode

This commit is contained in:
Zoe Roux 2024-03-23 15:33:39 +01:00
parent 7905edaf24
commit f89ce7a965
No known key found for this signature in database

View File

@ -77,7 +77,12 @@ public class WatchStatusRepository(
.Select(x => x.UserId) .Select(x => x.UserId)
.ToListAsync(); .ToListAsync();
foreach (Guid userId in users) foreach (Guid userId in users)
await repo._SetShowStatus(ep.ShowId, userId, WatchStatus.Watching, true); await repo._SetShowStatus(
ep.ShowId,
userId,
WatchStatus.Watching,
newEpisode: true
);
}; };
} }
@ -316,7 +321,8 @@ public class WatchStatusRepository(
Guid showId, Guid showId,
Guid userId, Guid userId,
WatchStatus status, WatchStatus status,
bool newEpisode = false bool newEpisode = false,
bool skipStatusUpdate = false
) )
{ {
int unseenEpisodeCount = int unseenEpisodeCount =
@ -427,6 +433,8 @@ public class WatchStatusRepository(
.ShowWatchStatus.Upsert(ret) .ShowWatchStatus.Upsert(ret)
.UpdateIf(x => status != Watching || x.Status != Completed || newEpisode) .UpdateIf(x => status != Watching || x.Status != Completed || newEpisode)
.RunAsync(); .RunAsync();
if (!skipStatusUpdate)
{
await IWatchStatusRepository.OnShowStatusChanged( await IWatchStatusRepository.OnShowStatusChanged(
new() new()
{ {
@ -439,6 +447,7 @@ public class WatchStatusRepository(
PlayedDate = ret.PlayedDate, PlayedDate = ret.PlayedDate,
} }
); );
}
return ret; return ret;
} }
@ -532,7 +541,7 @@ public class WatchStatusRepository(
PlayedDate = ret.PlayedDate, PlayedDate = ret.PlayedDate,
} }
); );
await SetShowStatus(episode.ShowId, userId, WatchStatus.Watching); await _SetShowStatus(episode.ShowId, userId, WatchStatus.Watching, skipStatusUpdate: true);
return ret; return ret;
} }