Skip to content
Snippets Groups Projects
Commit 68c2db69 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Hint work

parent b02a695f
No related branches found
No related tags found
1 merge request!86Merge school-apps
from timetable.models import Hint
def get_all_hints_by_date(date):
hints = filter_date(date)
return hints
def get_all_hints_by_time_period(from_date, to_date):
print(from_date, to_date)
hints = Hint.objects.filter(from_date__gte=from_date, to_date__lte=to_date).order_by("from_date", "classes")
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
......@@ -11,6 +11,7 @@ from material import Fieldset, Row
from schoolapps.settings import WEEK_DAYS
from timetable.filters import HintFilter
from timetable.forms import HintForm
from timetable.hints import get_all_hints_by_date, get_all_hints_by_time_period
from timetable.pdf import generate_class_tex, generate_pdf
from untisconnect.plan import get_plan, TYPE_TEACHER, TYPE_CLASS, TYPE_ROOM, parse_lesson_times
......@@ -110,6 +111,12 @@ def plan(request, plan_type, plan_id, regular="", year=timezone.datetime.now().y
plan = get_plan(_type, plan_id, smart=smart, monday_of_week=monday_of_week)
# print(parse_lesson_times())
# Get hints
if smart:
friday = monday_of_week + datetime.timedelta(days=4)
hints = list(get_all_hints_by_time_period(monday_of_week, friday))
print(hints)
context = {
"smart": smart,
"type": _type,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment