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
c04c78f9
Commit
c04c78f9
authored
10 months ago
by
permcu
Committed by
Julian
9 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Sketch backend
parent
02e23a8e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!360
Resolve "Add absence management to course book student dialog"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/alsijil/schema/__init__.py
+35
-0
35 additions, 0 deletions
aleksis/apps/alsijil/schema/__init__.py
aleksis/apps/alsijil/schema/absences.py
+25
-0
25 additions, 0 deletions
aleksis/apps/alsijil/schema/absences.py
with
60 additions
and
0 deletions
aleksis/apps/alsijil/schema/__init__.py
+
35
−
0
View file @
c04c78f9
...
@@ -38,6 +38,13 @@ class Query(graphene.ObjectType):
...
@@ -38,6 +38,13 @@ class Query(graphene.ObjectType):
groups_by_person
=
FilterOrderList
(
GroupType
,
person
=
graphene
.
ID
())
groups_by_person
=
FilterOrderList
(
GroupType
,
person
=
graphene
.
ID
())
courses_of_person
=
FilterOrderList
(
CourseType
,
person
=
graphene
.
ID
())
courses_of_person
=
FilterOrderList
(
CourseType
,
person
=
graphene
.
ID
())
lesson_events_for_absences
=
FilterOrderList
(
PersonAbsencesType
??
,
persons
=
graphene
.
List
(
graphene
.
ID
,
required
=
True
),
start
=
graphene
.
Date
(
required
=
True
),
end
=
graphene
.
Date
(
required
=
True
),
)
def
resolve_documentations_by_course_id
(
root
,
info
,
course_id
,
**
kwargs
):
def
resolve_documentations_by_course_id
(
root
,
info
,
course_id
,
**
kwargs
):
documentations
=
Documentation
.
objects
.
filter
(
documentations
=
Documentation
.
objects
.
filter
(
Q
(
course__pk
=
course_id
)
|
Q
(
amends__course__pk
=
course_id
)
Q
(
course__pk
=
course_id
)
|
Q
(
amends__course__pk
=
course_id
)
...
@@ -117,7 +124,35 @@ class Query(graphene.ObjectType):
...
@@ -117,7 +124,35 @@ class Query(graphene.ObjectType):
|
Q
(
groups__parent_groups__owners
=
person
)
|
Q
(
groups__parent_groups__owners
=
person
)
)
)
def
lesson_events_for_absences
(
root
,
info
,
persons
,
start
,
end
,
**
kwargs
,
):
# Do date like resolve_documentations_for_coursebook?
# Get all lesson events for person
# Make this reusable for mutation
# Pack into (id fullname lesson (start end course subject ...))
event_params
=
{
""
}
events
=
LessonEvent
.
get_single_events
(
start
,
end
,
request
??
,
event_params
,
with_reference_object
=
True
,
)
return
class
Mutation
(
graphene
.
ObjectType
):
class
Mutation
(
graphene
.
ObjectType
):
create_or_update_documentations
=
DocumentationBatchCreateOrUpdateMutation
.
Field
()
create_or_update_documentations
=
DocumentationBatchCreateOrUpdateMutation
.
Field
()
create_absences
=
AbsencesBatchCreateMutation
.
Field
()
update_participation_statuses
=
ParticipationStatusBatchPatchMutation
.
Field
()
update_participation_statuses
=
ParticipationStatusBatchPatchMutation
.
Field
()
This diff is collapsed.
Click to expand it.
aleksis/apps/alsijil/schema/absences.py
0 → 100644
+
25
−
0
View file @
c04c78f9
import
graphene
class
AbsencesBatchCreateMutation
(
graphene
.
Mutation
):
class
Arguments
:
persons
=
graphene
.
List
(
graphene
.
ID
)
start
=
graphene
.
Date
(),
end
=
graphene
.
Date
(),
comment
=
graphene
.
String
(),
reason
=
graphene
.
ID
()
ok
=
graphene
.
Boolean
()
@classmethod
def
mutate
(
cls
,
root
,
info
,
input
):
# noqa
# Get all lesson events for person (share with query)
# Look up documentations for lesson events
# (share with models.py Documentation get_for_coursebook;
# has lesson event lookup as well & returns real & fake documentations
# => extract & reuse the documentation lookup)
# Create a ParticipationStatus for each documentation
# If there are any LessonEvents without a documentation
# create a Kolego Absence for the whole duration
# Return ok=True if everything went well.
return
AbsencesBatchCreateMutation
(
ok
=
BOOL
)
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