mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 15:33:05 +08:00
Fix news sidebar assuming returned posts are always from given year
This commit is contained in:
parent
4cad5890c6
commit
b8184a3005
@ -56,19 +56,17 @@ namespace osu.Game.Overlays.News.Sidebar
|
||||
if (allPosts?.Any() != true)
|
||||
return;
|
||||
|
||||
var lookup = metadata.NewValue.NewsPosts.ToLookup(post => post.PublishedAt.Month);
|
||||
var lookup = metadata.NewValue.NewsPosts.ToLookup(post => (post.PublishedAt.Month, post.PublishedAt.Year));
|
||||
|
||||
var keys = lookup.Select(kvp => kvp.Key);
|
||||
var sortedKeys = keys.OrderByDescending(k => k).ToList();
|
||||
|
||||
int year = metadata.NewValue.CurrentYear;
|
||||
var sortedKeys = keys.OrderByDescending(k => k.Year).ThenByDescending(k => k.Month).ToList();
|
||||
|
||||
for (int i = 0; i < sortedKeys.Count; i++)
|
||||
{
|
||||
int month = sortedKeys[i];
|
||||
var posts = lookup[month];
|
||||
var key = sortedKeys[i];
|
||||
var posts = lookup[key];
|
||||
|
||||
monthsFlow.Add(new MonthSection(month, year, posts)
|
||||
monthsFlow.Add(new MonthSection(key.Month, key.Year, posts)
|
||||
{
|
||||
Expanded = { Value = i == 0 }
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user