ApiV2-GraphQL-Docs icon indicating copy to clipboard operation
ApiV2-GraphQL-Docs copied to clipboard

Unexpected results for anime seasons

Open erengy opened this issue 7 years ago • 4 comments

According to the documentation, seasons are defined as following:

enum MediaSeason {
  # Months December to February
  WINTER
  # Months March to May
  SPRING
  # Months June to August
  SUMMER
  # Months September to November
  FALL
}

This example query (and subsequent pages) for the Winter 2017 anime season should return series that start airing between December 2016 to February 2017. However, it's somehow missing some anime from December 2016, and it erroneously includes anime from March 2017 and even December 2017.

erengy avatar Dec 07 '17 15:12 erengy

I think these were probably just mistakes when the mods input the season data, I've fixed all the incorrect ones tho I'll keep on eye on this just in case there is some issue in our mod tools causing this.

joshstar avatar Dec 07 '17 16:12 joshstar

It's not just Winter 2017, though. I see similar issues when I randomly check other anime seasons.

I assumed that the season field of Media objects was set automatically using the startDate field. Is this not the case? In pseudocode, you could do something like:

function setSeasonFields($media) {
  switch ($media.startDate.month) {
    case 12,  1,  2: $media.season = MediaSeason::WINTER;
    case  3,  4,  5: $media.season = MediaSeason::SPRING;
    case  6,  7,  8: $media.season = MediaSeason::SUMMER;
    case  9, 10, 11: $media.season = MediaSeason::FALL;
  }

  $media.seasonYear = $media.startDate.year;
  if ($media.startDate.month == 12) {
    $media.seasonYear += 1;
  }
}

erengy avatar Dec 07 '17 18:12 erengy

Hmm okay I shall look into, I did recently do some automated changes to the season data so something might have gone a bit astray there.

Season data isn't automatically based on the start date of a show as often all the information we'll get is the season and year, but nothing about the exact month or day it will air, and we'd rather not assume the month until that is officially announced.

joshstar avatar Dec 07 '17 18:12 joshstar

Ah, I see. I think you can have the best of both worlds: Allow mods to manually set the season field without providing the exact date, but automatically overwrite it when startDate.month is available.

erengy avatar Dec 07 '17 19:12 erengy