Skip to content

Commit ba8cc92

Browse files
committed
linter issues
1 parent b219e2f commit ba8cc92

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

tcf_website/api/urls.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@
1515

1616
urlpatterns = [
1717
path("", include(router.urls)),
18-
path('enrollment/<int:course_id>/', views.get_section_enrollment, name='get_section_enrollment'),
18+
path(
19+
'enrollment/<int:course_id>/',
20+
views.get_section_enrollment,
21+
name='get_section_enrollment'
22+
),
1923
]

tcf_website/api/views.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@
44
from rest_framework import viewsets
55
from django.http import JsonResponse
66

7-
from ..models import Course, Department, Instructor, School, Semester, Subdepartment, Section, SectionEnrollment
7+
from ..models import (
8+
Course,
9+
Department,
10+
Instructor,
11+
School,
12+
Section,
13+
SectionEnrollment,
14+
Semester,
15+
Subdepartment,
16+
)
817
from .filters import InstructorFilter
918
from .serializers import (
1019
CourseAllStatsSerializer,
@@ -141,9 +150,10 @@ def get_queryset(self):
141150

142151

143152
def get_section_enrollment(request, course_id):
153+
"""Retrieves enrollment data for all sections of a given course."""
144154
sections = Section.objects.filter(course_id=course_id)
145155
enrollment_data = {}
146-
156+
147157
for section in sections:
148158
section_enrollment = SectionEnrollment.objects.filter(section=section).first()
149159
if section_enrollment:
@@ -153,5 +163,5 @@ def get_section_enrollment(request, course_id):
153163
'waitlist_taken': section_enrollment.waitlist_taken,
154164
'waitlist_limit': section_enrollment.waitlist_limit
155165
}
156-
166+
157167
return JsonResponse({'enrollment_data': enrollment_data})

tcf_website/templates/course/course_professor.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,17 @@ <h2 class="mr-md-3">{{ course.title }}</h2>
238238

239239
<script>
240240
document.querySelector("#sectionInfo").style.marginTop = "-" + window.getComputedStyle(sectionInfo).height;
241+
function toggleSections(div) {
242+
const arrow = div.getElementsByTagName("i")[0],
243+
sectionInfo = document.querySelector("#sectionInfo");
244+
arrow.classList.toggle("rotated");
245+
sectionInfo.classList.toggle("show");
246+
if (sectionInfo.classList.contains("show")) {
247+
sectionInfo.style.marginTop = '10px';
248+
} else {
249+
sectionInfo.style.marginTop = "-" + window.getComputedStyle(sectionInfo).height;
250+
}
251+
}
241252

242253
const courseId = "{{ course.id }}";
243254

0 commit comments

Comments
 (0)