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
|
|
@ -12,31 +12,33 @@ to.setHours(23);
|
|||
to.setMinutes(59);
|
||||
to.setSeconds(59);
|
||||
|
||||
logbook.filter(task => {
|
||||
return task.completionDate() >= from && task.completionDate() < to;
|
||||
}).forEach(todo => {
|
||||
var proj = todo.project();
|
||||
var tags = [];
|
||||
if (proj) {
|
||||
tags.push(...proj.tagNames().split(', '));
|
||||
for (const todo of logbook) {
|
||||
if(todo.completionDate() >= from && todo.completionDate() < to) {
|
||||
var proj = todo.project();
|
||||
var tags = [];
|
||||
if (proj) {
|
||||
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);
|
||||
|
|
|
|||
Reference in a new issue