Skip to content

Commit 78573b7

Browse files
committed
fix: remove history
1 parent 62fd7e2 commit 78573b7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

db/db.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ func (c *client) GetHistory(id int) *ent.History {
507507
}
508508

509509
func (c *client) DeleteHistory(id int) error {
510-
err := c.ent.History.Update().Where(history.ID(id)).SetStatus(history.StatusRemoved).Exec(context.Background())
510+
err := c.ent.History.Update().Where(history.ID(id)).SetStatus(history.StatusRemoved).Exec(context.Background())
511511
return err
512512
}
513513

@@ -534,7 +534,7 @@ func (c *client) SetEpisodeStatus(id int, status episode.Status) error {
534534

535535
func (c *client) IsEpisodeDownloadingOrDownloaded(id int) bool {
536536
ep, _ := c.GetEpisodeByID(id)
537-
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())
537+
his := c.ent.History.Query().Where(history.MediaID(ep.MediaID), history.SeasonNum(ep.SeasonNumber), history.StatusNEQ(history.StatusRemoved), history.StatusNEQ(history.StatusFail)).AllX(context.Background())
538538
for _, h := range his {
539539
if len(h.EpisodeNums) == 0 { //season pack download
540540
return true
@@ -751,8 +751,7 @@ func (c *client) GetTmdbApiKey() string {
751751
return k
752752
}
753753

754-
755-
func (c *client) AddTorrent2Blacklist(hash, name string, mediaId int) error {
754+
func (c *client) AddTorrent2Blacklist(hash, name string, mediaId int) error {
756755
count := c.ent.Blacklist.Query().Where(blacklist.TorrentHash(hash), blacklist.MediaID(mediaId)).CountX(context.TODO())
757756
if count > 0 { //already exist
758757
log.Infof("torrent %s already in blacklist", hash)
@@ -766,4 +765,4 @@ func (c *client) GetTorrentBlacklist() (ent.Blacklists, error) {
766765
}
767766
func (c *client) DeleteTorrentBlacklist(id int) error {
768767
return c.ent.Blacklist.DeleteOneID(id).Exec(context.Background())
769-
}
768+
}

server/activity.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ func (s *Server) RemoveActivity(c *gin.Context) (interface{}, error) {
113113
}
114114
if !s.db.IsEpisodeDownloadingOrDownloaded(id) && ep.Status != episode.StatusDownloaded {
115115
//没有正在下载中或者下载完成的任务,并且episode状态不是已经下载完成
116+
log.Debugf("set episode (%d) status to missing", id)
116117
s.db.SetEpisodeStatus(id, episode.StatusMissing)
117118
}
118119
}

0 commit comments

Comments
 (0)