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
be37ac4a
Commit
be37ac4a
authored
7 months ago
by
Julian
Browse files
Options
Downloads
Patches
Plain Diff
Update sendToServer to accept extramarks as well
parent
5c373791
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!400
Resolve "Extra marks also in person multiple select in lesson dialog"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/alsijil/frontend/components/coursebook/absences/sendToServerMixin.js
+39
-0
39 additions, 0 deletions
...ntend/components/coursebook/absences/sendToServerMixin.js
with
39 additions
and
0 deletions
aleksis/apps/alsijil/frontend/components/coursebook/absences/sendToServerMixin.js
+
39
−
0
View file @
be37ac4a
/**
* Mixin to provide shared functionality needed to send updated participation data to the server
*/
import
{
createPersonalNotes
}
from
"
../personal_notes/personal_notes.graphql
"
;
import
{
updateParticipationStatuses
}
from
"
./participationStatus.graphql
"
;
import
mutateMixin
from
"
aleksis.core/mixins/mutateMixin.js
"
;
...
...
@@ -18,6 +19,10 @@ export default {
fieldValue
=
{
tardiness
:
value
,
};
}
else
if
(
field
===
"
extraMark
"
)
{
// Too much different logic → own method
this
.
addExtraMarks
(
participations
,
value
);
return
;
}
else
{
console
.
error
(
`Wrong field '
${
field
}
' for sendToServer`
);
return
;
...
...
@@ -50,5 +55,39 @@ export default {
},
);
},
addExtraMarks
(
participations
,
extraMarkId
)
{
// Get all participation statuses without this extra mark and get the respective person ids
const
participants
=
participations
.
filter
(
participation
=>
!
participation
.
notesWithExtraMark
.
some
(
note
=>
note
.
extraMark
.
id
===
extraMarkId
)
).
map
(
participation
=>
participation
.
person
.
id
)
// CREATE new personal note
this
.
mutate
(
createPersonalNotes
,
{
input
:
participants
.
map
(
person
=>
(
{
documentation
:
this
.
documentation
.
id
,
person
:
person
,
extraMark
:
extraMarkId
,
}
)),
},
(
storedDocumentations
,
incomingPersonalNotes
)
=>
{
const
documentation
=
storedDocumentations
.
find
(
(
doc
)
=>
doc
.
id
===
this
.
documentation
.
id
,
);
incomingPersonalNotes
.
forEach
((
note
,
index
)
=>
{
const
participationStatus
=
documentation
.
participations
.
find
(
(
part
)
=>
part
.
person
.
id
===
participants
[
index
],
);
participationStatus
.
notesWithExtraMark
.
push
(
note
);
});
return
storedDocumentations
;
},
);
}
},
};
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