Skip to content

Commit

Permalink
add some preloads and stop mocking out the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jennifer Konikowski committed Jun 7, 2019
1 parent 8fb69bf commit fc2055f
Show file tree
Hide file tree
Showing 5 changed files with 434 additions and 462 deletions.
5 changes: 2 additions & 3 deletions app/controllers/reviews_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ class ReviewsController < ApplicationController
def index
if params[:course_id].to_i.zero?
if params[:school_id].to_i.zero?
@reviews = Review.all.preload(:user, course: [:school])
@reviews = Review.all
else
set_school
@reviews = Review.preload(:user, course: [:school]).where(school_id: @school.id)
@reviews = Review.preload(:user, course: [:school]).joins(:course).where('courses.school_id = (?)', @school.id)
end
else
set_school
Expand Down Expand Up @@ -43,7 +43,6 @@ def edit
# POST /schools/1/courses/1/reviews.json
def create
@review = Review.new(review_params)

respond_to do |format|
if @review.save
format.html do
Expand Down
100 changes: 51 additions & 49 deletions coverage/.resultset.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
null,
null,
1,
96,
92,
null,
null,
1,
Expand Down Expand Up @@ -108,17 +108,19 @@
null,
null,
1,
9,
8,
1,
null,
8,
8,
7,
7,
null,
null,
null,
null,
null,
1,
2,
null,
null,
null,
1,
Expand All @@ -138,32 +140,32 @@
null,
5,
5,
3,
3,
null,
2,
2,
null,
3,
null,
4,
2,
null,
6,
3,
null,
null,
null,
null,
null,
1,
5,
5,
2,
2,
null,
1,
4,
4,
3,
3,
null,
2,
null,
6,
3,
null,
2,
1,
null,
null,
null,
null,
Expand All @@ -181,16 +183,16 @@
null,
null,
1,
28,
26,
null,
null,
1,
11,
10,
null,
null,
null,
1,
15,
14,
null,
null
],
Expand All @@ -214,17 +216,17 @@
null,
null,
1,
8,
7,
2,
1,
null,
1,
1,
null,
null,
6,
6,
6,
5,
5,
5,
null,
null,
null,
Expand All @@ -247,28 +249,27 @@
null,
1,
5,
null,
5,
5,
3,
3,
null,
2,
2,
null,
null,
null,
3,
null,
4,
2,
null,
6,
3,
null,
null,
null,
null,
null,
null,
1,
5,
5,
4,
4,
2,
2,
null,
Expand All @@ -277,8 +278,8 @@
null,
2,
null,
6,
3,
4,
2,
null,
null,
null,
Expand All @@ -297,20 +298,20 @@
null,
null,
1,
27,
25,
null,
null,
1,
26,
24,
null,
null,
1,
12,
11,
null,
null,
null,
1,
15,
14,
null,
null,
null,
Expand Down Expand Up @@ -477,6 +478,7 @@
null,
1,
13,
13,
null,
null,
null,
Expand Down Expand Up @@ -607,23 +609,23 @@
1,
null,
1,
106,
106,
106,
106,
102,
102,
102,
102,
null,
99,
99,
99,
99,
95,
95,
95,
95,
1,
null,
99,
95,
2,
null,
99,
95,
null,
90,
86,
null,
null,
null,
Expand Down Expand Up @@ -662,6 +664,6 @@
null
]
},
"timestamp": 1559832052
"timestamp": 1559940230
}
}
Loading

0 comments on commit fc2055f

Please sign in to comment.