Performance Optimizations:
1. Add index on testrun.submissionId 2. replace lti_parameters.size with lti_parameters.present? to prevent COUNT query Signed-off-by: Sebastian Serth <Sebastian.Serth@student.hpi.de>
This commit is contained in:
@ -5,6 +5,6 @@ module LtiHelper
|
|||||||
lti_parameters = LtiParameter.where(consumers_id: consumer_id,
|
lti_parameters = LtiParameter.where(consumers_id: consumer_id,
|
||||||
external_users_id: external_user_id,
|
external_users_id: external_user_id,
|
||||||
exercises_id: exercise_id).lis_outcome_service_url?
|
exercises_id: exercise_id).lis_outcome_service_url?
|
||||||
!lti_parameters.nil? && lti_parameters.size > 0
|
!lti_parameters.nil? && lti_parameters.present?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddIndexForTestrunSubmissionId < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_index :testruns, :submission_id
|
||||||
|
end
|
||||||
|
end
|
@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20180815115351) do
|
ActiveRecord::Schema.define(version: 20180823135317) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@ -383,6 +383,8 @@ ActiveRecord::Schema.define(version: 20180815115351) do
|
|||||||
t.string "cause"
|
t.string "cause"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "testruns", ["submission_id"], name: "index_testruns_on_submission_id", using: :btree
|
||||||
|
|
||||||
create_table "user_exercise_feedbacks", force: :cascade do |t|
|
create_table "user_exercise_feedbacks", force: :cascade do |t|
|
||||||
t.integer "exercise_id", null: false
|
t.integer "exercise_id", null: false
|
||||||
t.integer "user_id", null: false
|
t.integer "user_id", null: false
|
||||||
|
Reference in New Issue
Block a user