Skip to content

Commit

Permalink
Fix (#880)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmi4er4 authored Sep 18, 2024
1 parent 389d4b4 commit 91ed82f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
30 changes: 25 additions & 5 deletions lms/templates/lms/course_offerings.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,32 @@

<script type="text/template" id="courses-list-table-row">
<tr>
<td><% if (co.is_club_course) { %><span data-title="{% trans "CS club course" %}" class="__club"></span><% } %><a href="<%-co.url%>" class="__course"><%-co.name%></a></td>
<td>
<% for (var i = 0; i < co.teachers.length; i++) { %>
<a class="__teacher text-nowrap" href="/teachers/<%=co.teachers[i].id%>/"><%=co.teachers[i].name%></a><% if (i != co.teachers.length - 1) { %>, <% } %>
<td>
<% if (co.is_club_course) { %><span data-title="{% trans "CS club course" %}" class="__club"></span><% } %>
<a href="<%-co.url%>" class="__course"><%-co.name%></a>
<% if (co.duration == COURSE_DURATIONS.FIRST_HALF) { %><i class="fa fa-adjust fa-rotate-180" aria-hidden="true"></i><% } %>
<% if (co.duration == COURSE_DURATIONS.SECOND_HALF) { %><i class="fa fa-adjust" aria-hidden="true"></i><% } %>
</td>
<td>
<% for (var role in co.grouped_teachers) { %>
<% var teachers = co.grouped_teachers[role]; %>
<% if (teachers && teachers.length > 0) { %>
<% if (role == "lecturer") { %>
<b>Лекторы:</b>
<% } else if (role == "seminar") { %>
<b>Семинаристы:</b>
<% } else if (role == "reviewer") { %>
<b><% if (co.is_completed) { %>Помогали<% } else { %>Помогают<% } %> с заданиями:</b>
<% } else if (role == "organizer") { %>
<b>Кураторы курса:</b>
<% } %>
<% for (var i = 0; i < teachers.length; i++) { %>
<a class="__teacher text-nowrap" href="<%= teachers[i].url %>"><%= teachers[i].name %></a><% if (i != teachers.length - 1) { %>, <% } %>
<% } %>
<br>
<% } %>
</td>
<% } %>
</td>
</tr>
</script>

Expand Down
7 changes: 6 additions & 1 deletion lms/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ def get_context_data(self, **kwargs):
SemesterTypes.AUTUMN: pgettext_lazy("adjective", "autumn"),
SemesterTypes.SPRING: pgettext_lazy("adjective", "spring"),
}
duration_options = {
"FIRST_HALF": CourseDurations.FIRST_HALF,
"SECOND_HALF": CourseDurations.SECOND_HALF
}
courses_qs = filterset.qs
terms = group_terms_by_academic_year(courses_qs)
active_academic_year, active_type = self.get_term(filterset, courses_qs)
Expand All @@ -119,7 +123,7 @@ def get_context_data(self, **kwargs):
courses[term.slug] = OfferingsCourseSerializer(cs, many=True).data
context = {
"TERM_TYPES": term_options,
"COURSE_DURATIONS": CourseDurations,
"COURSE_DURATIONS": duration_options,
"branches": filterset.form.fields['branch'].choices,
"terms": terms,
"courses": courses,
Expand All @@ -136,6 +140,7 @@ def get_context_data(self, **kwargs):
},
"terms": terms,
"termOptions": term_options,
"COURSE_DURATIONS": duration_options,
"courses": courses
}).decode('utf-8'),
}
Expand Down

0 comments on commit 91ed82f

Please sign in to comment.