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
19794f00
Commit
19794f00
authored
10 months ago
by
permcu
Browse files
Options
Downloads
Patches
Plain Diff
Implement lessons-for-persons query handler
parent
3b152a8a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!362
Resolve "Add personal note management dialog in course book"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/alsijil/frontend/components/coursebook/absences/absenceCreation.graphql
+4
-3
4 additions, 3 deletions
...nd/components/coursebook/absences/absenceCreation.graphql
aleksis/apps/alsijil/schema/__init__.py
+23
-29
23 additions, 29 deletions
aleksis/apps/alsijil/schema/__init__.py
with
27 additions
and
32 deletions
aleksis/apps/alsijil/frontend/components/coursebook/absences/absenceCreation.graphql
+
4
−
3
View file @
19794f00
...
...
@@ -17,15 +17,16 @@ query lessonsForPersons(
end
:
$end
)
{
id
fullname
lessons
{
start
end
id
datetimeStart
datetimeEnd
course
subject
}
}
}
# TODO: course is missing in LessonEventType
# Use absencesInputType
mutation
createAbsences
(
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/alsijil/schema/__init__.py
+
23
−
29
View file @
19794f00
...
...
@@ -11,6 +11,7 @@ from aleksis.core.models import Group, Person
from
aleksis.core.schema.base
import
FilterOrderList
from
aleksis.core.schema.group
import
GroupType
from
aleksis.core.util.core_helpers
import
has_person
from
aleksis.apps.chronos.models
import
LessonEvent
from
..models
import
Documentation
from
.documentation
import
(
...
...
@@ -123,7 +124,8 @@ class Query(graphene.ObjectType):
|
Q
(
groups__parent_groups__owners
=
person
)
)
def
lessons_for_persons
(
@staticmethod
def
resolve_lessons_for_persons
(
root
,
info
,
persons
,
...
...
@@ -131,36 +133,28 @@ class Query(graphene.ObjectType):
end
,
**
kwargs
,
):
# Do date like resolve_documentations_for_coursebook?
# Get all lesson events for person
# Make this reusable for mutation -> Einzeiler
# Pack into (id fullname lesson (start end course subject ...))
event_params
=
{
"
type
"
:
"
PARTICIPANT
"
,
"
obj_id
"
:
PERSON_ID
,
}
# get_objects (lesson_events chronos models.py)
# adapt own -> person as param
# _put list of person IDs in event_params_
events
=
LessonEvent
.
get_single_events
(
start
,
end
,
None
,
event_params
,
with_reference_object
=
True
,
)
"""
Resolve all lesson events for each person in timeframe start to end.
"""
lessons_for_person
=
[]
for
person
in
persons
:
event_params
=
{
"
type
"
:
"
PARTICIPANT
"
,
"
obj_id
"
:
PERSON_ID
,
}
lessons_for_person
.
append
(
id
=
person
,
lessons
=
LessonEvent
.
get_single_events
(
datetime
.
combine
(
start
,
datetime
.
min
.
time
()),
datetime
.
combine
(
date_end
,
datetime
.
max
.
time
()),
None
,
event_params
,
with_reference_object
=
True
,
)
)
return
[
id
get_single_events
->
python
object
ical
# Use own graphene types (wrapper, & event
# then populate them here
return
lessons_for_person
return
class
Mutation
(
graphene
.
ObjectType
):
create_or_update_documentations
=
DocumentationBatchCreateOrUpdateMutation
.
Field
()
...
...
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