Entity: Fix query in File.AllFilesMissing()

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-05-18 16:36:24 +02:00
parent 39878b3f83
commit a2d5da7afd
3 changed files with 6 additions and 6 deletions

View file

@ -133,9 +133,9 @@ func (m *File) AllFilesMissing() bool {
count := 0
if err := Db().Model(&File{}).
Where("photo_id = ? AND b.file_missing = 0", m.PhotoID).
Where("photo_id = ? AND file_missing = 0", m.PhotoID).
Count(&count).Error; err != nil {
log.Error(err)
log.Errorf("file: %s", err.Error())
}
return count == 0

View file

@ -143,7 +143,7 @@ func TestExif(t *testing.T) {
assert.Equal(t, "", data.Description)
assert.Equal(t, "", data.Copyright)
assert.Equal(t, 0, data.Height) // TODO
assert.Equal(t, 0, data.Width) // TODO
assert.Equal(t, 0, data.Width) // TODO
assert.Equal(t, float32(-38.405193), data.Lat)
assert.Equal(t, float32(144.18896), data.Lng)
assert.Equal(t, 0, data.Altitude)

View file

@ -86,19 +86,19 @@ func TestBaseAbs(t *testing.T) {
func TestSubFileName(t *testing.T) {
t.Run("Test copy 3.jpg", func(t *testing.T) {
result := SubFileName("/testdata/Test (4).jpg",".photoprism", ".xmp", true)
result := SubFileName("/testdata/Test (4).jpg", ".photoprism", ".xmp", true)
assert.Equal(t, "/testdata/.photoprism/Test.xmp", result)
})
t.Run("Test (3).jpg", func(t *testing.T) {
result := SubFileName("/testdata/Test (4).jpg",".photoprism", ".xmp", false)
result := SubFileName("/testdata/Test (4).jpg", ".photoprism", ".xmp", false)
assert.Equal(t, "/testdata/.photoprism/Test (4).xmp", result)
})
t.Run("FOO.XMP", func(t *testing.T) {
result := SubFileName("/testdata/FOO.XMP",".photoprism", ".jpeg", true)
result := SubFileName("/testdata/FOO.XMP", ".photoprism", ".jpeg", true)
assert.Equal(t, "/testdata/.photoprism/FOO.jpeg", result)
})