Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor 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-Core
Commits
c32311de
Commit
c32311de
authored
6 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Correct date in PDF (skip weekend) | Tidy up [TIMETABLE/SUBSTITUTIONS]
parent
696b7fb8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!86
Merge school-apps
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
schoolapps/timetable/views.py
+5
-1
5 additions, 1 deletion
schoolapps/timetable/views.py
schoolapps/untisconnect/sub.py
+10
-8
10 additions, 8 deletions
schoolapps/untisconnect/sub.py
with
15 additions
and
9 deletions
schoolapps/timetable/views.py
+
5
−
1
View file @
c32311de
...
...
@@ -71,7 +71,11 @@ def get_next_weekday(date):
"""
Get the next weekday by a datetime object
"""
if
date
.
isoweekday
()
in
{
6
,
7
}:
date
+=
datetime
.
timedelta
(
days
=
date
.
isoweekday
()
%
4
)
if
date
.
isoweekday
()
==
6
:
plus
=
2
else
:
plus
=
1
date
+=
datetime
.
timedelta
(
days
=
plus
)
return
date
...
...
This diff is collapsed.
Click to expand it.
schoolapps/untisconnect/sub.py
+
10
−
8
View file @
c32311de
...
...
@@ -69,7 +69,7 @@ class Substitution(object):
# Lesson
# Teacher
print
(
db_obj
.
teacher_idlessn
)
#
print(db_obj.teacher_idlessn)
if
db_obj
.
teacher_idlessn
!=
0
:
self
.
teacher_old
=
get_teacher_by_id
(
db_obj
.
teacher_idlessn
)
if
db_obj
.
teacher_idsubst
!=
0
:
...
...
@@ -79,7 +79,7 @@ class Substitution(object):
self
.
teacher_new
=
None
self
.
lesson_element
=
get_lesson_element_by_id_and_teacher
(
self
.
lesson_id
,
self
.
teacher_old
)
print
(
self
.
lesson
)
#
print(self.lesson)
# Subject
self
.
subject_old
=
self
.
lesson_element
.
subject
if
self
.
lesson_element
is
not
None
else
None
...
...
@@ -111,7 +111,7 @@ class Substitution(object):
self
.
classes
=
[]
class_ids
=
untis_split_first
(
db_obj
.
classids
,
conv
=
int
)
print
(
class_ids
)
#
print(class_ids)
for
id
in
class_ids
:
self
.
classes
.
append
(
get_class_by_id
(
id
))
...
...
@@ -195,6 +195,8 @@ def generate_sub_table(subs):
sub_row
.
room
=
"
<s>{}</s> → <strong>{}</strong>
"
.
format
(
sub
.
room_old
.
shortcode
,
sub
.
room_new
.
shortcode
)
elif
sub
.
room_new
and
not
sub
.
room_old
:
sub_row
.
room
=
sub
.
room_new
.
shortcode
elif
not
sub
.
room_new
and
not
sub
.
room_old
:
pass
else
:
sub_row
.
room
=
sub
.
room_old
.
shortcode
...
...
@@ -219,10 +221,10 @@ def get_substitutions_by_date(date):
# print(subs_raw)
subs
=
row_by_row_helper
(
subs_raw
,
Substitution
)
print
(
subs
)
for
row
in
subs
:
print
(
row
.
classes
)
for
class_
in
row
.
classes
:
print
(
class_
.
name
)
#
print(subs)
#
for row in subs:
#
print(row.classes)
#
for class_ in row.classes:
#
print(class_.name)
subs
.
sort
(
key
=
substitutions_sorter
)
return
subs
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