Removed a useless branch in the statistics request

This commit is contained in:
tornac1234 2022-05-30 23:23:54 +02:00
parent bc1b20291b
commit 80fa90f65d
1 changed files with 11 additions and 32 deletions

View File

@ -71,7 +71,7 @@ private void load(IAPIProvider provider, OsuConfigManager config)
activity.BindTo(u.NewValue.Activity);
}, true);
ruleset.BindValueChanged(_ => requestUserRulesetsRankings());
ruleset.BindValueChanged(_ => updateStatus());
status.BindValueChanged(_ => updateStatus());
activity.BindValueChanged(_ => updateStatus());
privacyMode.BindValueChanged(_ => updateStatus());
@ -129,9 +129,6 @@ private void requestUserRulesetsRankings()
{
RulesetInfo cachedRuleset = ruleset.Value;
// When first logging in, we can't send a request with an empty id
if (api.LocalUser.Value.Id > 1)
{
var req = new GetUsersRequest(new int[] { api.LocalUser.Value.Id });
req.Success += result =>
{
@ -147,24 +144,6 @@ private void requestUserRulesetsRankings()
api.Queue(req);
}
else
{
var req = new GetUserRequest(api.LocalUser.Value.Username, ruleset.Value);
req.Success += result =>
{
user.Value.RulesetsStatistics ??= new Dictionary<string, UserStatistics>();
user.Value.RulesetsStatistics[ruleset.Value.ShortName] = result.Statistics;
updateStatus();
};
req.Failure += error =>
{
updateStatus();
};
api.Queue(req);
}
}
private static readonly int ellipsis_length = Encoding.UTF8.GetByteCount(new[] { '…' });