|
|
@ -8,6 +8,8 @@ from django.urls import reverse |
|
|
|
from django.http import HttpResponse |
|
|
|
from django.http import HttpResponseRedirect |
|
|
|
|
|
|
|
from django.contrib.auth.decorators import login_required |
|
|
|
|
|
|
|
from django import template |
|
|
|
from django.template.defaultfilters import stringfilter |
|
|
|
|
|
|
@ -40,7 +42,7 @@ def course(request, cid): |
|
|
|
first_section = course.sections.first() |
|
|
|
first_slide = first_section.slides.first() |
|
|
|
|
|
|
|
if request.user.is_authenticated(): |
|
|
|
if request.user.is_authenticated: |
|
|
|
try: |
|
|
|
# when the user is merely opening the course, jump the last active section (better: last incomplete?) |
|
|
|
user_course = UserCourse.objects.get(course=course, user=request.user) |
|
|
@ -64,7 +66,7 @@ def section(request, cid, seid): |
|
|
|
section = get_object_or_404(Section, pk=seid) |
|
|
|
first_slide = section.slides.first() |
|
|
|
|
|
|
|
if request.user.is_authenticated(): |
|
|
|
if request.user.is_authenticated: |
|
|
|
try: |
|
|
|
user_course = UserCourse.objects.get(course=course, user=request.user) |
|
|
|
|
|
|
@ -97,7 +99,7 @@ def slide(request, cid, seid, slid): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if request.user.is_authenticated(): |
|
|
|
if request.user.is_authenticated: |
|
|
|
try: |
|
|
|
user_course = UserCourse.objects.get(course=course, user=request.user) |
|
|
|
# simply update last user_course action |
|
|
@ -112,7 +114,7 @@ def slide(request, cid, seid, slid): |
|
|
|
|
|
|
|
|
|
|
|
user_solution = None |
|
|
|
if request.user.is_authenticated(): |
|
|
|
if request.user.is_authenticated: |
|
|
|
try: |
|
|
|
user_solution = UserSolution.objects.get(slide=slide, user=request.user) |
|
|
|
|
|
|
|