def get(self, request, course_id, format=None): """ Get comment number of the current course. """ result = { "comments": course_stat.comment_total_count( SlashSeparatedCourseKey.from_deprecated_string(course_id)), } return Response(result)
def get(self, request, course_id, format=None): """ Get some frequency update data of the current course. """ try: course = Course.objects.get(course_id=course_id) except: return Response(status=status.HTTP_404_NOT_FOUND) course_key = SlashSeparatedCourseKey.from_deprecated_string(course_id) result = { "enrollments": course_stat.enrollment_total_count(course_key), "comments": course_stat.comment_total_count(course_key), "serialized": course.serialized, } return Response(result)