Change to logical/boolean questions

This commit is contained in:
Mike Simpson 2023-06-29 14:51:31 +01:00
parent 39d3031c64
commit b44738e627
3 changed files with 14 additions and 23 deletions

View File

@ -8,6 +8,7 @@ import { DataEntryGroup } from '../data-components/data-entry-group';
import { MultiDataEntry } from '../data-components/multi-data-entry/multi-data-entry'; import { MultiDataEntry } from '../data-components/multi-data-entry/multi-data-entry';
import SelectDataEntry from '../data-components/select-data-entry'; import SelectDataEntry from '../data-components/select-data-entry';
import Verification from '../data-components/verification'; import Verification from '../data-components/verification';
import { LogicalDataEntry } from '../data-components/logical-data-entry/logical-data-entry';
/** /**
* Street Context view/edit section * Street Context view/edit section
@ -15,11 +16,10 @@ import Verification from '../data-components/verification';
const StreetContextView: React.FunctionComponent<CategoryViewProps> = (props) => ( const StreetContextView: React.FunctionComponent<CategoryViewProps> = (props) => (
<Fragment> <Fragment>
<DataEntryGroup name="Green Space"> <DataEntryGroup name="Green Space">
<SelectDataEntry <LogicalDataEntry
title={dataFields.context_front_garden.title} title={dataFields.context_front_garden.title}
slug="context_front_garden" slug="context_front_garden"
value={props.building.context_front_garden} value={props.building.context_front_garden}
options={dataFields.context_front_garden.items}
mode={props.mode} mode={props.mode}
copy={props.copy} copy={props.copy}
onChange={props.onChange} onChange={props.onChange}
@ -33,7 +33,7 @@ const StreetContextView: React.FunctionComponent<CategoryViewProps> = (props) =>
user_verified_as={props.user_verified.context_front_garden} user_verified_as={props.user_verified.context_front_garden}
verified_count={props.building.verified.context_front_garden} verified_count={props.building.verified.context_front_garden}
/> />
<SelectDataEntry <LogicalDataEntry
title={dataFields.context_back_garden.title} title={dataFields.context_back_garden.title}
slug="context_back_garden" slug="context_back_garden"
value={props.building.context_back_garden} value={props.building.context_back_garden}
@ -41,8 +41,6 @@ const StreetContextView: React.FunctionComponent<CategoryViewProps> = (props) =>
copy={props.copy} copy={props.copy}
onChange={props.onChange} onChange={props.onChange}
tooltip={dataFields.context_back_garden.tooltip} tooltip={dataFields.context_back_garden.tooltip}
//placeholder={dataFields.context_back_garden.example}
options={dataFields.context_back_garden.items}
/> />
<Verification <Verification
slug="context_back_garden" slug="context_back_garden"
@ -52,7 +50,7 @@ const StreetContextView: React.FunctionComponent<CategoryViewProps> = (props) =>
user_verified_as={props.user_verified.context_back_garden} user_verified_as={props.user_verified.context_back_garden}
verified_count={props.building.verified.context_back_garden} verified_count={props.building.verified.context_back_garden}
/> />
<SelectDataEntry <LogicalDataEntry
title={dataFields.context_flats_garden.title} title={dataFields.context_flats_garden.title}
slug="context_flats_garden" slug="context_flats_garden"
value={props.building.context_flats_garden} value={props.building.context_flats_garden}
@ -60,8 +58,6 @@ const StreetContextView: React.FunctionComponent<CategoryViewProps> = (props) =>
copy={props.copy} copy={props.copy}
onChange={props.onChange} onChange={props.onChange}
tooltip={dataFields.context_flats_garden.tooltip} tooltip={dataFields.context_flats_garden.tooltip}
//placeholder={dataFields.context_flats_garden.example}
options={dataFields.context_flats_garden.items}
/> />
<Verification <Verification
slug="context_flats_garden" slug="context_flats_garden"

View File

@ -1140,31 +1140,19 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
category: Category.StreetContext, category: Category.StreetContext,
title: "Does the building have a front garden?", title: "Does the building have a front garden?",
tooltip: "Is the front garden mainly green/planted?", tooltip: "Is the front garden mainly green/planted?",
example: "", example: true,
items: [
"Yes",
"No"
]
}, },
context_back_garden: { context_back_garden: {
category: Category.StreetContext, category: Category.StreetContext,
title: "Does the building have a back garden?", title: "Does the building have a back garden?",
tooltip: "Is the back garden mainly green/planted?", tooltip: "Is the back garden mainly green/planted?",
example: "", example: true
items: [
"Yes",
"No"
]
}, },
context_flats_garden: { context_flats_garden: {
category: Category.StreetContext, category: Category.StreetContext,
title: "Are flats with a dedicated green space?", title: "Are flats with a dedicated green space?",
tooltip: "If the building is a block of flats, does it have a dedicated garden area/green space?", tooltip: "If the building is a block of flats, does it have a dedicated garden area/green space?",
example: "", example: true
items: [
"Yes",
"No"
]
}, },
context_garden_source_type: { context_garden_source_type: {
category: Category.StreetContext, category: Category.StreetContext,

View File

@ -0,0 +1,7 @@
ALTER TABLE buildings DROP COLUMN IF EXISTS context_front_garden;
ALTER TABLE buildings DROP COLUMN IF EXISTS context_back_garden;
ALTER TABLE buildings DROP COLUMN IF EXISTS context_flats_garden;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS context_front_garden boolean;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS context_back_garden boolean;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS context_flats_garden boolean;