Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Alsijil
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Alsijil
Commits
bb903b61
Commit
bb903b61
authored
11 months ago
by
permcu
Browse files
Options
Downloads
Patches
Plain Diff
Start with fetchMore
parent
acdc172b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!355
Implement infinite scrolling and by date navigation for coursebook
,
!350
Resolve "Add simple course book list"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
+21
-14
21 additions, 14 deletions
...pps/alsijil/frontend/components/coursebook/Coursebook.vue
with
21 additions
and
14 deletions
aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
+
21
−
14
View file @
bb903b61
...
...
@@ -293,20 +293,27 @@ export default {
assureDate
(
date
)
{
if
(
!
this
.
knownDates
[
date
])
{
// find missing & fetch missing range
// date +- 5 days ?
const
dateRange
=
Interval
.
fromDateTimes
(
date
.
minus
({
days
:
3
}
),
date
.
plus
({
days
:
4
}
))
.
splitBy
({
days
:
1
}
)
.
map
((
ts
)
=>
ts
.
start
);
console
.
log
(
'
assureDate
'
,
dateRange
.
map
((
ts
)
=>
ts
.
toISODate
()));
// look up in 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
const
missing
=
this
.
dateRange
(
date
).
filter
((
ts
)
=>
!
this
.
docsByDay
[
ts
]
);
// ask for first to last
this
.
lastQuery
.
fetchMore
({
variables
:
{
dateStart
:
missing
[
0
].
toISODate
(),
dateEnd
:
missing
[
missing
.
length
-
1
].
toISODate
(),
}
,
// Transform the previous result with new data
updateQuery
:
(
previousResult
,
{
fetchMoreResult
}
)
=>
{
return
{
tagsPage
:
{
__typename
:
previousResult
.
tagsPage
.
__typename
,
// Merging the tag list
tags
:
[...
previousResult
.
tagsPage
.
tags
,
...
newTags
],
hasMore
,
}
,
}
}
,
}
)
// integrate into docsByDay
}
}
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment