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,18 +433,21 @@ 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();
await IWatchStatusRepository.OnShowStatusChanged( if (!skipStatusUpdate)
new() {
{ await IWatchStatusRepository.OnShowStatusChanged(
User = await users.Get(ret.UserId), new()
Resource = await shows.Get(ret.ShowId), {
Status = ret.Status, User = await users.Get(ret.UserId),
WatchedTime = ret.WatchedTime, Resource = await shows.Get(ret.ShowId),
WatchedPercent = ret.WatchedPercent, Status = ret.Status,
AddedDate = ret.AddedDate, WatchedTime = ret.WatchedTime,
PlayedDate = ret.PlayedDate, WatchedPercent = ret.WatchedPercent,
} AddedDate = ret.AddedDate,
); 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;
} }