fix: judge episode downloading

This commit is contained in:
Simon Ding
2025-04-23 11:20:22 +08:00
parent 2641a5fccd
commit 62fd7e2c18

View File

@@ -534,12 +534,12 @@ func (c *client) SetEpisodeStatus(id int, status episode.Status) error {
func (c *client) IsEpisodeDownloadingOrDownloaded(id int) bool { func (c *client) IsEpisodeDownloadingOrDownloaded(id int) bool {
ep, _ := c.GetEpisodeByID(id) ep, _ := c.GetEpisodeByID(id)
his := c.ent.History.Query().Where(history.EpisodeNumsNotNil(), history.StatusNEQ(history.StatusRemoved)).AllX(context.Background()) his := c.ent.History.Query().Where(history.MediaID(ep.MediaID),history.SeasonNum(ep.SeasonNumber), history.StatusEQ(history.StatusRemoved), history.StatusNEQ(history.StatusFail)).AllX(context.Background())
for _, h := range his { for _, h := range his {
if !slices.Contains(h.EpisodeNums, ep.EpisodeNumber) { if len(h.EpisodeNums) == 0 { //season pack download
continue return true
} }
if h.Status != history.StatusFail { if slices.Contains(h.EpisodeNums, ep.EpisodeNumber) {
return true return true
} }
} }