Mercurial > minori
diff src/core/anime_season_db.cc @ 260:dd211ff68b36
pages/seasons: add initial functionality
the menu doesn't work yet, but it's a good start
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 03 Apr 2024 19:48:38 -0400 |
parents | |
children | 5d3c9b31aa6e |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/core/anime_season_db.cc Wed Apr 03 19:48:38 2024 -0400 @@ -0,0 +1,20 @@ +#include "core/anime_season_db.h" +#include "core/anime.h" +#include "core/anime_db.h" +#include "core/date.h" + +namespace Anime::Season { + +std::vector<int> GetAllAnimeForSeason(SeriesSeason season, Date::Year year) { + std::vector<int> ret; + + for (const auto& [id, anime] : db.items) { + std::optional<Date::Year> anime_year = anime.GetAirDate().GetYear(); + if (anime.GetSeason() == season && anime_year && anime_year.value() == year) + ret.push_back(id); + } + + return ret; +} + +}