jikan-me / jikan-rest

The REST API for Jikan
https://docs.api.jikan.moe/
MIT License
428 stars 270 forks source link

bugfix: only allow results that are within specified season/year and nulls #448

Closed irfan-dahir closed 11 months ago

irfan-dahir commented 11 months ago

Issue/Discussion: https://discord.com/channels/460491088004907029/1119461866322800662

There are a handful of entries like 52991 start on September 29th which is technically in the range of the summer season (which is why it returns in the results for summer 2023). However, it's officially listed under the Fall season in premiered.


This PR attempts to resolve this issue by filtering down the results to

  1. It contains the premiered string (e.g "Summer 2023") from a specific seasonal endpoint request
  2. It contains null values (for OVA, ONA, Movie, etc that have premiered set to null)
  3. It contains entries within the range given by the current season's start_date and end_date (Existing behavior)
irfan-dahir commented 11 months ago

@pushrbx

I would also add a new function maybe with the arguments you added, which wraps around getAiredBetween and adds the extra filters based on premiered, if it's possible to override the query builder that way. (haven't checked yet)

I tested this but getAiredBetween returns with the orderBy query afterwards, so any added query does not work.

So I added premiered as an argument for getAiredBetween and it handles the logic inside it instead. Let me know if that works here?