Skip to content

Commit

Permalink
Manager: Fix weekly clears crash on week rollover
Browse files Browse the repository at this point in the history
  • Loading branch information
Sejsel committed May 13, 2024
1 parent cb0e797 commit 7f83197
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ArcdpsLogManager/Sections/WeeklyClears.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public class WeeklyClears : DynamicLayout
])
];

private Dictionary<IFinishableEncounter, EncounterCategory> CategoriesByEncounter = EncounterGroups
private static readonly Dictionary<IFinishableEncounter, EncounterCategory> CategoriesByEncounter = EncounterGroups
.SelectMany(group => group.Rows.SelectMany(row => row.Encounters.Select(encounter => (encounter, Id: group.Category))))
.ToDictionary(x => x.encounter, x => x.Id);

Expand Down Expand Up @@ -448,7 +448,9 @@ void UpdateCheckbox(WeeklyCheckBox checkBox, bool isChallengeMode)
};
}

weekGrid.DataStore = weeks;
var filteredWeeks = new FilterCollection<ResetWeek>(weeks);
filteredWeeks.Filter = week => week.Reset <= DateOnly.FromDateTime(DateTime.UtcNow);
weekGrid.DataStore = filteredWeeks;
weekGrid.SelectedRow = 0;

weekGrid.SelectionChanged += (_, _) =>
Expand Down Expand Up @@ -713,7 +715,7 @@ private static DateOnly GetResetBefore(DateTimeOffset time)
private static List<DateOnly> GetAllResets()
{
var resets = new List<DateOnly>();
var now = DateTimeOffset.Now;
var now = DateTimeOffset.Now + TimeSpan.FromDays(365 * 10);
do
{
resets.Add(GetResetBefore(now));
Expand Down

0 comments on commit 7f83197

Please sign in to comment.