1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-21 20:33:01 +08:00

Move dates fill into it's own method

This commit is contained in:
Andrei Zavatski 2020-11-22 02:25:12 +03:00
parent d4b56aac84
commit 3cb1d04667

View File

@ -44,8 +44,16 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
if (values?.Length > 1) if (values?.Length > 1)
{ {
// Fill dates with 0 count chart.Values = fillZeroValues(values);
Show();
return;
}
Hide();
}
private UserHistoryCount[] fillZeroValues(UserHistoryCount[] values)
{
var newValues = new List<UserHistoryCount> { values[0] }; var newValues = new List<UserHistoryCount> { values[0] };
var newLast = values[0]; var newLast = values[0];
@ -63,18 +71,13 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
newValues.Add(newLast = values[i]); newValues.Add(newLast = values[i]);
} }
return newValues.ToArray();
static bool hasMissingDates(UserHistoryCount prev, UserHistoryCount current) static bool hasMissingDates(UserHistoryCount prev, UserHistoryCount current)
{ {
var possibleCurrent = prev.Date.AddMonths(1); var possibleCurrent = prev.Date.AddMonths(1);
return possibleCurrent != current.Date; return possibleCurrent != current.Date;
} }
chart.Values = newValues.ToArray();
Show();
return;
}
Hide();
} }
protected abstract UserHistoryCount[] GetValues(User user); protected abstract UserHistoryCount[] GetValues(User user);