Versie 0.2.0
This commit is contained in:
commit
e77d8fd373
495 files changed
+81026
No files matched your search
@@ -0,0 +1,20 @@
|
||||
// Generated, do not edit. sha256:dee49c9ff6e746770628ebfbeb55d9732c23407998d26306fb4c07dd8cc4e1ec
|
||||
export const dueKey = d => `${d.scheduleId}|${d.periodEnd}`;
|
||||
|
||||
export function byPeriod(due) {
|
||||
return [...due].sort((a, b) =>
|
||||
a.periodEnd.localeCompare(b.periodEnd)
|
||||
|| a.periodStart.localeCompare(b.periodStart)
|
||||
|| a.scheduleId - b.scheduleId);
|
||||
}
|
||||
|
||||
export function bookableDues(due) {
|
||||
const oudstePerAccount = new Map();
|
||||
for (const d of due) {
|
||||
const huidig = oudstePerAccount.get(d.accountId);
|
||||
if (huidig == null || d.periodEnd < huidig) oudstePerAccount.set(d.accountId, d.periodEnd);
|
||||
}
|
||||
return new Set(due
|
||||
.filter(d => d.periodEnd === oudstePerAccount.get(d.accountId))
|
||||
.map(dueKey));
|
||||
}
|
||||
Reference in new issue
Block a user