Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Chronos
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-Chronos
Commits
1fb685a1
Verified
Commit
1fb685a1
authored
5 months ago
by
permcu
Committed by
Jonathan Weth
5 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Resolve substitutions partially via graphene-types
parent
caf5613e
No related branches found
No related tags found
1 merge request
!373
Resolve "Substitutions table for new data model"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/chronos/frontend/components/substitutions.graphql
+11
-8
11 additions, 8 deletions
...is/apps/chronos/frontend/components/substitutions.graphql
aleksis/apps/chronos/schema/__init__.py
+38
-3
38 additions, 3 deletions
aleksis/apps/chronos/schema/__init__.py
with
49 additions
and
11 deletions
aleksis/apps/chronos/frontend/components/substitutions.graphql
+
11
−
8
View file @
1fb685a1
...
...
@@ -9,15 +9,18 @@ query substitutionsForDate ($date: Date!) {
}
substitutions
{
groups
{
shortName
}
period
{
startSlot
endSlot
startTime
endTime
wholeDay
old
{
shortName
}
new
{
shortName
}
}
startSlot
endSlot
startTime
endTime
wholeDay
teachers
{
shortName
fullName
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/chronos/schema/__init__.py
+
38
−
3
View file @
1fb685a1
...
...
@@ -125,10 +125,45 @@ class TimetableObjectType(graphene.ObjectType):
return
f
"
{
root
.
type
.
value
}
-
{
root
.
id
}
"
class
SubstitutionGroupsType
(
graphene
.
ObjectType
):
old
=
graphene
.
List
(
GroupType
)
new
=
graphene
.
List
(
GroupType
)
def
resolve_old
(
root
,
info
):
if
not
root
.
cancelled
and
root
.
groups
.
all
()
and
root
.
amends
.
groups
.
all
():
return
root
.
amends
.
groups
.
all
()
else
:
return
[]
def
resolve_new
(
root
,
info
):
if
root
cancelled
:
return
root
.
amends
.
groups
.
all
()
else
:
return
root
.
groups
.
all
()
or
root
.
amends
.
groups
.
all
()
class
SubstitutionType
(
graphene
.
ObjectType
):
"""
This type contains the logic also contained in the pdf templates.
"""
groups
=
graphene
.
List
(
SubstitutionGroupsType
)
start_slot
=
graphene
.
Int
()
end_slot
=
graphene
.
Int
()
start_time
=
graphene
.
Time
()
end_time
=
graphene
.
Time
()
whole_day
=
graphene
.
Boolean
()
teachers
=
graphene
.
List
(
PersonType
)
subject
=
graphene
.
String
()
rooms
=
graphene
.
List
(
RoomType
)
cancelled
=
graphene
.
Boolean
()
comment
=
graphene
.
String
()
def
resolve_groups
(
root
,
info
):
return
root
[
'
REFERENCE_OBJECT
'
]
class
SubstitutionsForDateType
(
graphene
.
ObjectType
):
affected_teachers
=
graphene
.
List
(
PersonType
)
affected_groups
=
graphene
.
List
(
GroupType
)
substitutions
=
graphene
.
List
(
LessonEvent
Type
)
substitutions
=
graphene
.
List
(
Substitution
Type
)
class
Query
(
graphene
.
ObjectType
):
timetable_teachers
=
graphene
.
List
(
TimetablePersonType
)
...
...
@@ -137,7 +172,7 @@ class Query(graphene.ObjectType):
available_timetables
=
graphene
.
List
(
TimetableObjectType
)
substitutions_for_date
=
graphene
.
List
(
SubstitutionsForDateType
,
date
=
graphene
.
Date
,
date
=
graphene
.
Date
()
,
)
def
resolve_timetable_teachers
(
self
,
info
,
**
kwargs
):
...
...
@@ -185,7 +220,7 @@ class Query(graphene.ObjectType):
SubstitutionsForDateType
(
affected_teachers
=
affected_teachers
,
affected_groups
=
affected_groups
,
substitutions
=
[
sub
[
'
el
'
]
[
'
REFERENCE_OBJECT
'
]
for
sub
in
substitutions
]
substitutions
=
[
sub
[
'
el
'
]
for
sub
in
substitutions
]
)
class
Mutation
(
graphene
.
ObjectType
):
...
...
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