changeset 184:09492158bcc5

anime: etc. comments and changes
author Paper <mrpapersonic@gmail.com>
date Mon, 04 Dec 2023 13:44:42 -0500
parents 01d259b9c89f
children 62e336597bb7
files include/core/anime.h src/services/anilist.cc
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/include/core/anime.h	Mon Dec 04 13:40:42 2023 -0500
+++ b/include/core/anime.h	Mon Dec 04 13:44:42 2023 -0500
@@ -65,7 +65,7 @@
 struct ListInformation {
 		int id = 0;
 		int progress = 0;
-		int score = 0;
+		int score = 0; // always in the AniList 100-based form internally
 		ListStatus status = ListStatus::NOT_IN_LIST;
 		Date started;
 		Date completed;
--- a/src/services/anilist.cc	Mon Dec 04 13:40:42 2023 -0500
+++ b/src/services/anilist.cc	Mon Dec 04 13:44:42 2023 -0500
@@ -253,9 +253,9 @@
 	 * float score,
 	 * int scoreRaw,
 	 * int progress,
-	 * int progressVolumes,
-	 * int repeat,
-	 * int priority,
+	 * int progressVolumes, // manga-specific.
+	 * int repeat, // rewatch
+	 * int priority,  
 	 * bool private,
 	 * string notes,
 	 * bool hiddenFromStatusLists,
@@ -265,10 +265,13 @@
 	 * Date completedAt
 	 **/
 	Anime::Anime& anime = Anime::db.items[id];
+	if (!anime.IsInUserList())
+		return 0;
+
 	constexpr std::string_view query = "mutation ($media_id: Int, $progress: Int, $status: MediaListStatus, $score: Int, "
-							  "$notes: String, $start: FuzzyDateInput, $comp: FuzzyDateInput) {\n"
+							  "$notes: String, $start: FuzzyDateInput, $comp: FuzzyDateInput, $repeat: Int) {\n"
 							  "  SaveMediaListEntry (mediaId: $media_id, progress: $progress, status: $status, "
-							  "scoreRaw: $score, notes: $notes, startedAt: $start, completedAt: $comp) {\n"
+							  "scoreRaw: $score, notes: $notes, startedAt: $start, completedAt: $comp, repeat: $repeat) {\n"
 							  "    id\n"
 							  "  }\n"
 							  "}\n";
@@ -282,7 +285,8 @@
 			{"score",    anime.GetUserScore()},
 			{"notes",    anime.GetUserNotes()},
 			{"start",    anime.GetUserDateStarted().GetAsAniListJson()},
-			{"comp",     anime.GetUserDateCompleted().GetAsAniListJson()}
+			{"comp",     anime.GetUserDateCompleted().GetAsAniListJson()},
+			{"repeat",   anime.GetUserRewatchedTimes()}
 		}}
 	};
 	// clang-format on