Skip to content

Instantly share code, notes, and snippets.

@pjanik
Created February 26, 2016 01:30
Show Gist options
  • Save pjanik/f5a6bb2794952e737d96 to your computer and use it in GitHub Desktop.
Save pjanik/f5a6bb2794952e737d96 to your computer and use it in GitHub Desktop.
new student/status, more offerings
around 160ms in total:
Started GET "/portal/students/2/status.json" for 127.0.0.1 at 2016-02-25 17:30:23 -0800
Processing by Portal::StudentsController#status as JSON
Parameters: {"id"=>"2"}
User Load (1.2ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 10 AND (`users`.`state` NOT IN ('disabled')) LIMIT 1
Portal::Teacher Load (1.2ms) SELECT `portal_teachers`.* FROM `portal_teachers` WHERE `portal_teachers`.`user_id` = 10 LIMIT 1
Portal::Student Load (1.1ms) SELECT `portal_students`.* FROM `portal_students` WHERE `portal_students`.`user_id` = 10 LIMIT 1
Portal::Student Load (1.1ms) SELECT `portal_students`.* FROM `portal_students` WHERE `portal_students`.`id` = 2 LIMIT 1
Portal::Learner Load (1.0ms) SELECT `portal_learners`.* FROM `portal_learners` WHERE `portal_learners`.`student_id` = 2 ORDER BY student_id ASC
Portal::Offering Load (1.1ms) SELECT `portal_offerings`.* FROM `portal_offerings` WHERE `portal_offerings`.`id` = 1 LIMIT 1
Report::Learner Load (1.3ms) SELECT `report_learners`.* FROM `report_learners` WHERE `report_learners`.`learner_id` = 2 LIMIT 1
ExternalActivity Load (1.2ms) SELECT `external_activities`.* FROM `external_activities` WHERE `external_activities`.`id` = 1 LIMIT 1
Activity Load (1.2ms) SELECT `activities`.* FROM `activities` WHERE `activities`.`id` = 1 LIMIT 1
Report::LearnerActivity Load (1.0ms) SELECT `report_learner_activity`.* FROM `report_learner_activity` WHERE `report_learner_activity`.`learner_id` = 2
Portal::Offering Load (1.2ms) SELECT `portal_offerings`.* FROM `portal_offerings` WHERE `portal_offerings`.`id` = 2 LIMIT 1
Report::Learner Load (1.2ms) SELECT `report_learners`.* FROM `report_learners` WHERE `report_learners`.`learner_id` = 3 LIMIT 1
ExternalActivity Load (1.1ms) SELECT `external_activities`.* FROM `external_activities` WHERE `external_activities`.`id` = 9 LIMIT 1
Investigation Load (1.0ms) SELECT `investigations`.* FROM `investigations` WHERE `investigations`.`id` = 9 LIMIT 1
Activity Load (1.3ms) SELECT `activities`.* FROM `activities` WHERE `activities`.`investigation_id` = 9 AND `activities`.`teacher_only` = 0 ORDER BY position
Report::LearnerActivity Load (1.2ms) SELECT `report_learner_activity`.* FROM `report_learner_activity` WHERE `report_learner_activity`.`learner_id` = 3
Portal::Offering Load (1.1ms) SELECT `portal_offerings`.* FROM `portal_offerings` WHERE `portal_offerings`.`id` = 3 LIMIT 1
Report::Learner Load (1.1ms) SELECT `report_learners`.* FROM `report_learners` WHERE `report_learners`.`learner_id` = 4 LIMIT 1
ExternalActivity Load (1.1ms) SELECT `external_activities`.* FROM `external_activities` WHERE `external_activities`.`id` = 8 LIMIT 1
Activity Load (1.1ms) SELECT `activities`.* FROM `activities` WHERE `activities`.`id` = 8 LIMIT 1
Report::LearnerActivity Load (1.1ms) SELECT `report_learner_activity`.* FROM `report_learner_activity` WHERE `report_learner_activity`.`learner_id` = 4
Portal::Offering Load (1.1ms) SELECT `portal_offerings`.* FROM `portal_offerings` WHERE `portal_offerings`.`id` = 4 LIMIT 1
Report::Learner Load (1.1ms) SELECT `report_learners`.* FROM `report_learners` WHERE `report_learners`.`learner_id` = 5 LIMIT 1
ExternalActivity Load (1.1ms) SELECT `external_activities`.* FROM `external_activities` WHERE `external_activities`.`id` = 7 LIMIT 1
Activity Load (1.1ms) SELECT `activities`.* FROM `activities` WHERE `activities`.`id` = 7 LIMIT 1
Report::LearnerActivity Load (1.1ms) SELECT `report_learner_activity`.* FROM `report_learner_activity` WHERE `report_learner_activity`.`learner_id` = 5
Portal::Offering Load (1.2ms) SELECT `portal_offerings`.* FROM `portal_offerings` WHERE `portal_offerings`.`id` = 5 LIMIT 1
Report::Learner Load (1.2ms) SELECT `report_learners`.* FROM `report_learners` WHERE `report_learners`.`learner_id` = 6 LIMIT 1
ExternalActivity Load (1.3ms) SELECT `external_activities`.* FROM `external_activities` WHERE `external_activities`.`id` = 6 LIMIT 1
Activity Load (1.1ms) SELECT `activities`.* FROM `activities` WHERE `activities`.`id` = 6 LIMIT 1
Report::LearnerActivity Load (1.1ms) SELECT `report_learner_activity`.* FROM `report_learner_activity` WHERE `report_learner_activity`.`learner_id` = 6
Portal::Offering Load (1.1ms) SELECT `portal_offerings`.* FROM `portal_offerings` WHERE `portal_offerings`.`id` = 6 LIMIT 1
Report::Learner Load (1.1ms) SELECT `report_learners`.* FROM `report_learners` WHERE `report_learners`.`learner_id` = 7 LIMIT 1
ExternalActivity Load (1.1ms) SELECT `external_activities`.* FROM `external_activities` WHERE `external_activities`.`id` = 5 LIMIT 1
Activity Load (1.1ms) SELECT `activities`.* FROM `activities` WHERE `activities`.`id` = 5 LIMIT 1
Report::LearnerActivity Load (1.1ms) SELECT `report_learner_activity`.* FROM `report_learner_activity` WHERE `report_learner_activity`.`learner_id` = 7
Portal::Offering Load (1.1ms) SELECT `portal_offerings`.* FROM `portal_offerings` WHERE `portal_offerings`.`id` = 7 LIMIT 1
Report::Learner Load (1.1ms) SELECT `report_learners`.* FROM `report_learners` WHERE `report_learners`.`learner_id` = 8 LIMIT 1
ExternalActivity Load (1.1ms) SELECT `external_activities`.* FROM `external_activities` WHERE `external_activities`.`id` = 2 LIMIT 1
Activity Load (1.1ms) SELECT `activities`.* FROM `activities` WHERE `activities`.`id` = 2 LIMIT 1
Report::LearnerActivity Load (1.0ms) SELECT `report_learner_activity`.* FROM `report_learner_activity` WHERE `report_learner_activity`.`learner_id` = 8
Portal::Offering Load (1.1ms) SELECT `portal_offerings`.* FROM `portal_offerings` WHERE `portal_offerings`.`id` = 8 LIMIT 1
Report::Learner Load (1.1ms) SELECT `report_learners`.* FROM `report_learners` WHERE `report_learners`.`learner_id` = 9 LIMIT 1
ExternalActivity Load (1.1ms) SELECT `external_activities`.* FROM `external_activities` WHERE `external_activities`.`id` = 3 LIMIT 1
Activity Load (1.1ms) SELECT `activities`.* FROM `activities` WHERE `activities`.`id` = 3 LIMIT 1
Report::LearnerActivity Load (1.1ms) SELECT `report_learner_activity`.* FROM `report_learner_activity` WHERE `report_learner_activity`.`learner_id` = 9
Portal::Offering Load (1.1ms) SELECT `portal_offerings`.* FROM `portal_offerings` WHERE `portal_offerings`.`id` = 10 LIMIT 1
Report::Learner Load (1.2ms) SELECT `report_learners`.* FROM `report_learners` WHERE `report_learners`.`learner_id` = 12 LIMIT 1
ExternalActivity Load (1.2ms) SELECT `external_activities`.* FROM `external_activities` WHERE `external_activities`.`id` = 10 LIMIT 1
Investigation Load (1.1ms) SELECT `investigations`.* FROM `investigations` WHERE `investigations`.`id` = 10 LIMIT 1
Activity Load (1.2ms) SELECT `activities`.* FROM `activities` WHERE `activities`.`investigation_id` = 10 AND `activities`.`teacher_only` = 0 ORDER BY position
Report::LearnerActivity Load (1.1ms) SELECT `report_learner_activity`.* FROM `report_learner_activity` WHERE `report_learner_activity`.`learner_id` = 12
Completed 200 OK in 134.1ms (Views: 0.9ms | ActiveRecord: 58.8ms | Solr: 0.0ms)
user: piotr
http://localhost:9000/portal/students/2/status.json
N+1 Query detected
Portal::Learner => [:offering]
Add to your finder: :include => [:offering]
N+1 Query method call stack
/Users/piotr/Concord/portal/app/models/portal/student.rb:72:in `block in status'
/Users/piotr/Concord/portal/app/models/portal/student.rb:68:in `status'
/Users/piotr/Concord/portal/app/controllers/portal/students_controller.rb:17:in `status'
/Users/piotr/Concord/portal/lib/rack/expand_b64_gzip.rb:35:in `call'
/Users/piotr/Concord/portal/lib/rack/config_session_cookies.rb:42:in `call'
user: piotr
http://localhost:9000/portal/students/2/status.json
N+1 Query detected
Portal::Learner => [:report_learner]
Add to your finder: :include => [:report_learner]
N+1 Query method call stack
/Users/piotr/Concord/portal/app/models/portal/learner.rb:59:in `report_learner'
/Users/piotr/Concord/portal/app/models/report/offering_student_status.rb:72:in `last_run'
/Users/piotr/Concord/portal/app/models/report/offering_student_status.rb:82:in `last_run_string'
/Users/piotr/Concord/portal/app/models/portal/student.rb:75:in `block in status'
/Users/piotr/Concord/portal/app/models/portal/student.rb:68:in `status'
/Users/piotr/Concord/portal/app/controllers/portal/students_controller.rb:17:in `status'
/Users/piotr/Concord/portal/lib/rack/expand_b64_gzip.rb:35:in `call'
/Users/piotr/Concord/portal/lib/rack/config_session_cookies.rb:42:in `call'
user: piotr
http://localhost:9000/portal/students/2/status.json
N+1 Query detected
Portal::Learner => [:learner_activities]
Add to your finder: :include => [:learner_activities]
N+1 Query method call stack
/Users/piotr/Concord/portal/app/models/report/offering_student_status.rb:60:in `activity_complete_percent'
/Users/piotr/Concord/portal/app/models/portal/student.rb:78:in `block (2 levels) in status'
/Users/piotr/Concord/portal/app/models/portal/student.rb:77:in `map'
/Users/piotr/Concord/portal/app/models/portal/student.rb:77:in `block in status'
/Users/piotr/Concord/portal/app/models/portal/student.rb:68:in `status'
/Users/piotr/Concord/portal/app/controllers/portal/students_controller.rb:17:in `status'
/Users/piotr/Concord/portal/lib/rack/expand_b64_gzip.rb:35:in `call'
/Users/piotr/Concord/portal/lib/rack/config_session_cookies.rb:42:in `call'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment