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
1aeb3d4e
Commit
1aeb3d4e
authored
5 years ago
by
Frank Poetzsch-Heffter
Browse files
Options
Downloads
Plain Diff
Merge branch 'dev-1.1' into feature/several-days-in-one-tex-document-#288
parents
2b689285
21339a4f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
biscuit/apps/untis/api.py
+45
-2
45 additions, 2 deletions
biscuit/apps/untis/api.py
with
45 additions
and
2 deletions
biscuit/apps/untis/api.py
+
45
−
2
View file @
1aeb3d4e
...
@@ -10,6 +10,7 @@ TYPE_CLASS = 2
...
@@ -10,6 +10,7 @@ TYPE_CLASS = 2
from
datetime
import
date
from
datetime
import
date
def
run_all
(
obj
,
filter_term
=
True
):
def
run_all
(
obj
,
filter_term
=
True
):
return
run_default_filter
(
run_using
(
obj
).
all
(),
filter_term
=
filter_term
)
return
run_default_filter
(
run_using
(
obj
).
all
(),
filter_term
=
filter_term
)
...
@@ -74,6 +75,13 @@ class Teacher(object):
...
@@ -74,6 +75,13 @@ class Teacher(object):
else
:
else
:
return
"
Unbekannt
"
return
"
Unbekannt
"
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
Teacher
):
# don't attempt to compare against unrelated types
return
NotImplemented
return
self
.
id
==
other
.
id
def
create
(
self
,
db_obj
):
def
create
(
self
,
db_obj
):
self
.
filled
=
True
self
.
filled
=
True
self
.
id
=
db_obj
.
teacher_id
self
.
id
=
db_obj
.
teacher_id
...
@@ -116,6 +124,13 @@ class Class(object):
...
@@ -116,6 +124,13 @@ class Class(object):
else
:
else
:
return
"
Unbekannt
"
return
"
Unbekannt
"
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
Class
):
# don't attempt to compare against unrelated types
return
NotImplemented
return
self
.
id
==
other
.
id
def
create
(
self
,
db_obj
):
def
create
(
self
,
db_obj
):
self
.
filled
=
True
self
.
filled
=
True
self
.
id
=
db_obj
.
class_id
self
.
id
=
db_obj
.
class_id
...
@@ -187,6 +202,13 @@ class Room(object):
...
@@ -187,6 +202,13 @@ class Room(object):
else
:
else
:
return
"
Unbekannt
"
return
"
Unbekannt
"
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
Room
):
# don't attempt to compare against unrelated types
return
NotImplemented
return
self
.
id
==
other
.
id
def
create
(
self
,
db_obj
):
def
create
(
self
,
db_obj
):
self
.
filled
=
True
self
.
filled
=
True
self
.
id
=
db_obj
.
room_id
self
.
id
=
db_obj
.
room_id
...
@@ -219,6 +241,13 @@ class Corridor(object):
...
@@ -219,6 +241,13 @@ class Corridor(object):
else
:
else
:
return
"
Unbekannt
"
return
"
Unbekannt
"
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
Corridor
):
# don't attempt to compare against unrelated types
return
NotImplemented
return
self
.
id
==
other
.
id
def
create
(
self
,
db_obj
):
def
create
(
self
,
db_obj
):
self
.
filled
=
True
self
.
filled
=
True
self
.
id
=
db_obj
.
corridor_id
self
.
id
=
db_obj
.
corridor_id
...
@@ -248,6 +277,19 @@ class Subject(object):
...
@@ -248,6 +277,19 @@ class Subject(object):
self
.
color
=
None
self
.
color
=
None
self
.
hex_color
=
None
self
.
hex_color
=
None
def
__str__
(
self
):
if
self
.
filled
:
return
self
.
shortcode
or
"
Unbekannt
"
else
:
return
"
Unbekannt
"
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
Teacher
):
# don't attempt to compare against unrelated types
return
NotImplemented
return
self
.
id
==
other
.
id
def
create
(
self
,
db_obj
):
def
create
(
self
,
db_obj
):
self
.
filled
=
True
self
.
filled
=
True
self
.
id
=
db_obj
.
subject_id
self
.
id
=
db_obj
.
subject_id
...
@@ -384,6 +426,7 @@ def get_all_events_by_date(date):
...
@@ -384,6 +426,7 @@ def get_all_events_by_date(date):
def
get_raw_lessons
():
def
get_raw_lessons
():
return
run_all
(
models
.
Lesson
.
objects
)
return
run_all
(
models
.
Lesson
.
objects
)
###########
###########
# HOLIDAY #
# HOLIDAY #
###########
###########
...
@@ -408,7 +451,7 @@ class Holiday(object):
...
@@ -408,7 +451,7 @@ class Holiday(object):
def
get_today_holidays
(
date
):
def
get_today_holidays
(
date
):
#db_holidays = row_by_row(models.Holiday, Holiday)
#
db_holidays = row_by_row(models.Holiday, Holiday)
d_i
=
int
(
date_to_untis_date
(
date
))
d_i
=
int
(
date_to_untis_date
(
date
))
db_rows
=
run_all
(
models
.
Holiday
.
objects
.
filter
(
dateto__gte
=
d_i
,
datefrom__lte
=
d_i
),
filter_term
=
False
)
db_rows
=
run_all
(
models
.
Holiday
.
objects
.
filter
(
dateto__gte
=
d_i
,
datefrom__lte
=
d_i
),
filter_term
=
False
)
return
row_by_row_helper
(
db_rows
,
Holiday
)
return
row_by_row_helper
(
db_rows
,
Holiday
)
\ No newline at end of file
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