From a971812ac6051dd36af009cb405d559c0e14a034 Mon Sep 17 00:00:00 2001 From: JohannaPeanut <76495099+JohannaPeanut@users.noreply.github.com> Date: Tue, 18 Jun 2024 10:47:20 +0200 Subject: [PATCH] Survey: update institutions_bboxes.json, include Landkreis in survey --- src/survey-public/components/types.ts | 3 +- .../radnetz-brandenburg/SurveyBB.tsx | 8 +- .../radnetz-brandenburg/data/README.md | 2 +- .../data/bboxen_export_TESTDATEN.csv | 210 -- .../data/institutions_bboxes.json | 2082 +++++++++++++---- .../radnetz-brandenburg/data/survey.ts | 7 + 6 files changed, 1672 insertions(+), 640 deletions(-) delete mode 100644 src/survey-public/radnetz-brandenburg/data/bboxen_export_TESTDATEN.csv diff --git a/src/survey-public/components/types.ts b/src/survey-public/components/types.ts index 9e378049c..e8a71d956 100644 --- a/src/survey-public/components/types.ts +++ b/src/survey-public/components/types.ts @@ -134,7 +134,8 @@ export type TResponseConfig = { export type TProgress = Record<"SURVEY" | "MORE" | "FEEDBACK" | "EMAIL", number> export type TInstitutionsBboxes = { - name: string + institution: string + landkreis: string id: string bbox: number[] }[] diff --git a/src/survey-public/radnetz-brandenburg/SurveyBB.tsx b/src/survey-public/radnetz-brandenburg/SurveyBB.tsx index 88633f0c1..c2a0c97bb 100644 --- a/src/survey-public/radnetz-brandenburg/SurveyBB.tsx +++ b/src/survey-public/radnetz-brandenburg/SurveyBB.tsx @@ -204,7 +204,8 @@ const StartContent: React.FC = () => { export const SurveyBB: React.FC = ({ surveyId }) => { const router = useRouter() const { id } = router.query - const name = institutions_bboxes.find((i) => i.id === id)?.name || "invalid" + const institution = institutions_bboxes.find((i) => i.id === id)?.institution || "invalid" + const landkreis = institutions_bboxes.find((i) => i.id === id)?.landkreis || "invalid" // in survey radnetz-brandenburg, the institution id is passed as a query parameter in the original url sent to the user // the institution name should appear in the survey response @@ -213,11 +214,12 @@ export const SurveyBB: React.FC = ({ surveyId }) => { // todo survey ? effect and dependency router? useEffect(() => { - router.query.institution = encodeURIComponent(name) + router.query.institution = encodeURIComponent(institution) + router.query.landkreis = encodeURIComponent(landkreis) void router.push({ query: router.query }, undefined, { scroll: false, }) - }, [name, router.query.id]) + }, [institution, landkreis, router.query.id]) return (