diff pkg/controllers/srimports.go @ 5403:85f19e924a43 marking-single-beam

Adjusted the import model to be able to handle marking single beam scans.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 06 Jul 2021 01:20:44 +0200
parents 6237e6165041
children 850f5847d18a
line wrap: on
line diff
--- a/pkg/controllers/srimports.go	Tue Jul 06 00:30:39 2021 +0200
+++ b/pkg/controllers/srimports.go	Tue Jul 06 01:20:44 2021 +0200
@@ -112,17 +112,19 @@
 		sr.NegateZ = &negateZ
 	}
 
-	if v := req.FormValue("single-beam"); v != "" {
-		var singleBeam bool
+	if v := req.FormValue("survey-type"); v != "" {
+		var surveyType models.SurveyType
 		switch strings.ToLower(v) {
-		case "true", "1", "singlebeam", "single-beam":
-			singleBeam = true
-		case "false", "0", "multibeam", "multi-beam":
-			singleBeam = false
+		case "2", "marking":
+			surveyType = models.SurveyTypeMarking
+		case "true", "1", "singlebeam", "single-beam", "single":
+			surveyType = models.SurveyTypeSingleBeam
+		case "false", "0", "multibeam", "multi-beam", "multi":
+			surveyType = models.SurveyTypeMultiBeam
 		default:
-			return fmt.Errorf("unknown single-beam '%s'", v)
+			return fmt.Errorf("unknown survey-type '%s'", v)
 		}
-		sr.SingleBeam = &singleBeam
+		sr.SurveyType = &surveyType
 	}
 
 	return nil