fixed upload required

This commit is contained in:
Philipp Häfelfinger 2019-03-20 00:31:09 +01:00
parent a871cfbb11
commit f40308e378

View File

@ -169,12 +169,17 @@ func (d *localDataStore) SavePiwigoIdAndUpdateUploadFlag(md5Sum string, piwigoId
return err
}
stmt, err := tx.Prepare("UPDATE image SET piwigoId = ?, uploadRequired = 0 WHERE md5sum = ?")
uploadRequired := 1
if piwigoId > 0 {
uploadRequired = 0
}
stmt, err := tx.Prepare("UPDATE image SET piwigoId = ?, uploadRequired = ? WHERE md5sum = ?")
if err != nil {
return err
}
_, err = stmt.Exec(piwigoId, md5Sum)
_, err = stmt.Exec(piwigoId, uploadRequired, md5Sum)
if err != nil {
return err
}