Skip to content

Commit

Permalink
feat: improve performance table to support tutor filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuhanming committed Dec 6, 2022
1 parent 3c05627 commit 4a5c8c1
Show file tree
Hide file tree
Showing 9 changed files with 238 additions and 130 deletions.
7 changes: 2 additions & 5 deletions app/controllers/course/statistics/aggregate_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ def course_progression
end

def course_performance
@students = students
@students = course_users.students.ordered_by_experience_points.with_performance_statistics
@correctness_hash = correctness_hash
@service = group_manager_preload_service
end

def all_staff
Expand Down Expand Up @@ -99,10 +100,6 @@ def course_users
@course_users ||= current_course.course_users.includes(:groups)
end

def students
@students = current_course.course_users.students.with_performance_statistics
end

def group_manager_preload_service
staff = course_users.staff
Course::GroupManagerPreloadService.new(staff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,32 @@ is_course_gamified = current_course.gamified?
course_videos = current_course.videos
course_video_count = course_videos.exists? ? course_videos.count : 0
show_video = course_videos.exists? && can?(:analyze_videos, current_course)
no_group_managers = @service.no_group_managers?

json.hasPersonalizedTimeline has_personalized_timeline
json.isCourseGamified is_course_gamified
json.showVideo show_video
json.courseVideoCount course_video_count
json.hasGroupManagers !no_group_managers

json.students @students do |student|
json.id student.id
json.name student.name
json.nameLink json.nameLink course_user_path(current_course, student)
json.isPhantom student.phantom?
json.numSubmissions student.assessment_submission_count
json.correctness @correctness_hash[student.id]

json.learningRate student.latest_learning_rate if has_personalized_timeline

unless no_group_managers
json.groupManagers @service.group_managers_of(student) do |manager|
json.id manager.id
json.name manager.name
json.nameLink course_user_path(current_course, manager)
end
end

if is_course_gamified
json.achievementCount student.achievement_count
json.level student.level_number
Expand Down
1 change: 1 addition & 0 deletions client/app/bundles/course/statistics/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export function fetchCoursePerformanceStatistics(failureMessage) {
isCourseGamified: response.data.isCourseGamified,
showVideo: response.data.showVideo,
courseVideoCount: parseInt(response.data.courseVideoCount, 10),
hasGroupManagers: response.data.hasGroupManagers,
});
})
.catch(() => {
Expand Down
Loading

0 comments on commit 4a5c8c1

Please sign in to comment.