Apply table filters on /tasks load (fixes #2660)

This commit is contained in:
Bernd Bestel 2025-01-31 16:33:55 +01:00
parent 56d8c2f13a
commit 11fdf5929a
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
3 changed files with 28 additions and 20 deletions

View File

@ -36,7 +36,7 @@
### Tasks
- xxx
- Fixed that set table filters were not applied after editing or adding a task
### Batteries

View File

@ -299,22 +299,22 @@ RefreshContextualTimeago = function(rootSelector = "#page-content")
if (!element.hasAttr("datetime"))
{
element.text("")
return
element.text("");
return;
}
var timestamp = element.attr("datetime");
if (!timestamp || timestamp.length < 10)
{
element.text("")
return
element.text("");
return;
}
if (!moment(timestamp).isValid())
{
element.text("")
return
element.text("");
return;
}
var isNever = timestamp && timestamp.substring(0, 10) == "2999-12-31";

View File

@ -199,20 +199,23 @@ function RefreshStatistics()
result.forEach(element =>
{
var date = moment(element.due_date + " 23:59:59").endOf("day");
if (element.due_date)
{
var date = moment(element.due_date + " 23:59:59").endOf("day");
if (date.isSameOrBefore(overdueThreshold))
{
overdueCount++;
}
else if (date.isSameOrBefore(todayThreshold))
{
dueTodayCount++;
dueSoonCount++;
}
else if (date.isSameOrBefore(nextXDaysThreshold))
{
dueSoonCount++;
if (date.isSameOrBefore(overdueThreshold))
{
overdueCount++;
}
else if (date.isSameOrBefore(todayThreshold))
{
dueTodayCount++;
dueSoonCount++;
}
else if (date.isSameOrBefore(nextXDaysThreshold))
{
dueSoonCount++;
}
}
});
@ -228,3 +231,8 @@ function RefreshStatistics()
}
RefreshStatistics();
// Apply filters (there are maybe some set when a task was just edited)
$("#search").trigger("keyup");
$("#status-filter").trigger("change");
$("#category-filter").trigger("change");