Mercurial > minori
diff src/services/anilist.cpp @ 73:f1fc8b04bc63
...: merge heads
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Tue, 03 Oct 2023 05:00:08 -0400 |
parents | 64e5f427c6a2 |
children | 5ccb99bfa605 |
line wrap: on
line diff
--- a/src/services/anilist.cpp Tue Oct 03 04:58:38 2023 -0400 +++ b/src/services/anilist.cpp Tue Oct 03 05:00:08 2023 -0400 @@ -98,20 +98,22 @@ } std::string ListStatusToString(const Anime::Anime& anime) { - std::unordered_map<Anime::ListStatus, std::string> map = { - {Anime::ListStatus::CURRENT, "CURRENT" }, - {Anime::ListStatus::PLANNING, "PLANNING" }, - {Anime::ListStatus::COMPLETED, "COMPLETED"}, - {Anime::ListStatus::DROPPED, "DROPPED" }, - {Anime::ListStatus::PAUSED, "PAUSED" } - }; - if (anime.GetUserIsRewatching()) return "REWATCHING"; - if (map.find(anime.GetUserStatus()) == map.end()) - return "CURRENT"; - return map[anime.GetUserStatus()]; + switch (anime.GetUserStatus()) { + case Anime::ListStatus::PLANNING: + return "PLANNING"; + case Anime::ListStatus::COMPLETED: + return "COMPLETED"; + case Anime::ListStatus::DROPPED: + return "DROPPED"; + case Anime::ListStatus::PAUSED: + return "PAUSED"; + default: + break; + } + return "CURRENT"; } Date ParseDate(const nlohmann::json& json) {