Mercurial > minori
annotate src/core/anime_season_db.cc @ 280:9b6e12c14a1e
chore: merge
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Mon, 06 May 2024 17:23:30 -0400 |
parents | dd211ff68b36 |
children | 5d3c9b31aa6e |
rev | line source |
---|---|
260
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
1 #include "core/anime_season_db.h" |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
2 #include "core/anime.h" |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
3 #include "core/anime_db.h" |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
4 #include "core/date.h" |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
5 |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
6 namespace Anime::Season { |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
7 |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
8 std::vector<int> GetAllAnimeForSeason(SeriesSeason season, Date::Year year) { |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
9 std::vector<int> ret; |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
10 |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
11 for (const auto& [id, anime] : db.items) { |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
12 std::optional<Date::Year> anime_year = anime.GetAirDate().GetYear(); |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
13 if (anime.GetSeason() == season && anime_year && anime_year.value() == year) |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
14 ret.push_back(id); |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
15 } |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
16 |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
17 return ret; |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
18 } |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
19 |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
20 } |