Code clean-up #56

This commit is contained in:
Michael Mayer 2019-07-02 21:36:47 +02:00
parent 772251ca0d
commit b976c095f3

View file

@ -306,9 +306,9 @@ func (i *Indexer) indexMediaFile(mediaFile *MediaFile) string {
}
if result := i.db.Where("file_type = 'jpg' AND file_primary = 1 AND photo_id = ?", photo.ID).First(&primaryFile); result.Error != nil {
isPrimary = mediaFile.Type() == FileTypeJpeg
isPrimary = mediaFile.IsJpeg()
} else {
isPrimary = mediaFile.Type() == FileTypeJpeg && (fileName == primaryFile.FileName || fileHash == primaryFile.FileHash)
isPrimary = mediaFile.IsJpeg() && (fileName == primaryFile.FileName || fileHash == primaryFile.FileHash)
}
file.PhotoID = photo.ID