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
d981d7a1
Verified
Commit
d981d7a1
authored
4 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Remove unusers hints code
parent
b74ee569
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/chronos/filters.py
+0
-16
0 additions, 16 deletions
aleksis/apps/chronos/filters.py
aleksis/apps/chronos/hints.py
+0
-56
0 additions, 56 deletions
aleksis/apps/chronos/hints.py
with
0 additions
and
72 deletions
aleksis/apps/chronos/filters.py
deleted
100644 → 0
+
0
−
16
View file @
b74ee569
import
django_filters
from
django.forms
import
Form
from
material
import
Fieldset
,
Row
from
.models
import
Hint
class
HintForm
(
Form
):
layout
=
Row
(
"
from_date
"
,
"
to_date
"
,
"
classes
"
,
"
teachers
"
)
class
HintFilter
(
django_filters
.
FilterSet
):
class
Meta
:
model
=
Hint
fields
=
[
'
from_date
'
,
"
to_date
"
,
"
classes
"
,
"
teachers
"
]
form
=
HintForm
This diff is collapsed.
Click to expand it.
aleksis/apps/chronos/hints.py
deleted
100644 → 0
+
0
−
56
View file @
b74ee569
import
datetime
from
timetable.models
import
Hint
def
get_all_hints_by_date
(
date
):
hints
=
filter_date
(
date
)
return
hints
def
get_all_hints_by_class_and_time_period
(
_class
,
from_date
,
to_date
):
hints_tmp
=
get_all_hints_by_time_period
(
from_date
,
to_date
)
hints_match
=
[]
for
hint
in
hints_tmp
:
if
_class
.
id
in
[
x
.
class_id
for
x
in
hint
.
classes
.
all
()]:
hints_match
.
append
(
hint
)
return
hints_match
def
get_all_hints_for_teachers_by_time_period
(
from_date
,
to_date
):
hints_tmp
=
get_all_hints_by_time_period
(
from_date
,
to_date
)
hints_match
=
[]
for
hint
in
hints_tmp
:
if
hint
.
teachers
:
hints_match
.
append
(
hint
)
return
hints_match
def
get_all_hints_not_for_teachers_by_time_period
(
from_date
,
to_date
):
hints_tmp
=
get_all_hints_by_time_period
(
from_date
,
to_date
)
hints_match
=
[]
for
hint
in
hints_tmp
:
if
not
hint
.
teachers
:
hints_match
.
append
(
hint
)
return
hints_match
def
get_all_hints_by_time_period
(
from_date
,
to_date
):
print
(
from_date
,
to_date
)
delta
=
to_date
-
from_date
print
(
delta
.
days
+
1
)
week_days
=
[
from_date
+
datetime
.
timedelta
(
days
=
i
)
for
i
in
range
(
delta
.
days
+
1
)]
hints
=
[]
for
week_day
in
week_days
:
hints_tmp
=
get_all_hints_by_date
(
week_day
)
for
hint
in
hints_tmp
:
if
hint
not
in
hints
:
hints
.
append
(
hint
)
print
(
hints
)
return
hints
def
filter_date
(
date
):
hints
=
Hint
.
objects
.
filter
(
from_date__lte
=
date
,
to_date__gte
=
date
).
order_by
(
"
from_date
"
,
"
classes
"
)
return
hints
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