Skip to content

Fix bug with find endpoint returning TV episodes for TV season searches and vice versa#19

Open
qapn wants to merge 1 commit into
18Months:masterfrom
qapn:master
Open

Fix bug with find endpoint returning TV episodes for TV season searches and vice versa#19
qapn wants to merge 1 commit into
18Months:masterfrom
qapn:master

Conversation

@qapn

@qapn qapn commented Oct 30, 2020

Copy link
Copy Markdown

This is my first open source PR so apologies if I've done this incorrectly.

The find endpoint plucks the TV season search results for the TV episode find method and vice versa. I fixed this typo and updated the related tests.

For example, using the imdb_id for Silicon Valley S01E01 tt3222784, we should expect to see no results for a tv_season search and one result for a tv_episode search:

On 1.3.1 (incorrectly returns a TV episode result from a tv_season search):

[1] pry(main)> ap Tmdb::Find.tv_episode('tt3222784', external_source: 'imdb_id')
[]
=> nil
[2] pry(main)> ap Tmdb::Find.tv_season('tt3222784', external_source: 'imdb_id')
[
    [0] Tmdb::TV {
               :air_date => "2014-04-06",
         :episode_number => 1,
                     :id => 972002,
                   :name => "Minimum Viable Product",
               :overview => "Attending an elaborate launch party, Richard and his computer programmer friends - Big Head, Dinesh and Gilfoyle - dream of making it big. Instead, they're living in the communal Hacker Hostel owned by former programmer Erlich, who gets to claim ten percent of anything they invent there. When it becomes clear that Richard has developed a powerful compression algorithm for his website, Pied Piper, he finds himself courted by Gavin Belson, his egomaniacal corporate boss, who offers a $10 million buyout by his firm, Hooli. But Richard holds back when well-known investor Peter Gregory makes a counteroffer.",
        :production_code => "",
          :season_number => 1,
                :show_id => 60573,
             :still_path => "/zXr9tjwoL7L3YYKiXjMutwRS20U.jpg",
           :vote_average => 7.25,
             :vote_count => 16
    }
]
=> nil

With this PR (expected behaviour):

[1] pry(main)> ap Tmdb::Find.tv_episode('tt3222784', external_source: 'imdb_id')
[
    [0] Tmdb::TV {
               :air_date => "2014-04-06",
         :episode_number => 1,
                     :id => 972002,
                   :name => "Minimum Viable Product",
               :overview => "Attending an elaborate launch party, Richard and his computer programmer friends - Big Head, Dinesh and Gilfoyle - dream of making it big. Instead, they're living in the communal Hacker Hostel owned by former programmer Erlich, who gets to claim ten percent of anything they invent there. When it becomes clear that Richard has developed a powerful compression algorithm for his website, Pied Piper, he finds himself courted by Gavin Belson, his egomaniacal corporate boss, who offers a $10 million buyout by his firm, Hooli. But Richard holds back when well-known investor Peter Gregory makes a counteroffer.",
        :production_code => "",
          :season_number => 1,
                :show_id => 60573,
             :still_path => "/zXr9tjwoL7L3YYKiXjMutwRS20U.jpg",
           :vote_average => 7.25,
             :vote_count => 16
    }
]
=> nil
[2] pry(main)> ap Tmdb::Find.tv_season('tt3222784', external_source: 'imdb_id')
[]
=> nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant