fix N+1 in gradebook importer.

An assignment's context was being loaded once per assignment per
student. This eliminates the N+1 by preloading the context with the
assignments.

closes CNVS-32664

test plan:
 - verify gradebook import still imports

Change-Id: I024b6022dc3dc4279ce3d168da9ae15489e6274f
Reviewed-on: https://gerrit.instructure.com/97031
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
This commit is contained in:
Keith Garner 2016-12-07 17:28:05 -06:00 committed by Keith T. Garner
parent 818825e462
commit 56ce3b0e2c
1 changed files with 1 additions and 0 deletions

View File

@ -76,6 +76,7 @@ class GradebookImporter
def parse!
# preload a ton of data that presumably we'll be querying
@all_assignments = @context.assignments
.preload(:context)
.published
.gradeable
.select(ASSIGNMENT_PRELOADED_FIELDS)