mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Fix missing date filter (#2434)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
package sqlite_test
|
||||
|
||||
import (
|
||||
"math"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
@@ -562,6 +563,28 @@ func TestGalleryQueryIsMissingTags(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestGalleryQueryIsMissingDate(t *testing.T) {
|
||||
withTxn(func(r models.Repository) error {
|
||||
sqb := r.Gallery()
|
||||
isMissing := "date"
|
||||
galleryFilter := models.GalleryFilterType{
|
||||
IsMissing: &isMissing,
|
||||
}
|
||||
|
||||
galleries := queryGallery(t, sqb, &galleryFilter, nil)
|
||||
|
||||
// three in four scenes have no date
|
||||
assert.Len(t, galleries, int(math.Ceil(float64(totalGalleries)/4*3)))
|
||||
|
||||
// ensure date is null, empty or "0001-01-01"
|
||||
for _, g := range galleries {
|
||||
assert.True(t, !g.Date.Valid || g.Date.String == "" || g.Date.String == "0001-01-01")
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func TestGalleryQueryPerformers(t *testing.T) {
|
||||
withTxn(func(r models.Repository) error {
|
||||
sqb := r.Gallery()
|
||||
|
||||
Reference in New Issue
Block a user