Check if a user exists before creating new user

This commit is contained in:
David Zhao 2019-02-25 13:58:19 +09:00
parent 809ab86ed0
commit 8da671fa6c

View File

@ -109,15 +109,27 @@ namespace osu.Game.Scoring
public string UserString
{
get => User?.Username;
set => User = new User { Username = value, Id = UserID};
set
{
if (User == null)
User = new User { Username = value, Id = UserID };
else
User.Username = value;
}
}
[JsonIgnore]
[Column("UserID")]
public long UserID
{
get => User?.Id ?? 1;
set => User = new User {Username = UserString, Id = value};
get => User.Id;
set
{
if (User == null)
User = new User { Username = UserString, Id = value };
else
User.Id = value;
}
}
[JsonIgnore]