Skip to content

Commit

Permalink
Modify Sort By Watched Movies to Sort Rather than Filter
Browse files Browse the repository at this point in the history
  • Loading branch information
mikevallano committed Aug 17, 2016
1 parent ba5162f commit 534126a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -18,7 +18,7 @@ tester2.rb
tester.html.erb
tester2.html.erb
tester.js.erb
coverage/*
/coverage/*
spec/vcr_cassettes/*

# Ignore application configuration
Expand Down
3 changes: 2 additions & 1 deletion app/models/user.rb
Expand Up @@ -99,7 +99,8 @@ def all_movies_by_highest_vote_average
end

def all_movies_by_recently_watched
self.watched_movies.order('screenings.date_watched').reverse.uniq
watched = self.watched_movies.order('screenings.date_watched').reverse.uniq
(watched + all_movies).uniq
end

def all_movies_not_on_a_list
Expand Down
2 changes: 0 additions & 2 deletions spec/controllers/movies_controller_spec.rb
Expand Up @@ -10,13 +10,11 @@
let(:movie) { FactoryGirl.create(:movie) }
let(:list) { FactoryGirl.create(:list, owner_id: user.id) }
let(:listing) { FactoryGirl.create(:listing, list_id: list.id, movie_id: movie.id) }
let(:screening) { FactoryGirl.create(:screening, user_id: user.id, movie_id: movie.id) }

shared_examples_for 'with logged in user' do

describe "GET #index" do
it "assigns all movies as @movies" do
screening
get :index
expect(assigns(:movies)).to include(movie)
end
Expand Down
3 changes: 1 addition & 2 deletions spec/features/movies_feature_spec.rb
Expand Up @@ -244,7 +244,6 @@
counter = Movie.first.id
30.times do
FactoryGirl.create(:listing, list_id: list.id, movie_id: Movie.find(counter).id)
FactoryGirl.create(:screening, user_id: user.id, movie_id: Movie.find(counter).id)
counter += 1
end
visit(movie_path(Movie.last))
Expand Down Expand Up @@ -407,4 +406,4 @@

end #feature do

end #final
end #final

0 comments on commit 534126a

Please sign in to comment.