optimize students with no submissions report
fixes CNVS-10782 test plan - run students with no submissions report - it should run much faster Change-Id: Ib57bac057e61a9ed7a0b2656b3f80c6efe134aa6 Reviewed-on: https://gerrit.instructure.com/29350 Reviewed-by: Cody Cutrer <cody@instructure.com> Tested-by: Jenkins <jenkins@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com> QA-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
de1ba85157
commit
5a08e254b6
|
@ -0,0 +1,12 @@
|
|||
class AddIndexOnSubmissionsSubmittedAt < ActiveRecord::Migration
|
||||
tag :postdeploy
|
||||
disable_ddl_transaction!
|
||||
|
||||
def self.up
|
||||
add_index :submissions, :submitted_at, algorithm: :concurrently
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :submissions, :submitted_at
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
class EnrollmentsOnRootAccountAndCourse < ActiveRecord::Migration
|
||||
tag :postdeploy
|
||||
disable_ddl_transaction!
|
||||
|
||||
def self.up
|
||||
add_index :enrollments, [:root_account_id, :course_id],
|
||||
algorithm: :concurrently
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :enrollments, [:root_account_id, :course_id]
|
||||
end
|
||||
end
|
|
@ -67,9 +67,9 @@ module Canvas::AccountReports
|
|||
CSV.open(file, "w") do |csv|
|
||||
|
||||
condition = [""]
|
||||
condition.first << " AND submitted_at > ?"
|
||||
condition.first << " AND s.submitted_at > ?"
|
||||
condition << start_at
|
||||
condition.first << " AND submitted_at < ?"
|
||||
condition.first << " AND s.submitted_at < ?"
|
||||
condition << end_at
|
||||
|
||||
time_span_join = Pseudonym.send(:sanitize_sql, condition)
|
||||
|
@ -86,13 +86,12 @@ module Canvas::AccountReports
|
|||
INNER JOIN pseudonyms p ON e.user_id = p.user_id
|
||||
AND courses.root_account_id = p.account_id
|
||||
INNER JOIN users u ON u.id = p.user_id").
|
||||
where("NOT EXISTS (SELECT user_id
|
||||
where("NOT EXISTS (SELECT s.user_id
|
||||
FROM submissions s
|
||||
INNER JOIN assignments a ON s.assignment_id = a.id
|
||||
INNER JOIN courses c ON a.context_id = c.id
|
||||
AND a.context_type = 'Course'
|
||||
AND a.context_id = courses.id
|
||||
WHERE s.user_id = p.user_id
|
||||
AND c.id = courses.id
|
||||
#{time_span_join})")
|
||||
|
||||
no_subs = add_term_scope(no_subs)
|
||||
|
|
Loading…
Reference in New Issue