From f40308e378242376cb43b4b33cee50519281d836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4felfinger?= Date: Wed, 20 Mar 2019 00:31:09 +0100 Subject: [PATCH] fixed upload required --- internal/app/datastore.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/app/datastore.go b/internal/app/datastore.go index 817d535..98c1a07 100644 --- a/internal/app/datastore.go +++ b/internal/app/datastore.go @@ -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 }