Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Untis
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-Untis
Commits
6b95d549
Commit
6b95d549
authored
6 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Add badges and color in PDF | Some design changes in PDF [TIMETABLE/SUBSTITUTIONS]
parent
c404437a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
biscuit/apps/untis/sub.py
+83
-0
83 additions, 0 deletions
biscuit/apps/untis/sub.py
with
83 additions
and
0 deletions
biscuit/apps/untis/sub.py
+
83
−
0
View file @
6b95d549
...
@@ -22,6 +22,7 @@ TYPE_CANCELLATION = 1
...
@@ -22,6 +22,7 @@ TYPE_CANCELLATION = 1
TYPE_TEACHER_CANCELLATION
=
2
TYPE_TEACHER_CANCELLATION
=
2
TYPE_CORRIDOR
=
3
TYPE_CORRIDOR
=
3
def
parse_type_of_untis_flags
(
flags
):
def
parse_type_of_untis_flags
(
flags
):
type_
=
TYPE_SUBSTITUTION
type_
=
TYPE_SUBSTITUTION
if
"
E
"
in
flags
:
if
"
E
"
in
flags
:
...
@@ -129,6 +130,88 @@ def substitutions_sorter(sub):
...
@@ -129,6 +130,88 @@ def substitutions_sorter(sub):
return
sort_by
return
sort_by
class
SubRow
(
object
):
def
__init__
(
self
):
self
.
color
=
"
black
"
self
.
css_class
=
"
black-text
"
self
.
lesson
=
""
self
.
classes
=
""
self
.
teacher
=
""
self
.
subject
=
""
self
.
room
=
""
self
.
text
=
""
self
.
extra
=
""
def
generate_sub_table
(
subs
):
sub_rows
=
[]
for
sub
in
subs
:
sub_row
=
SubRow
()
sub_row
.
color
=
"
black
"
if
sub
.
type
==
1
or
sub
.
type
==
2
:
sub_row
.
css_class
=
"
green-text
"
sub_row
.
color
=
"
green
"
elif
sub
.
type
==
3
:
sub_row
.
css_class
=
"
blue-text
"
sub_row
.
color
=
"
blue
"
if
sub
.
type
==
3
:
sub_row
.
lesson
=
"
{}./{}
"
.
format
(
sub
.
lesson
-
1
,
sub
.
lesson
)
else
:
sub_row
.
lesson
=
"
{}.
"
.
format
(
sub
.
lesson
)
for
class_
in
sub
.
classes
:
sub_row
.
classes
=
class_
.
name
if
sub
.
type
==
1
:
sub_row
.
teacher
=
"
<s>{}</s>
"
.
format
(
sub
.
teacher_old
.
shortcode
)
elif
sub
.
teacher_new
and
sub
.
teacher_old
:
sub_row
.
teacher
=
"
<s>{}</s> → <strong>{}</strong>
"
.
format
(
sub
.
teacher_old
.
shortcode
,
sub
.
teacher_new
.
shortcode
)
elif
sub
.
teacher_new
and
not
sub
.
teacher_old
:
sub_row
.
teacher
=
"
<strong>{}</strong>
"
.
format
(
sub
.
teacher_new
.
shortcode
)
else
:
sub_row
.
teacher
=
"
<strong>{}</strong>
"
.
format
(
sub
.
teacher_old
.
shortcode
)
if
sub
.
type
==
3
:
sub_row
.
subject
=
"
Aufsicht
"
elif
sub
.
type
==
1
or
sub
.
type
==
2
:
sub_row
.
subject
=
"
<s>{}</s>
"
.
format
(
sub
.
subject_old
.
shortcode
)
elif
sub
.
subject_new
and
sub
.
subject_old
:
sub_row
.
subject
=
"
<s>{}</s> → <strong>{}</strong>
"
.
format
(
sub
.
subject_old
.
shortcode
,
sub
.
subject_new
.
shortcode
)
elif
sub
.
subject_new
and
not
sub
.
subject_old
:
sub_row
.
subject
=
"
<strong>{}</strong>
"
.
format
(
sub
.
subject_new
.
shortcode
)
else
:
sub_row
.
subject
=
"
<strong>{}</strong>
"
.
format
(
sub
.
subject_old
.
shortcode
)
if
sub
.
type
==
3
:
sub_row
.
room
=
sub
.
corridor
.
name
elif
sub
.
type
==
1
or
sub
.
type
==
2
:
pass
elif
sub
.
room_new
and
sub
.
room_old
:
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
else
:
sub_row
.
room
=
sub
.
room_old
.
shortcode
sub_row
.
text
=
sub
.
text
sub_row
.
badge
=
None
if
sub
.
type
==
1
:
sub_row
.
badge
=
"
Schüler frei
"
elif
sub
.
type
==
2
:
sub_row
.
badge
=
"
Lehrer frei
"
sub_row
.
extra
=
"
{} {}
"
.
format
(
sub
.
id
,
sub
.
lesson_id
)
sub_rows
.
append
(
sub_row
)
return
sub_rows
def
get_substitutions_by_date
(
date
):
def
get_substitutions_by_date
(
date
):
subs_raw
=
run_default_filter
(
subs_raw
=
run_default_filter
(
run_using
(
models
.
Substitution
.
objects
.
filter
(
date
=
date_to_untis_date
(
date
)).
order_by
(
"
classids
"
,
"
lesson
"
)),
run_using
(
models
.
Substitution
.
objects
.
filter
(
date
=
date_to_untis_date
(
date
)).
order_by
(
"
classids
"
,
"
lesson
"
)),
...
...
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