Mercurial > minori
annotate src/core/anime_season_db.cc @ 291:9a88e1725fd2
*: refactor lots of stuff
I forgot to put this into different commits, oops!
anyway, it doesn't really matter *that* much since this is an
unfinished hobby project anyway. once it starts getting stable
commit history will be more important, but for now it's not
that big of a deal
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Sun, 12 May 2024 16:31:07 -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 } |