diff pkg/imports/sr.go @ 1193:58acc343b1b6

Implemented the db stuff of the review process. Needs testing.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 16 Nov 2018 18:35:09 +0100
parents 064d44ccc6f2
children bc4b642c8d04
line wrap: on
line diff
--- a/pkg/imports/sr.go	Fri Nov 16 17:51:44 2018 +0100
+++ b/pkg/imports/sr.go	Fri Nov 16 18:35:09 2018 +0100
@@ -63,6 +63,10 @@
 
 type srJobCreator struct{}
 
+func init() {
+	RegisterJobCreator(SRJobKind, srJobCreator{})
+}
+
 func (srJobCreator) Create(_ JobKind, data string) (Job, error) {
 	return SoundingResult(data), nil
 }
@@ -75,11 +79,20 @@
 	}
 }
 
-func init() {
-	RegisterJobCreator(SRJobKind, srJobCreator{})
+func (srJobCreator) StageDone(
+	tx *sql.Tx,
+	ctx context.Context,
+	id int64,
+) error {
+	_, err := tx.ExecContext(ctx, srStageDoneSQL, id)
+	return err
 }
 
 const (
+	srStageDoneSQL = `
+UPDATE waterway.sounding_results SET staging_done = true
+WHERE id = $1`
+
 	checkDepthReferenceSQL = `
 SELECT true FROM depth_references WHERE depth_reference = $1`