Speedup the signoff report by short circuiting when the first task not on today is found

This commit is contained in:
Campbell Alden 2024-12-23 18:09:10 +09:00
parent c6942468b2
commit 154793ccbe
2 changed files with 28 additions and 26 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "day-reporter" name = "day-reporter"
version = "1.4.0" version = "1.4.1"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -12,9 +12,8 @@ to.setHours(23);
to.setMinutes(59); to.setMinutes(59);
to.setSeconds(59); to.setSeconds(59);
logbook.filter(task => { for (const todo of logbook) {
return task.completionDate() >= from && task.completionDate() < to; if(todo.completionDate() >= from && todo.completionDate() < to) {
}).forEach(todo => {
var proj = todo.project(); var proj = todo.project();
var tags = []; var tags = [];
if (proj) { if (proj) {
@ -37,6 +36,9 @@ logbook.filter(task => {
area: area && { id: area.id(), title: area.name() }, area: area && { id: area.id(), title: area.name() },
tags: [...tags, ...todo.tagNames().split(', ')].filter(t => t), tags: [...tags, ...todo.tagNames().split(', ')].filter(t => t),
}); });
}); } else {
break;
}
}
return JSON.stringify(objs, undefined, 2); return JSON.stringify(objs, undefined, 2);