fix gradebook_history to ignore placeholder submissions
Expands the not_placeholder definition to include items where the submission.workflow_state is graded and adds not_placeholder to submission calls in SubmissionList and in gradebook_history in the GradebooksController fixes CNVS-37503 test plan: - Have a new course with 5 students - Create 5 assignments assigned to all students with a due date - In the rails console execute: - Setting.set('gradebook_history_submission_count_threshold', 20) - Grade one or two assignments for one student - Visit gradebook history, ensure it loads and shows the proper data Change-Id: If44b4be519c4806d060e15b4506c003555839508 Reviewed-on: https://gerrit.instructure.com/116058 Reviewed-by: Derek Bender <djbender@instructure.com> Reviewed-by: Neil Gupta <ngupta@instructure.com> Tested-by: Jenkins QA-Review: Anju Reddy <areddy@instructure.com> Product-Review: Keith T. Garner <kgarner@instructure.com>
This commit is contained in:
parent
fe05df0e49
commit
3e4f9ad172
|
@ -430,7 +430,7 @@ class GradebooksController < ApplicationController
|
|||
# in large courses in a performant manner. Until that happens, we're
|
||||
# disabling it over a certain threshold.
|
||||
#
|
||||
submissions_count = @context.submissions.count
|
||||
submissions_count = @context.submissions.not_placeholder.count
|
||||
submissions_limit = Setting.get('gradebook_history_submission_count_threshold', '0').to_i
|
||||
if submissions_limit == 0 || submissions_count <= submissions_limit
|
||||
# TODO this whole thing could go a LOT faster if you just got ALL the versions of ALL the submissions in this course then did a ruby sort_by day then grader
|
||||
|
|
|
@ -1685,7 +1685,7 @@ class Submission < ActiveRecord::Base
|
|||
scope :having_submission, -> { where("submissions.submission_type IS NOT NULL") }
|
||||
scope :without_submission, -> { where(submission_type: nil, workflow_state: "unsubmitted") }
|
||||
scope :not_placeholder, -> {
|
||||
where("submissions.submission_type IS NOT NULL or submissions.excused or submissions.score IS NOT NULL")
|
||||
where("submissions.submission_type IS NOT NULL or submissions.excused or submissions.score IS NOT NULL or submissions.workflow_state = 'graded'")
|
||||
}
|
||||
|
||||
scope :include_user, -> { preload(:user) }
|
||||
|
|
|
@ -203,7 +203,7 @@ class SubmissionList
|
|||
|
||||
# A hash of the current grades of each submission, keyed by submission.id
|
||||
def current_grade_map
|
||||
@current_grade_map ||= self.course.submissions.inject({}) do |hash, submission|
|
||||
@current_grade_map ||= self.course.submissions.not_placeholder.inject({}) do |hash, submission|
|
||||
grader = if submission.grader_id.present?
|
||||
self.grader_map[submission.grader_id].try(:name)
|
||||
end
|
||||
|
@ -295,7 +295,7 @@ class SubmissionList
|
|||
|
||||
# A list of all versions in YAML format
|
||||
def yaml_list
|
||||
@yaml_list ||= self.course.submissions.preload(:versions).map do |s|
|
||||
@yaml_list ||= self.course.submissions.not_placeholder.preload(:versions).map do |s|
|
||||
s.versions.map { |v| v.yaml }
|
||||
end.flatten
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue