Speedup the signoff report by short circuiting when the first task not on today is found
This commit is contained in:
parent
c6942468b2
commit
154793ccbe
2 changed files with 28 additions and 26 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -12,31 +12,33 @@ 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) {
|
tags.push(...proj.tagNames().split(', '));
|
||||||
tags.push(...proj.tagNames().split(', '));
|
}
|
||||||
|
var area = todo.area() || proj && proj.area();
|
||||||
|
objs.push({
|
||||||
|
id: todo.id(),
|
||||||
|
title: todo.name(),
|
||||||
|
notes: todo.notes() || null,
|
||||||
|
status: todo.status(),
|
||||||
|
completion_date: todo.completionDate(),
|
||||||
|
project: proj && {
|
||||||
|
id: proj.id(),
|
||||||
|
title: proj.name(),
|
||||||
|
status: proj.status(),
|
||||||
|
notes: proj.notes(),
|
||||||
|
tags: proj.tagNames().split(', '),
|
||||||
|
},
|
||||||
|
area: area && { id: area.id(), title: area.name() },
|
||||||
|
tags: [...tags, ...todo.tagNames().split(', ')].filter(t => t),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
var area = todo.area() || proj && proj.area();
|
}
|
||||||
objs.push({
|
|
||||||
id: todo.id(),
|
|
||||||
title: todo.name(),
|
|
||||||
notes: todo.notes() || null,
|
|
||||||
status: todo.status(),
|
|
||||||
completion_date: todo.completionDate(),
|
|
||||||
project: proj && {
|
|
||||||
id: proj.id(),
|
|
||||||
title: proj.name(),
|
|
||||||
status: proj.status(),
|
|
||||||
notes: proj.notes(),
|
|
||||||
tags: proj.tagNames().split(', '),
|
|
||||||
},
|
|
||||||
area: area && { id: area.id(), title: area.name() },
|
|
||||||
tags: [...tags, ...todo.tagNames().split(', ')].filter(t => t),
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return JSON.stringify(objs, undefined, 2);
|
return JSON.stringify(objs, undefined, 2);
|
||||||
|
|
|
||||||
Reference in a new issue