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
7a0d7d29
Commit
7a0d7d29
authored
11 months ago
by
permcu
Browse files
Options
Downloads
Patches
Plain Diff
Integrate fetchMore
The first working endless scroll. But update of visible is broken now.
parent
bc52df60
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
+22
-29
22 additions, 29 deletions
...pps/alsijil/frontend/components/coursebook/Coursebook.vue
with
22 additions
and
29 deletions
aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
+
22
−
29
View file @
7a0d7d29
...
...
@@ -254,35 +254,20 @@ export default {
// sorting is necessary since backend can send docs unordered
}
,
// docsByDay:
{
dt
:
[
dt
doc
...]
...
}
assureDate
(
date
)
{
if
(
!
this
.
knownDates
[
date
])
{
console
.
log
(
this
.
lastQuery
);
console
.
log
(
'
unknown date
'
,
date
.
toISODate
());
console
.
log
(
this
.
knownDates
);
// find missing & fetch missing range
const
missing
=
this
.
dateRange
(
date
)
.
filter
((
ts
)
=>
!
this
.
knownDates
[
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
}
)
=>
{
console
.
log
(
'
previousResult
'
,
previousResult
);
console
.
log
(
'
fetchMoreResult
'
,
fetchMoreResult
);
return
{
items
:
[...
previousResult
.
items
,
...
fetchMoreResult
.
items
.
filter
((
doc
)
=>
{
return
previousResult
.
items
.
find
((
prev
)
=>
prev
.
id
===
doc
.
id
)
}
),
],
}
;
}
}
)
// integrate into docsByDay
}
fetchMore
(
from
,
to
)
{
console
.
log
(
'
fetching
'
,
from
,
to
);
this
.
lastQuery
.
fetchMore
({
variables
:
{
dateStart
:
from
,
dateEnd
:
to
,
}
,
// Transform the previous result with new data
updateQuery
:
(
previousResult
,
{
fetchMoreResult
}
)
=>
{
console
.
log
(
'
previousResult
'
,
previousResult
);
console
.
log
(
'
fetchMoreResult
'
,
fetchMoreResult
);
return
{
items
:
previousResult
.
items
.
concat
(
fetchMoreResult
.
items
)
}
;
}
}
);
}
,
setDate
(
date
)
{
this
.
$router
.
replace
({
hash
:
date
}
)
...
...
@@ -306,8 +291,16 @@ export default {
// load more
if
(
entry
.
target
.
dataset
.
first
)
{
console
.
log
(
'
load up
'
);
entry
.
target
.
dataset
.
first
=
false
;
const
date
=
DateTime
.
fromISO
(
entry
.
target
.
dataset
.
date
);
this
.
fetchMore
(
date
.
minus
({
days
:
4
}
).
toISODate
(),
date
.
minus
({
days
:
1
}
).
toISODate
());
}
else
if
(
entry
.
target
.
dataset
.
last
)
{
console
.
log
(
'
load down
'
);
entry
.
target
.
dataset
.
last
=
false
;
const
date
=
DateTime
.
fromISO
(
entry
.
target
.
dataset
.
date
);
this
.
fetchMore
(
date
.
plus
({
days
:
1
}
).
toISODate
(),
date
.
plus
({
days
:
5
}
).
toISODate
());
}
}
else
if
(
this
.
visible
[
0
]
===
entry
.
target
.
dataset
.
date
)
{
// first (top) visible date is going
...
...
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