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

Standard: Smart Plan | Bug in skipping weekend in "Mein Plan"

parent 61526a2e
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@
{% for teacher in teachers %}
<li class="collection-item avatar">
<i class="circle">{{ teacher.shortcode }}</i><!-- Shortcode -->
<a href="{% url 'timetable_plan' 'teacher' teacher.id %}">{{ teacher.first_name }}
<a href="{% url 'timetable_smart_plan' 'teacher' teacher.id %}">{{ teacher.first_name }}
<strong>{{ teacher.name }}</strong></a>
</li>
{% endfor %}
......@@ -22,7 +22,7 @@
{% for class in classes %}
<li class="collection-item avatar">
<i class="circle">{{ class.name }}</i>
<a href="{% url 'timetable_plan' 'class' class.id %}"><strong>{{ class.name }}</strong></a>
<a href="{% url 'timetable_smart_plan' 'class' class.id %}"><strong>{{ class.name }}</strong></a>
<p>
{{ class.text1|default:"" }} – {{ class.text2|default:"" }} <br>
Raum: {{ class.room.name|default:"---" }}
......@@ -38,7 +38,7 @@
{% for room in rooms %}
<li class="collection-item avatar">
<i class="circle">{{ room.shortcode }}</i>
<a href="{% url 'timetable_plan' 'room' room.id %}"><strong>{{ room.name }}</strong></a>
<a href="{% url 'timetable_smart_plan' 'room' room.id %}"><strong>{{ room.name }}</strong></a>
</li>
{% endfor %}
</ul>
......
......@@ -3,7 +3,7 @@
{% if smart %}
var week = {{ selected_week }};
function goToCalendarWeek(cw) {
window.location.href = "{% url "timetable_smart_plan" raw_type id "smart" %}/{{ selected_year }}/" + cw;
window.location.href = "{% url "timetable_smart_plan" raw_type id %}/{{ selected_year }}/" + cw;
}
function onCalendarWeekChanged() {
goToCalendarWeek($("#calendar-week").val(), {{ selected_year }});
......@@ -53,7 +53,8 @@
class="badge new primary-color left-align">SMART PLAN</span>
</p>&nbsp;
<a class="waves-effect waves-light btn-flat no-print" href="{% url "timetable_plan" raw_type id %}">
<a class="waves-effect waves-light btn-flat no-print"
href="{% url "timetable_regular_plan" raw_type id "regular" %}">
<i class="material-icons left">slideshow</i>
Regelplan anzeigen
</a>
......@@ -86,7 +87,7 @@
{% else %}
{# Show if regular #}
<a class="waves-effect waves-light btn-flat no-print"
href="{% url "timetable_smart_plan" raw_type id "smart" %}">
href="{% url "timetable_smart_plan" raw_type id %}">
<i class="material-icons left">slideshow</i>
SMART PLAN ANZEIGEN
</a>
......
......@@ -7,7 +7,7 @@
<h4>Lehrkräfte</h4>
{% for teacher in teachers %}
<a class="waves-effect waves-light btn btn-timetable-quicklaunch"
href="{% url 'timetable_plan' 'teacher' teacher.id %}">
href="{% url 'timetable_smart_plan' 'teacher' teacher.id %}">
{{ teacher.shortcode }}
</a><!-- Shortcode -->
{% endfor %}
......@@ -18,7 +18,7 @@
{% for class in classes %}
<a class="waves-effect waves-light btn btn-timetable-quicklaunch"
href="{% url 'timetable_plan' 'class' class.id %}">
href="{% url 'timetable_smart_plan' 'class' class.id %}">
{{ class.name }}
</a>
{% endfor %}
......@@ -29,7 +29,7 @@
<h4>Räume</h4>
{% for room in rooms %}
<a class="waves-effect waves-light btn btn-timetable-quicklaunch"
href="{% url 'timetable_plan' 'room' room.id %}">
href="{% url 'timetable_smart_plan' 'room' room.id %}">
{{ room.shortcode }}
</a>
{% endfor %}
......
......@@ -6,9 +6,9 @@ urlpatterns = [
path('my', views.my_plan, name='timetable_my_plan'),
path('my/<int:year>/<int:month>/<int:day>/', views.my_plan, name='timetable_my_plan'),
path('quick/', views.quicklaunch, name='timetable_quicklaunch'),
path('<str:plan_type>/<int:plan_id>', views.plan, name='timetable_plan'),
path('<str:plan_type>/<int:plan_id>/<str:smart>', views.plan, name='timetable_smart_plan'),
path('<str:plan_type>/<int:plan_id>/<str:smart>/<int:year>/<int:calendar_week>', views.plan,
path('<str:plan_type>/<int:plan_id>', views.plan, name='timetable_smart_plan'),
path('<str:plan_type>/<int:plan_id>/<str:regular>', views.plan, name='timetable_regular_plan'),
path('<str:plan_type>/<int:plan_id>/<int:year>/<int:calendar_week>', views.plan,
name='timetable_smart_plan_week'),
path('substitutions/', views.substitutions, name='timetable_substitutions'),
path('substitutions/<int:year>/<int:month>/<int:day>/', views.substitutions, name='timetable_substitutions_date'),
......
......@@ -79,12 +79,12 @@ def get_calendar_week(calendar_week, year=timezone.datetime.now().year):
@login_required
@permission_required("timetable.show_plan")
def plan(request, plan_type, plan_id, smart="", year=timezone.datetime.now().year,
def plan(request, plan_type, plan_id, regular="", year=timezone.datetime.now().year,
calendar_week=timezone.datetime.now().isocalendar()[1]):
if smart == "smart":
smart = True
else:
if regular == "regular":
smart = False
else:
smart = True
monday_of_week = get_calendar_week(calendar_week, year)["first_day"]
# print(monday_of_week)
......@@ -127,12 +127,11 @@ def my_plan(request, year=None, day=None, month=None):
date = timezone.datetime.now()
if year is not None and day is not None and month is not None:
date = timezone.datetime(year=year, month=month, day=day)
next_weekday = get_next_weekday(date)
if next_weekday != date:
print("Hi")
return redirect("timetable_my_plan", next_weekday.year, next_weekday.month, next_weekday.day)
print(date)
print(get_next_weekday(date))
# Get next weekday if it is a weekend
next_weekday = get_next_weekday(date)
if next_weekday != date:
return redirect("timetable_my_plan", next_weekday.year, next_weekday.month, next_weekday.day)
calendar_week = date.isocalendar()[1]
monday_of_week = get_calendar_week(calendar_week, date.year)["first_day"]
......
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