Skip to content

Commit 367a7ab

Browse files
fix(browse): give instructors rating attribute for their average rating for a course
1 parent c8c0ccd commit 367a7ab

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tcf_website/views/browse.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
from django.conf import settings
99
from django.core.exceptions import ObjectDoesNotExist
10-
from django.db.models import Avg, CharField, Count, F, Q, Value, Sum, Prefetch
11-
from django.db.models.functions import Concat, Coalesce
10+
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
11+
from django.db.models import Avg, CharField, Count, F, Prefetch, Q, Sum, Value
12+
from django.db.models.functions import Coalesce, Concat
1213
from django.http import Http404
1314
from django.shortcuts import get_object_or_404, redirect, render
1415
from django.urls import reverse
15-
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
1616

1717
from ..models import (
1818
Answer,
@@ -270,6 +270,8 @@ def course_view(
270270
if num and times
271271
}
272272

273+
instructor.rating = instructor.average_rating_for_course(course)
274+
273275
dept = course.subdepartment.department
274276

275277
# Navigation breadcrumbs

0 commit comments

Comments
 (0)