From: Diogo Franco (Kovensky) Date: Fri, 26 Jul 2013 04:33:48 +0000 (-0300) Subject: anidb: Add new mylist entry as Unknown if MyListSet doesn't say anything X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=b4d837a46c155bc10195814cb54160490c8b577e;p=go-anidb.git anidb: Add new mylist entry as Unknown if MyListSet doesn't say anything --- diff --git a/mylistmanip.go b/mylistmanip.go index beca6bb..f643c5f 100644 --- a/mylistmanip.go +++ b/mylistmanip.go @@ -67,11 +67,10 @@ func (set *MyListSet) update(uid UID, f *File, lid LID) { eg.Add(f.EpisodeNumber) mla.EpisodesPerGroup[f.GID] = eg + newState := MyListStateUnknown if set != nil { if set.State != nil { - es := mla.EpisodesWithState[*set.State] - es.Add(f.EpisodeNumber) - mla.EpisodesWithState[*set.State] = es + newState = *set.State } if set.Watched != nil && *set.Watched || @@ -80,6 +79,10 @@ func (set *MyListSet) update(uid UID, f *File, lid LID) { } } + es := mla.EpisodesWithState[newState] + es.Add(f.EpisodeNumber) + mla.EpisodesWithState[newState] = es + Cache.Set(mla, "mylist-anime", uid, f.AID) Cache.Chtime(mla.Cached, "mylist-anime", uid, f.AID)