]> git.lizzy.rs Git - go-anidb.git/commitdiff
anidb: Add new mylist entry as Unknown if MyListSet doesn't say anything
authorDiogo Franco (Kovensky) <diogomfranco@gmail.com>
Fri, 26 Jul 2013 04:33:48 +0000 (01:33 -0300)
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>
Fri, 26 Jul 2013 04:33:48 +0000 (01:33 -0300)
mylistmanip.go

index beca6bb02d5f39d53458dbfe0acf49f85ffdf4c4..f643c5fab5f2ff0bc8065d4f837aa3ed47fc8709 100644 (file)
@@ -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)