-
Notifications
You must be signed in to change notification settings - Fork 78
feat(gradebook): add gradebook page with column picker, CSV export, and statistics bridge #8400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LWS49
wants to merge
2
commits into
master
Choose a base branch
from
lws49/feat-gradebook-export
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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,22 @@ | ||
| # frozen_string_literal: true | ||
| class Course::GradebookComponent < SimpleDelegator | ||
| include Course::ControllerComponentHost::Component | ||
|
|
||
| def self.display_name | ||
| 'Gradebook' | ||
| end | ||
|
|
||
| def sidebar_items | ||
| return [] unless can?(:read_gradebook, current_course) | ||
|
|
||
| [ | ||
| { | ||
| key: self.class.key, | ||
| icon: :gradebook, | ||
| type: :normal, | ||
| weight: 9, | ||
| path: course_gradebook_path(current_course) | ||
| } | ||
| ] | ||
| end | ||
| end |
This file contains hidden or 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,56 @@ | ||
| # frozen_string_literal: true | ||
| class Course::GradebookController < Course::ComponentController | ||
| before_action :authorize_read_gradebook! | ||
| before_action :preload_levels, only: [:index] | ||
|
|
||
| def index | ||
| respond_to do |format| | ||
| format.json do | ||
| @published_assessments = fetch_published_assessments | ||
| @categories, @tabs = fetch_categories_and_tabs | ||
| @students = fetch_students | ||
| assessment_ids = @published_assessments.pluck(:id) | ||
| @assessment_max_grades = Course::Assessment.max_grades(assessment_ids) | ||
| @submissions = Course::Assessment::Submission.grade_summary( | ||
| student_ids: @students.map(&:user_id), | ||
| assessment_ids: assessment_ids | ||
| ) | ||
| end | ||
| end | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def authorize_read_gradebook! | ||
| authorize! :read_gradebook, current_course | ||
| end | ||
|
|
||
| def component | ||
| current_component_host[:course_gradebook_component] | ||
| end | ||
|
|
||
| def fetch_categories_and_tabs | ||
| tabs = @published_assessments.map(&:tab).uniq(&:id) | ||
| [tabs.map(&:category).uniq(&:id), tabs] | ||
| end | ||
|
|
||
| def fetch_students | ||
| current_course.course_users.students.without_phantom_users. | ||
| calculated(:experience_points).includes(user: :emails).to_a | ||
| end | ||
|
|
||
| def fetch_published_assessments | ||
| current_course.assessments. | ||
| published. | ||
| includes(tab: :category). | ||
| joins(tab: :category). | ||
| reorder('course_assessment_categories.weight, course_assessment_tabs.weight, course_assessments.id') | ||
| end | ||
|
|
||
| # Pre-loads course levels to avoid N+1 queries when each course_user.level_number is rendered. | ||
| # level_number is derived, not an association (it buckets EXP against course.levels), so it | ||
| # can't be added to fetch_students' includes. See Course::LevelsConcern#level_for. | ||
| def preload_levels | ||
| current_course.levels.to_a | ||
| end | ||
| end | ||
This file contains hidden or 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
17 changes: 0 additions & 17 deletions
17
app/jobs/course/statistics/assessments_score_summary_download_job.rb
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,9 @@ | ||
| # frozen_string_literal: true | ||
| module Course::GradebookAbilityComponent | ||
| include AbilityHost::Component | ||
|
|
||
| def define_permissions | ||
| can :read_gradebook, Course, id: course.id if course_user&.staff? | ||
| super | ||
| end | ||
| end |
This file contains hidden or 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
This file contains hidden or 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
82 changes: 0 additions & 82 deletions
82
app/services/course/statistics/assessments_score_summary_download_service.rb
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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,36 @@ | ||
| # frozen_string_literal: true | ||
| json.categories @categories do |cat| | ||
| json.id cat.id | ||
| json.title cat.title | ||
| end | ||
|
|
||
| json.tabs @tabs do |tab| | ||
| json.id tab.id | ||
| json.title tab.title | ||
| json.categoryId tab.category_id | ||
| end | ||
|
|
||
| json.assessments @published_assessments do |assessment| | ||
| json.id assessment.id | ||
| json.title assessment.title | ||
| json.tabId assessment.tab_id | ||
| json.maxGrade @assessment_max_grades[assessment.id] || 0 | ||
| end | ||
|
|
||
| json.students @students do |course_user| | ||
| json.id course_user.user_id | ||
| json.name course_user.name | ||
| json.email course_user.user.email | ||
| json.externalId course_user.external_id | ||
| json.level course_user.level_number | ||
| json.totalXp course_user.experience_points | ||
| end | ||
|
|
||
| json.submissions @submissions do |sub| | ||
| json.studentId sub.student_id | ||
| json.assessmentId sub.assessment_id | ||
| json.submissionId sub.submission_id | ||
| json.grade sub.grade&.to_f | ||
| end | ||
|
|
||
| json.gamificationEnabled current_course.gamified? |
This file contains hidden or 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
This file contains hidden or 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,15 @@ | ||
| import { GradebookData } from 'types/course/gradebook'; | ||
|
|
||
| import { APIResponse } from 'api/types'; | ||
|
|
||
| import BaseCourseAPI from './Base'; | ||
|
|
||
| export default class GradebookAPI extends BaseCourseAPI { | ||
| get #urlPrefix(): string { | ||
| return `/courses/${this.courseId}/gradebook`; | ||
| } | ||
|
|
||
| index(): APIResponse<GradebookData> { | ||
| return this.client.get(this.#urlPrefix); | ||
| } | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.