mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 11:42:54 +08:00
Rename confusing variable
This commit is contained in:
parent
30af27e561
commit
ff2eae4597
@ -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.");
|
||||
|
@ -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.");
|
||||
|
Loading…
Reference in New Issue
Block a user