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
47e166a6
Commit
47e166a6
authored
9 months ago
by
Julian
Browse files
Options
Downloads
Patches
Plain Diff
Explain and simplify computed properties of the LessonNotes.vue component
parent
ba737f63
No related branches found
No related tags found
1 merge request
!362
Resolve "Add personal note management dialog in course book"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonNotes.vue
+33
-12
33 additions, 12 deletions
...ntend/components/coursebook/documentation/LessonNotes.vue
with
33 additions
and
12 deletions
aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonNotes.vue
+
33
−
12
View file @
47e166a6
...
@@ -103,13 +103,18 @@ export default {
...
@@ -103,13 +103,18 @@ export default {
total
()
{
total
()
{
return
this
.
documentation
.
participations
.
length
;
return
this
.
documentation
.
participations
.
length
;
}
,
}
,
/**
* Return the number of present people.
*/
present
()
{
present
()
{
return
this
.
documentation
.
participations
.
filter
(
return
this
.
documentation
.
participations
.
filter
(
(
p
)
=>
p
.
absenceReason
===
null
,
(
p
)
=>
p
.
absenceReason
===
null
,
).
length
;
).
length
;
}
,
}
,
/**
* Get all course attendants who have an absence reason, grouped by that reason.
*/
absences
()
{
absences
()
{
// Get all course attendants who have an absence reason
return
Object
.
groupBy
(
return
Object
.
groupBy
(
this
.
documentation
.
participations
.
filter
(
this
.
documentation
.
participations
.
filter
(
(
p
)
=>
p
.
absenceReason
!==
null
,
(
p
)
=>
p
.
absenceReason
!==
null
,
...
@@ -117,23 +122,39 @@ export default {
...
@@ -117,23 +122,39 @@ export default {
({
absenceReason
}
)
=>
absenceReason
.
id
,
({
absenceReason
}
)
=>
absenceReason
.
id
,
);
);
}
,
}
,
/**
* Parse and combine all extraMark notes.
*
* Notes with extraMarks are grouped by ExtraMark. ExtraMarks with the showInCoursebook property set to false are ignored.
* @return An object where the keys are extraMark IDs and the values have the structure [extraMark, note1, note2, ..., noteN]
*/
extraMarkChips
()
{
extraMarkChips
()
{
// Apply the inner function to each participation, with value being the resulting object
return
this
.
documentation
.
participations
.
reduce
((
value
,
p
)
=>
{
return
this
.
documentation
.
participations
.
reduce
((
value
,
p
)
=>
{
p
.
notesWithExtraMark
.
forEach
(({
extraMark
}
)
=>
{
// Go through every extra mark of this participation
if
(
extraMark
.
showInCoursebook
)
{
for
(
const
{
extraMark
}
of
p
.
notesWithExtraMark
)
{
if
(
value
[
extraMark
.
id
])
{
// Only proceed if the extraMark should be displayed here
value
[
extraMark
.
id
].
push
(
p
);
if
(
!
extraMark
.
showInCoursebook
)
{
}
else
{
continue
;
value
[
extraMark
.
id
]
=
[
this
.
extraMarks
.
find
((
e
)
=>
e
.
id
===
extraMark
.
id
),
p
,
];
}
}
}
}
);
// value[extraMark.id] is an Array with the structure [extraMark, note1, note2, ..., noteN]
if
(
value
[
extraMark
.
id
])
{
value
[
extraMark
.
id
].
push
(
p
);
}
else
{
value
[
extraMark
.
id
]
=
[
this
.
extraMarks
.
find
((
e
)
=>
e
.
id
===
extraMark
.
id
),
p
,
];
}
}
return
value
;
return
value
;
}
,
{
}
);
}
,
{
}
);
}
,
}
,
/**
* Return a list Participations with a set tardiness
*/
tardyParticipations
()
{
tardyParticipations
()
{
return
this
.
documentation
.
participations
.
filter
(
return
this
.
documentation
.
participations
.
filter
(
(
p
)
=>
p
.
noteWithTardiness
!=
null
&&
p
.
noteWithTardiness
.
tardiness
>
0
,
(
p
)
=>
p
.
noteWithTardiness
!=
null
&&
p
.
noteWithTardiness
.
tardiness
>
0
,
...
...
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