Skip to content
Snippets Groups Projects
Commit 915e6d61 authored by permcu's avatar permcu
Browse files

Continue assuring date range

parent fb130d0a
No related branches found
No related tags found
2 merge requests!355Implement infinite scrolling and by date navigation for coursebook,!350Resolve "Add simple course book list"
...@@ -270,20 +270,33 @@ export default { ...@@ -270,20 +270,33 @@ export default {
return "documentation_" + nearestId.toISODate(); return "documentation_" + nearestId.toISODate();
}, },
dateRange(date) {
return Interval
.fromDateTimes(date.minus({ days: 3 }), date.plus({ days: 4 }))
.splitBy({ days: 1 })
.map((ts) => ts.start);
},
// TODO: Improve Add empty but already queried days to docsByDay -> do not query them again // TODO: Improve Add empty but already queried days to docsByDay -> do not query them again
// docsByDay: {dt: [dt doc ...] ...} // docsByDay: {dt: [dt doc ...] ...}
assureDate(date) { assureDate(date) {
// find missing & fetch missing range if (!this.knownDate[date]) {
// date +- 5 days ? // find missing & fetch missing range
const dateRange = Interval // date +- 5 days ?
.fromDateTimes(date.minus({ days: 3 }), date.plus({ days: 4 })) const dateRange = Interval
.splitBy({ days: 1 }) .fromDateTimes(date.minus({ days: 3 }), date.plus({ days: 4 }))
.map((ts) => ts.start); .splitBy({ days: 1 })
console.log('assureDate', dateRange.map((ts) => ts.toISODate())); .map((ts) => ts.start);
// look up in docsByDay console.log('assureDate', dateRange.map((ts) => ts.toISODate()));
// sort missing and ask for first to last // look up in docsByDay
// integrate into docsByDay console.log('missing', dateRange.map((ts) => this.docsByDay[ts] ));
console.log('missing', dateRange.filter((ts) => !this.docsByDay[ts] ));
// dateRange.forEach((ts) => { this.docsByDay[ts.toISODate()] = 42 });
console.log('docsByDay', this.docsByDay);
console.log('2024-03-29', this.docsByDay[DateTime.fromISO('2024-03-29')]);
console.log('2024-03-29', dateRange[3], this.docsByDay[dateRange[3]]);
// sort missing and ask for first to last
// integrate into docsByDay
}
}, },
gotoDate(date, scroll) { gotoDate(date, scroll) {
// show // show
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment