diff pkg/controllers/srimports.go @ 5407:850f5847d18a marking-single-beam

Re-establish compat with old single-beam interface.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 06 Jul 2021 15:26:20 +0200
parents 85f19e924a43
children 5f47eeea988d
line wrap: on
line diff
--- a/pkg/controllers/srimports.go	Tue Jul 06 14:26:02 2021 +0200
+++ b/pkg/controllers/srimports.go	Tue Jul 06 15:26:20 2021 +0200
@@ -112,6 +112,20 @@
 		sr.NegateZ = &negateZ
 	}
 
+	// Kept this in for compat.
+	if v := req.FormValue("single-beam"); v != "" {
+		var surveyType models.SurveyType
+		switch strings.ToLower(v) {
+		case "true", "1", "singlebeam", "single-beam":
+			surveyType = models.SurveyTypeSingleBeam
+		case "false", "0", "multibeam", "multi-beam":
+			surveyType = models.SurveyTypeMultiBeam
+		default:
+			return fmt.Errorf("unknown single-beam '%s'", v)
+		}
+		sr.SurveyType = &surveyType
+	}
+
 	if v := req.FormValue("survey-type"); v != "" {
 		var surveyType models.SurveyType
 		switch strings.ToLower(v) {