Merge pull request #819 from colouring-cities/current-use-changes
Current land use changes
This commit is contained in:
commit
f5ee154b5d
@ -534,9 +534,13 @@
|
||||
<PolygonSymbolizer fill="#cccccc" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[current_landuse_order] = "Residential" and not ([current_landuse_group] = "Garden buildings") and not ([current_landuse_group] = "Hotels, boarding and guest houses") </Filter>
|
||||
<Filter>[current_landuse_order] = "Residential" and not ([current_landuse_group] = "Garden buildings") and not ([current_landuse_group] = "Hotels, boarding and guest houses") and not ([current_landuse_verified])</Filter>
|
||||
<PolygonSymbolizer fill="#252aa6" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[current_landuse_order] = "Residential" and not ([current_landuse_group] = "Garden buildings") and not ([current_landuse_group] = "Hotels, boarding and guest houses") and ([current_landuse_verified])</Filter>
|
||||
<PolygonSymbolizer fill="#7025a6" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[current_landuse_order] = "Residential" and [current_landuse_group] = "Hotels, boarding and guest houses"</Filter>
|
||||
<PolygonSymbolizer fill="#3c4194" />
|
||||
|
@ -257,7 +257,15 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
|
||||
derivedEdit: true,
|
||||
verify: false,
|
||||
},
|
||||
|
||||
current_landuse_source: {
|
||||
edit: true,
|
||||
},
|
||||
current_landuse_source_detail: {
|
||||
edit: true,
|
||||
},
|
||||
current_landuse_link: {
|
||||
edit: true,
|
||||
},
|
||||
dynamics_has_demolished_buildings: {
|
||||
edit: true,
|
||||
verify: true
|
||||
|
@ -74,6 +74,15 @@ export async function updateBuildingUserVerifiedAttribute(buildingId: number, us
|
||||
[buildingId, userId, attribute, value]
|
||||
);
|
||||
}
|
||||
if (attribute == 'current_landuse_group'){
|
||||
await (db).none(
|
||||
`UPDATE buildings
|
||||
SET current_landuse_verified = TRUE
|
||||
WHERE buildings.building_id = $1;
|
||||
`,
|
||||
[buildingId]
|
||||
);
|
||||
}
|
||||
} catch(error) {
|
||||
console.error(error)
|
||||
if(error.detail?.includes('already exists')) {
|
||||
@ -87,6 +96,15 @@ export async function updateBuildingUserVerifiedAttribute(buildingId: number, us
|
||||
|
||||
export async function removeBuildingUserVerifiedAttribute(buildingId: number, userId: string, attribute: string) : Promise<null> {
|
||||
try {
|
||||
if (attribute == 'current_landuse_group'){
|
||||
await (db).none(
|
||||
`UPDATE buildings
|
||||
SET current_landuse_verified = FALSE
|
||||
WHERE buildings.building_id = $1;
|
||||
`,
|
||||
[buildingId]
|
||||
);
|
||||
}
|
||||
return await (db).none(
|
||||
`DELETE FROM
|
||||
building_verification
|
||||
|
@ -4,6 +4,8 @@ import InfoBox from '../../components/info-box';
|
||||
import { dataFields } from '../../config/data-fields-config';
|
||||
import DataEntry from '../data-components/data-entry';
|
||||
import { MultiDataEntry } from '../data-components/multi-data-entry/multi-data-entry';
|
||||
import SelectDataEntry from '../data-components/select-data-entry';
|
||||
import TextboxDataEntry from '../data-components/textbox-data-entry';
|
||||
import withCopyEdit from '../data-container';
|
||||
|
||||
import { CategoryViewProps } from './category-view-props';
|
||||
@ -51,6 +53,36 @@ const UseView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
/>
|
||||
<SelectDataEntry
|
||||
title={dataFields.current_landuse_source.title}
|
||||
slug="current_landuse_source"
|
||||
value={props.building.current_landuse_source}
|
||||
mode={props.mode}
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
tooltip={dataFields.current_landuse_source.tooltip}
|
||||
placeholder=""
|
||||
options={[
|
||||
"Expert/personal knowledge of building",
|
||||
"Online streetview image",
|
||||
"Open planning authority dataset",
|
||||
"Open property tax dataset",
|
||||
"Open housing dataset",
|
||||
"Open address dataset",
|
||||
"Other"
|
||||
]}
|
||||
/>
|
||||
<MultiDataEntry
|
||||
title={dataFields.current_landuse_link.title}
|
||||
slug="current_landuse_link"
|
||||
value={props.building.current_landuse_link}
|
||||
mode={props.mode}
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
tooltip={dataFields.current_landuse_link.tooltip}
|
||||
placeholder="https://..."
|
||||
editableEntries={true}
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
const UseContainer = withCopyEdit(UseView);
|
||||
|
@ -193,7 +193,8 @@ export const categoryMapsConfig: {[key in Category]: CategoryMapDefinition[]} =
|
||||
elements: [
|
||||
{ color: '#e5050d', text: 'Mixed Use' },
|
||||
{ subtitle: 'Single use:'},
|
||||
{ color: '#252aa6', text: 'Residential' },
|
||||
{ color: '#252aa6', text: 'Residential (unverified)' },
|
||||
{ color: '#7025a6', text: 'Residential (verified)' },
|
||||
{ color: '#ff8c00', text: 'Retail' },
|
||||
{ color: '#f5f58f', text: 'Industry & Business' },
|
||||
{ color: '#73ccd1', text: 'Community Services' },
|
||||
|
@ -193,6 +193,24 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
|
||||
tooltip: "Land use Order as classified by [NLUD](https://www.gov.uk/government/statistics/national-land-use-database-land-use-and-land-cover-classification)",
|
||||
example: "",
|
||||
},
|
||||
current_landuse_source: {
|
||||
category: Category.LandUse,
|
||||
title: "Source of information",
|
||||
tooltip: "Source for the current land use",
|
||||
example: "",
|
||||
},
|
||||
current_landuse_source_detail: {
|
||||
category: Category.LandUse,
|
||||
title: "Source details",
|
||||
tooltip: "References for current land use source (max 500 characters)",
|
||||
example: "",
|
||||
},
|
||||
current_landuse_link: {
|
||||
category: Category.LandUse,
|
||||
title: "Source Links",
|
||||
tooltip: "URL for current land use reference",
|
||||
example: ["", "", ""],
|
||||
},
|
||||
|
||||
building_attachment_form: {
|
||||
category: Category.Type,
|
||||
|
@ -150,7 +150,8 @@ const LAYER_QUERIES = {
|
||||
SELECT
|
||||
geometry_id,
|
||||
current_landuse_order,
|
||||
current_landuse_group[1] as current_landuse_group
|
||||
current_landuse_group[1] as current_landuse_group,
|
||||
current_landuse_verified
|
||||
FROM
|
||||
buildings
|
||||
WHERE
|
||||
|
7
migrations/028.landuse-source.down.sql
Normal file
7
migrations/028.landuse-source.down.sql
Normal file
@ -0,0 +1,7 @@
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS current_landuse_source;
|
||||
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS current_landuse_source_detail;
|
||||
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS current_landuse_link;
|
||||
|
||||
ALTER TABLE buildings DROP COLUMN IF NOT EXISTS current_landuse_verified;
|
15
migrations/028.landuse-source.up.sql
Normal file
15
migrations/028.landuse-source.up.sql
Normal file
@ -0,0 +1,15 @@
|
||||
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS current_landuse_source varchar;
|
||||
ALTER TABLE buildings ADD CONSTRAINT buildings_current_landuse_source_len CHECK (length(current_landuse_source) < 150);
|
||||
|
||||
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS current_landuse_source_detail varchar;
|
||||
ALTER TABLE buildings ADD CONSTRAINT current_landuse_source_detail_len CHECK (length(current_landuse_source_detail) < 500);
|
||||
|
||||
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS current_landuse_link text[];
|
||||
|
||||
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS current_landuse_verified BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
UPDATE buildings as b
|
||||
SET current_landuse_verified = TRUE
|
||||
FROM building_verification as v
|
||||
WHERE b.building_id = v.building_id
|
||||
AND v.attribute = 'current_landuse_group';
|
Loading…
Reference in New Issue
Block a user