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
24a1a86e
Verified
Commit
24a1a86e
authored
2 years ago
by
magicfelix
Browse files
Options
Downloads
Patches
Plain Diff
Fix linter
parent
14d1b1e3
No related branches found
No related tags found
1 merge request
!284
Draft: Redesign entering of lesson documentation
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/alsijil/schema.py
+40
-40
40 additions, 40 deletions
aleksis/apps/alsijil/schema.py
aleksis/apps/alsijil/views.py
+8
-1
8 additions, 1 deletion
aleksis/apps/alsijil/views.py
with
48 additions
and
41 deletions
aleksis/apps/alsijil/schema.py
+
40
−
40
View file @
24a1a86e
import
graphene
from
datetime
import
datetime
import
graphene
from
graphene_django
import
DjangoObjectType
from
graphene_django.forms.mutation
import
DjangoModelFormMutation
from
aleksis.apps.chronos.models
import
Lesson
from
aleksis.core.models
import
Group
,
Person
...
...
@@ -37,9 +37,7 @@ class LessonDocumentationType(DjangoObjectType):
def
resolve_personal_notes
(
root
:
LessonDocumentation
,
info
,
**
kwargs
):
persons
=
Person
.
objects
.
filter
(
member_of__in
=
Group
.
objects
.
filter
(
pk__in
=
root
.
register_object
.
get_groups
().
all
()
)
member_of__in
=
Group
.
objects
.
filter
(
pk__in
=
root
.
register_object
.
get_groups
().
all
())
)
return
PersonalNote
.
objects
.
filter
(
week
=
root
.
week
,
...
...
@@ -79,18 +77,18 @@ class LessonDocumentationMutation(graphene.Mutation):
@classmethod
def
mutate
(
cls
,
root
,
info
,
year
,
week
,
lesson_period_id
=
None
,
event_id
=
None
,
extra_lesson_id
=
None
,
lesson_documentation_id
=
None
,
topic
=
None
,
homework
=
None
,
group_note
=
None
cls
,
root
,
info
,
year
,
week
,
lesson_period_id
=
None
,
event_id
=
None
,
extra_lesson_id
=
None
,
lesson_documentation_id
=
None
,
topic
=
None
,
homework
=
None
,
group_note
=
None
,
):
lesson_period
=
LessonPeriod
.
objects
.
filter
(
pk
=
lesson_period_id
).
first
()
...
...
@@ -102,7 +100,7 @@ class LessonDocumentationMutation(graphene.Mutation):
week
=
week
,
lesson_period
=
lesson_period
,
event
=
event
,
extra_lesson
=
extra_lesson
extra_lesson
=
extra_lesson
,
)
if
topic
is
not
None
:
...
...
@@ -135,18 +133,18 @@ class PersonalNoteMutation(graphene.Mutation):
@classmethod
def
mutate
(
cls
,
root
,
info
,
person_id
,
lesson_documentation
,
personal_note_id
=
None
,
late
=
None
,
absent
=
None
,
excused
=
None
,
excuse_type
=
None
,
remarks
=
None
,
extra_marks
=
None
cls
,
root
,
info
,
person_id
,
lesson_documentation
,
personal_note_id
=
None
,
late
=
None
,
absent
=
None
,
excused
=
None
,
excuse_type
=
None
,
remarks
=
None
,
extra_marks
=
None
,
):
person
=
Person
.
objects
.
get
(
pk
=
person_id
)
lesson_documentation
=
LessonDocumentation
.
objects
.
get
(
pk
=
lesson_documentation
)
...
...
@@ -202,8 +200,9 @@ class Query(graphene.ObjectType):
def
resolve_lesson_documentations
(
root
,
info
,
**
kwargs
):
# FIXME do permission stuff
return
LessonDocumentation
.
objects
.
all
().
order_by
(
"
-year
"
,
"
-week
"
,
"
-lesson_period__period__weekday
"
,
"
-lesson_period__period__period
"
)
return
LessonDocumentation
.
objects
.
all
().
order_by
(
"
-year
"
,
"
-week
"
,
"
-lesson_period__period__weekday
"
,
"
-lesson_period__period__period
"
)
def
resolve_lesson_documentation_by_id
(
root
,
info
,
id
,
**
kwargs
):
return
LessonDocumentation
.
objects
.
get
(
id
=
id
)
...
...
@@ -213,17 +212,18 @@ class Query(graphene.ObjectType):
now
=
datetime
.
now
()
for
planned
in
lesson
.
planned_lessonperiods_datetimes
:
if
planned
[
"
datetime_start
"
]
<=
now
:
LessonDocumentation
.
objects
.
get_or_create
(
week
=
planned
[
"
week
"
],
year
=
planned
[
"
year
"
],
lesson_period
=
planned
[
"
lesson_period
"
])
# FIXME: Queries shouldn't alter data
LessonDocumentation
.
objects
.
get_or_create
(
week
=
planned
[
"
week
"
],
year
=
planned
[
"
year
"
],
lesson_period
=
planned
[
"
lesson_period
"
],
)
# FIXME: Queries shouldn't alter data
return
LessonDocumentation
.
objects
.
filter
(
lesson_period_id__in
=
LessonPeriod
.
objects
.
filter
(
lesson_id
=
id
)
.
values_list
(
"
id
"
,
flat
=
True
)
lesson_period_id__in
=
LessonPeriod
.
objects
.
filter
(
lesson_id
=
id
).
values_list
(
"
id
"
,
flat
=
True
)
).
order_by
(
"
-year
"
,
"
-week
"
,
"
-lesson_period__period__weekday
"
,
"
-lesson_period__period__period
"
"
-year
"
,
"
-week
"
,
"
-lesson_period__period__weekday
"
,
"
-lesson_period__period__period
"
)
def
resolve_personal_notes
(
root
,
info
,
**
kwargs
):
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/alsijil/views.py
+
8
−
1
View file @
24a1a86e
...
...
@@ -28,7 +28,14 @@ from reversion.views import RevisionMixin
from
rules.contrib.views
import
PermissionRequiredMixin
,
permission_required
from
aleksis.apps.chronos.managers
import
TimetableType
from
aleksis.apps.chronos.models
import
Event
,
ExtraLesson
,
Holiday
,
Lesson
,
LessonPeriod
,
TimePeriod
from
aleksis.apps.chronos.models
import
(
Event
,
ExtraLesson
,
Holiday
,
Lesson
,
LessonPeriod
,
TimePeriod
,
)
from
aleksis.apps.chronos.util.build
import
build_weekdays
from
aleksis.apps.chronos.util.date
import
get_weeks_for_year
,
week_weekday_to_date
from
aleksis.core.mixins
import
(
...
...
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