consumet / consumet.ts

Nodejs library that provides high-level APIs for obtaining information on various entertainment media such as books, movies, comic books, anime, manga, and so on.
https://consumet.org/extensions/list/
GNU General Public License v3.0
376 stars 205 forks source link

fix: issue #523 allows a broader range of totalSeasons values #524

Closed ICEPrey closed 1 month ago

ICEPrey commented 2 months ago

What kind of change does this PR introduce? This PR changes the findIdFromTitle method in the TMDB class. It updates the filtering logic for totalSeasons to allow for a range of +=2 seasons compared to the extraData.totalSeasons value. This change is to resolve the issue where the result demon slayer was not being returned due to strict matching of the totalSeasons value.

Did you add tests for your changes? Yes

If relevant, did you update the documentation?

no

Summary This PR addresses an issue where the findIdFromTitle method in the TMDB class was not returning the desired result for the Demon Slayer anime. The issue was caused by strict matching of the totalSeasons value. The changes introduced in this PR update the totalSeasons filtering logic to allow for a range of +=2 seasons which should increase the flexibility in matching the seasons value. The comment describing the filtering logic has also been updated to reflect these changes. https://github.com/consumet/consumet.ts/issues/523#issue-2266536037

Other information

ICEPrey commented 2 months ago

oh should I just replace

test('returns a filled object of anime data', async () => {
  const data = await tmdb.fetchMediaInfo('60735', 'tv');
  expect(data).not.toBeNull();
  expect(data.episodes).not.toEqual([]);
  expect(data.description).not.toBeNull();
});

in the main tmdb.test.ts with

test('returns a filled object of anime data', async () => {
  const data = await tmdb.fetchMediaInfo('85937', 'tv');
  expect(data).not.toBeNull();
  expect(data.episodes).not.toEqual([]);
  expect(data.description).not.toBeNull();
});