1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 16:02:55 +08:00

Rename confusing variable

This commit is contained in:
Dean Herbert 2021-10-19 11:37:46 +09:00
parent 30af27e561
commit ff2eae4597
2 changed files with 10 additions and 10 deletions

View File

@ -123,15 +123,15 @@ namespace osu.Game.Beatmaps
// check if a set already exists with the same online id, delete if it does.
if (beatmapSet.OnlineBeatmapSetID != null)
{
var existingOnlineId = beatmaps.ConsumableItems.FirstOrDefault(b => b.OnlineBeatmapSetID == beatmapSet.OnlineBeatmapSetID);
var existingSetWithSameOnlineID = beatmaps.ConsumableItems.FirstOrDefault(b => b.OnlineBeatmapSetID == beatmapSet.OnlineBeatmapSetID);
if (existingOnlineId != null)
if (existingSetWithSameOnlineID != null)
{
Delete(existingOnlineId);
Delete(existingSetWithSameOnlineID);
// in order to avoid a unique key constraint, immediately remove the online ID from the previous set.
existingOnlineId.OnlineBeatmapSetID = null;
foreach (var b in existingOnlineId.Beatmaps)
existingSetWithSameOnlineID.OnlineBeatmapSetID = null;
foreach (var b in existingSetWithSameOnlineID.Beatmaps)
b.OnlineBeatmapID = null;
LogForModel(beatmapSet, $"Found existing beatmap set with same OnlineBeatmapSetID ({beatmapSet.OnlineBeatmapSetID}). It has been deleted.");

View File

@ -93,14 +93,14 @@ namespace osu.Game.Stores
if (beatmapSet.OnlineID > -1)
{
var existingOnlineId = realm.All<RealmBeatmapSet>().SingleOrDefault(b => b.OnlineID == beatmapSet.OnlineID);
var existingSetWithSameOnlineID = realm.All<RealmBeatmapSet>().SingleOrDefault(b => b.OnlineID == beatmapSet.OnlineID);
if (existingOnlineId != null)
if (existingSetWithSameOnlineID != null)
{
existingOnlineId.DeletePending = true;
existingOnlineId.OnlineID = -1;
existingSetWithSameOnlineID.DeletePending = true;
existingSetWithSameOnlineID.OnlineID = -1;
foreach (var b in existingOnlineId.Beatmaps)
foreach (var b in existingSetWithSameOnlineID.Beatmaps)
b.OnlineID = -1;
LogForModel(beatmapSet, $"Found existing beatmap set with same OnlineID ({beatmapSet.OnlineID}). It will be deleted.");