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
0cc8f22f
Verified
Commit
0cc8f22f
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of edugit.org:AlekSIS/official/AlekSIS-App-Chronos
parents
40e803d9
dea5c8db
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
aleksis/apps/chronos/apps.py
+1
-0
1 addition, 0 deletions
aleksis/apps/chronos/apps.py
aleksis/apps/chronos/util/date.py
+4
-1
4 additions, 1 deletion
aleksis/apps/chronos/util/date.py
aleksis/apps/chronos/views.py
+10
-0
10 additions, 0 deletions
aleksis/apps/chronos/views.py
with
15 additions
and
1 deletion
aleksis/apps/chronos/apps.py
+
1
−
0
View file @
0cc8f22f
...
...
@@ -13,6 +13,7 @@ class ChronosConfig(AppConfig):
([
2018
,
2019
,
2020
],
"
Jonathan Weth
"
,
"
wethjo@katharineum.de
"
),
([
2018
,
2019
],
"
Frank Poetzsch-Heffter
"
,
"
p-h@katharineum.de
"
),
([
2019
,
2020
],
"
Dominik George
"
,
"
dominik.george@teckids.org
"
),
([
2019
],
"
Julian Leucker
"
,
"
leuckeju@katharineum.de
"
),
([
2019
],
"
Tom Teichler
"
,
"
tom.teichler@teckids.org
"
),
([
2019
],
"
Hangzhi Yu
"
,
"
yuha@katharineum.de
"
),
)
This diff is collapsed.
Click to expand it.
aleksis/apps/chronos/util/date.py
+
4
−
1
View file @
0cc8f22f
...
...
@@ -8,19 +8,22 @@ from django.utils.translation import gettext_lazy as _
def
week_weekday_from_date
(
when
:
date
)
->
Tuple
[
CalendarWeek
,
int
]:
"""
Return a tuple of week and weekday from a given date.
"""
return
(
CalendarWeek
.
from_date
(
when
),
when
.
weekday
())
def
week_weekday_to_date
(
week
:
CalendarWeek
,
weekday
:
int
)
->
date
:
"""
Return a date object for one day in a calendar week.
"""
return
week
[
weekday
-
1
]
def
week_period_to_date
(
week
:
Union
[
CalendarWeek
,
int
],
period
)
->
date
:
"""
Return the date of a lesson period in a given week.
"""
return
period
.
get_date
(
week
)
def
get_weeks_for_year
(
year
:
int
)
->
List
[
CalendarWeek
]:
"""
Generate
s
all weeks for one year
"""
"""
Generate all weeks for one year
.
"""
weeks
=
[]
# Go for all weeks in year and create week list
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/chronos/views.py
+
10
−
0
View file @
0cc8f22f
...
...
@@ -26,6 +26,7 @@ from aleksis.core.util.core_helpers import has_person, get_site_preferences
@permission_required
(
"
chronos.view_timetable_overview
"
)
def
all_timetables
(
request
:
HttpRequest
)
->
HttpResponse
:
"""
View all timetables for persons, groups and rooms.
"""
context
=
{}
teachers
=
Person
.
objects
.
annotate
(
...
...
@@ -56,6 +57,7 @@ def my_timetable(
month
:
Optional
[
int
]
=
None
,
day
:
Optional
[
int
]
=
None
,
)
->
HttpResponse
:
"""
View personal timetable on a specified date.
"""
context
=
{}
if
day
:
...
...
@@ -122,6 +124,7 @@ def timetable(
week
:
Optional
[
int
]
=
None
,
regular
:
Optional
[
str
]
=
None
,
)
->
HttpResponse
:
"""
View a selected timetable for a person, group or room.
"""
context
=
{}
is_smart
=
regular
!=
"
regular
"
...
...
@@ -183,6 +186,7 @@ def lessons_day(
month
:
Optional
[
int
]
=
None
,
day
:
Optional
[
int
]
=
None
,
)
->
HttpResponse
:
"""
View all lessons taking place on a specified day.
"""
context
=
{}
if
day
:
...
...
@@ -225,6 +229,7 @@ def get_substitution_by_id(request: HttpRequest, id_: int, week: int):
@permission_required
(
"
chronos.edit_substitution
"
,
fn
=
get_substitution_by_id
)
def
edit_substitution
(
request
:
HttpRequest
,
id_
:
int
,
week
:
int
)
->
HttpResponse
:
"""
View a form to edit a substitution lessen.
"""
context
=
{}
lesson_period
=
get_object_or_404
(
LessonPeriod
,
pk
=
id_
)
...
...
@@ -263,6 +268,10 @@ def edit_substitution(request: HttpRequest, id_: int, week: int) -> HttpResponse
@permission_required
(
"
chronos.delete_substitution
"
,
fn
=
get_substitution_by_id
)
def
delete_substitution
(
request
:
HttpRequest
,
id_
:
int
,
week
:
int
)
->
HttpResponse
:
"""
Delete a substitution lesson.
Redirects back to substition list on success.
"""
lesson_period
=
get_object_or_404
(
LessonPeriod
,
pk
=
id_
)
wanted_week
=
lesson_period
.
lesson
.
get_calendar_week
(
week
)
...
...
@@ -285,6 +294,7 @@ def substitutions(
day
:
Optional
[
int
]
=
None
,
is_print
:
bool
=
False
,
)
->
HttpResponse
:
"""
View all substitutions on a spcified day.
"""
context
=
{}
if
day
:
...
...
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