Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
videoag
frontend
Commits
b5af65d1
Verified
Commit
b5af65d1
authored
8 months ago
by
Dorian Koch
Browse files
Options
Downloads
Patches
Plain Diff
Lecture Import: Sort by date, closes
#68
parent
ade41e89
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#6831
passed
8 months ago
Stage: test
Stage: deploy
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/pages/internal/import.tsx
+11
-2
11 additions, 2 deletions
src/pages/internal/import.tsx
with
11 additions
and
2 deletions
src/pages/internal/import.tsx
+
11
−
2
View file @
b5af65d1
...
@@ -55,14 +55,23 @@ function TerminBody({
...
@@ -55,14 +55,23 @@ function TerminBody({
return
(
event
:
ICalEvent
)
=>
!
nCi
(
event
);
return
(
event
:
ICalEvent
)
=>
!
nCi
(
event
);
};
};
const
sortEvents
=
(
a
:
ICalEvent
,
b
:
ICalEvent
)
=>
{
if
(
a
.
startDate
===
undefined
||
b
.
startDate
===
undefined
)
{
return
0
;
}
return
a
.
startDate
.
toMillis
()
-
b
.
startDate
.
toMillis
();
};
// find events that are new (place, duration and time unique)
// find events that are new (place, duration and time unique)
const
new_events
=
imported_events
.
current
const
new_events
=
imported_events
.
current
.
filter
(
notContainedIn
(
existingEvents
))
.
filter
(
notContainedIn
(
existingEvents
))
.
filter
(
removeDuplicates
);
.
filter
(
removeDuplicates
)
.
sort
(
sortEvents
);
// find existing events that are not in the imported events
// find existing events that are not in the imported events
const
not_imported_events
=
existingEvents
const
not_imported_events
=
existingEvents
.
filter
(
notContainedIn
(
imported_events
.
current
))
.
filter
(
notContainedIn
(
imported_events
.
current
))
.
filter
(
removeDuplicates
);
.
filter
(
removeDuplicates
)
.
sort
(
sortEvents
);
// events that are in both
// events that are in both
const
full_matches
=
imported_events
.
current
const
full_matches
=
imported_events
.
current
.
filter
(
containedIn
(
existingEvents
))
.
filter
(
containedIn
(
existingEvents
))
...
...
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