Fix tasks being unscheduled if the day for the task already exists

This commit is contained in:
Vyn 2024-10-16 11:04:30 +02:00
parent dee7a6fa42
commit 3e7c9b150a
6 changed files with 26 additions and 6 deletions

View file

@ -63,12 +63,15 @@ void View::update()
for (auto day : source->getDays()) {
// day's tasks
auto sourceTasks = day.tasks() | std::ranges::views::filter([&](const Task &task) {
if (day.date() >= todayDate) {
return true;
}
if (shouldHideCompletedTasks()) {
return task.checked() == false;
}
return true;
});
if (std::ranges::distance(sourceTasks) > 0) {
if (day.date() >= todayDate || std::ranges::distance(sourceTasks) > 0) {
if (!dates.contains(day.date())) {
dates.insert_or_assign(day.date(), DateView{});
@ -85,7 +88,7 @@ void View::update()
}).has_value();
});
if (std::ranges::distance(sourceEvents) > 0) {
if (day.date() >= todayDate || std::ranges::distance(sourceEvents) > 0) {
if (!dates.contains(day.date())) {
dates.insert_or_assign(day.date(), DateView{});
}