Compare commits
No commits in common. "aa811021948c9956c180d014740a27072d85bd50" and "2292ae32c2ce061e9997421cc519e9d00e6ac492" have entirely different histories.
aa81102194
...
2292ae32c2
@ -360,48 +360,28 @@ func (a *App) GetAniListUserWatchingList(page int, perPage int, sort string) Ani
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
returnedBody, status := AniListQuery(body, true)
|
returnedBody, _ := AniListQuery(body, true)
|
||||||
|
|
||||||
var badPost struct {
|
|
||||||
Errors []struct {
|
|
||||||
Message string `json:"message"`
|
|
||||||
Status int `json:"status"`
|
|
||||||
Locations []struct {
|
|
||||||
Line int `json:"line"`
|
|
||||||
Column int `json:"column"`
|
|
||||||
} `json:"locations"`
|
|
||||||
} `json:"errors"`
|
|
||||||
Data any `json:"data"`
|
|
||||||
}
|
|
||||||
var post AniListCurrentUserWatchList
|
var post AniListCurrentUserWatchList
|
||||||
if status == "200 OK" {
|
err := json.Unmarshal(returnedBody, &post)
|
||||||
err := json.Unmarshal(returnedBody, &post)
|
if err != nil {
|
||||||
if err != nil {
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
log.Printf("Failed at unmarshal, %s\n", err)
|
|
||||||
}
|
|
||||||
// Getting the real total, finding the real last page and storing that in the Page info
|
|
||||||
statuses := post.Data.Page.MediaList[0].User.Statistics.Anime.Statuses
|
|
||||||
var total int
|
|
||||||
for _, status := range statuses {
|
|
||||||
if status.Status == "CURRENT" {
|
|
||||||
total = status.Count
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lastPage := total / perPage
|
|
||||||
|
|
||||||
post.Data.Page.PageInfo.Total = total
|
|
||||||
post.Data.Page.PageInfo.LastPage = lastPage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if status == "403 Forbidden" {
|
// Getting the real total, finding the real last page and storing that in the Page info
|
||||||
err := json.Unmarshal(returnedBody, &badPost)
|
statuses := post.Data.Page.MediaList[0].User.Statistics.Anime.Statuses
|
||||||
if err != nil {
|
var total int
|
||||||
log.Printf("Failed at unmarshal, %s\n", err)
|
for _, status := range statuses {
|
||||||
|
if status.Status == "CURRENT" {
|
||||||
|
total = status.Count
|
||||||
}
|
}
|
||||||
log.Fatal(badPost.Errors[0].Message)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastPage := total / perPage
|
||||||
|
|
||||||
|
post.Data.Page.PageInfo.Total = total
|
||||||
|
post.Data.Page.PageInfo.LastPage = lastPage
|
||||||
|
|
||||||
return post
|
return post
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,13 +441,6 @@
|
|||||||
bind:value={currentAniListAnime.data.MediaList.progress}
|
bind:value={currentAniListAnime.data.MediaList.progress}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<div>
|
|
||||||
/ {currentAniListAnime.data.MediaList.media
|
|
||||||
.nextAiringEpisode.episode !== 0
|
|
||||||
? currentAniListAnime.data.MediaList.media
|
|
||||||
.nextAiringEpisode.episode - 1
|
|
||||||
: currentAniListAnime.data.MediaList.media.episodes}
|
|
||||||
</div>
|
|
||||||
<div>
|
<div>
|
||||||
of {currentAniListAnime.data.MediaList.media.episodes}
|
of {currentAniListAnime.data.MediaList.media.episodes}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user