try to save some extra writes of albums

This commit is contained in:
sentriz
2022-02-24 20:29:20 +00:00
parent 55c09209b6
commit bb9b52b960
2 changed files with 35 additions and 11 deletions

View File

@@ -553,3 +553,22 @@ func TestCompilationAlbumWithoutAlbumArtist(t *testing.T) {
is.Equal(artists[0].Albums[0].RightPath, pathAlbum)
is.Equal(artists[0].Albums[0].LeftPath, pathArtist+"/")
}
func TestIncrementalScanNoChangeNoUpdatedAt(t *testing.T) {
t.Parallel()
is := is.New(t)
m := mockfs.New(t)
defer m.CleanUp()
m.AddItems()
m.ScanAndClean()
var albumA db.Album
is.NoErr(m.DB().Where("tag_artist_id NOT NULL").Order("updated_at DESC").Find(&albumA).Error)
m.ScanAndClean()
var albumB db.Album
is.NoErr(m.DB().Where("tag_artist_id NOT NULL").Order("updated_at DESC").Find(&albumB).Error)
is.Equal(albumA.UpdatedAt, albumB.UpdatedAt)
}