-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add endpoints for course statistics
- Loading branch information
1 parent
53d35ec
commit 52c919d
Showing
4 changed files
with
139 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
app/views/course/statistics/aggregate/course_performance.json.jbuilder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# frozen_string_literal: true | ||
show_personalized_timeline = current_course.show_personalized_timeline_features? | ||
show_video = @course_videos.exists? && can?(:analyze_videos, current_course) | ||
is_course_gamified = current_course.gamified? | ||
|
||
json.students @students do |student| | ||
json.id student.id | ||
json.name student.name | ||
json.isPhantom student.phantom? | ||
json.numSubmissions student.assessment_submission_count | ||
json.correctness @correctness_hash[student.id] | ||
|
||
json.learningRate student.latest_learning_rate if show_personalized_timeline | ||
|
||
if is_course_gamified | ||
json.achievementCount student.achievement_count | ||
json.level student.level_number | ||
json.experiencePoints student.experience_points | ||
json.experiencePointsLink course_user_experience_points_records_path(current_course, student) | ||
end | ||
|
||
if show_video | ||
json.videoSubmissionCount student.video_submission_count | ||
json.videoPercentWatched student.video_percent_watched | ||
json.videoSubmissionLink course_user_video_submissions_path(current_course, student) | ||
end | ||
end | ||
|
||
json.hasPersonalizedTimeline @has_personalized_timeline | ||
json.isCourseGamified is_course_gamified | ||
json.showVideo show_video | ||
json.courseVideoCount @course_video_count |
17 changes: 17 additions & 0 deletions
17
app/views/course/statistics/aggregate/course_progression.json.jbuilder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
json.assessments @assessment_info_array do |assessment| | ||
json.id assessment[0] | ||
json.title assessment[1] | ||
json.startAt assessment[2].iso8601 | ||
json.endAt assessment[3]&.iso8601 | ||
end | ||
|
||
json.submissions @user_submission_array do |user| | ||
json.id user[0] | ||
json.name user[1] | ||
json.isPhantom user[2] | ||
json.submissions user[3] do |submission| | ||
json.assessmentId submission[0] | ||
json.submittedAt submission[1].iso8601 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters