Allow community to mark expected applications

This commit is contained in:
Mateusz Konieczny 2022-07-04 10:59:54 +02:00
parent b64a83a010
commit 3cb5ee5dca
12 changed files with 119 additions and 4 deletions

View File

@ -520,6 +520,47 @@
<LineSymbolizer stroke="#888" stroke-width="3.0"/> <LineSymbolizer stroke="#888" stroke-width="3.0"/>
</Rule> </Rule>
</Style> </Style>
<Style name="community_expected_planning_application_total">
<Rule>
<Filter>[community_expected_planning_application_total] &gt;= 100</Filter>
<PolygonSymbolizer fill="#bd0026" />
</Rule>
<Rule>
<Filter>[community_expected_planning_application_total] &gt;= 50 and [community_expected_planning_application_total] &lt; 100</Filter>
<PolygonSymbolizer fill="#e31a1c" />
</Rule>
<Rule>
<Filter>[community_expected_planning_application_total] &gt;= 20 and [community_expected_planning_application_total] &lt; 50</Filter>
<PolygonSymbolizer fill="#fc4e2a" />
</Rule>
<Rule>
<Filter>[community_expected_planning_application_total] &gt;= 10 and [community_expected_planning_application_total] &lt; 20</Filter>
<PolygonSymbolizer fill="#fd8d3c" />
</Rule>
<Rule>
<Filter>[community_expected_planning_application_total] &gt;= 3 and [community_expected_planning_application_total] &lt; 10</Filter>
<PolygonSymbolizer fill="#feb24c" />
</Rule>
<Rule>
<Filter>[community_expected_planning_application_total] = 2</Filter>
<PolygonSymbolizer fill="#fed976" />
</Rule>
<Rule>
<Filter>[community_expected_planning_application_total] = 1</Filter>
<PolygonSymbolizer fill="#ffe8a9" />
</Rule>
<Rule>
<MaxScaleDenominator>17061</MaxScaleDenominator>
<MinScaleDenominator>4264</MinScaleDenominator>
<LineSymbolizer stroke="#888" stroke-width="1.0"/>
</Rule>
<Rule>
<MaxScaleDenominator>4264</MaxScaleDenominator>
<MinScaleDenominator>0</MinScaleDenominator>
<LineSymbolizer stroke="#888" stroke-width="3.0"/>
</Rule>
</Style>
<Style name="community_in_public_ownership"> <Style name="community_in_public_ownership">
<Rule> <Rule>
<Filter>[in_public_ownership] = true</Filter> <Filter>[in_public_ownership] = true</Filter>

4
app/package-lock.json generated
View File

@ -22865,9 +22865,7 @@
"version": "1.6.1", "version": "1.6.1",
"resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-1.6.1.tgz", "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-1.6.1.tgz",
"integrity": "sha512-4CjkH20If1lhR5CGtqkrVg3bbOtFEG80X9v6jDOIUhbzzbB+UzPBGy8GQhUNVZ0yvMHdMpawCOcy5ydGMsagGQ==", "integrity": "sha512-4CjkH20If1lhR5CGtqkrVg3bbOtFEG80X9v6jDOIUhbzzbB+UzPBGy8GQhUNVZ0yvMHdMpawCOcy5ydGMsagGQ==",
"requires": { "requires": {}
"ajv": "^7.0.0"
}
}, },
"alphanum-sort": { "alphanum-sort": {
"version": "1.0.2", "version": "1.0.2",

View File

@ -24,5 +24,11 @@ export const aggregationsConfig: { [key in keyof typeof buildingUserAttributesCo
aggregateFieldName: 'community_local_significance_total', aggregateFieldName: 'community_local_significance_total',
aggregationMethod: 'countTrue' aggregationMethod: 'countTrue'
} }
],
community_expected_planning_application: [
{
aggregateFieldName: 'community_expected_planning_application_total',
aggregationMethod: 'countTrue'
}
] ]
}; };

View File

@ -303,6 +303,11 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
derivedEdit: true, derivedEdit: true,
verify: false verify: false
}, },
community_expected_planning_application_total: {
edit: false,
derivedEdit: true,
verify: false
},
community_activities_current: { community_activities_current: {
edit: true, edit: true,
verify: false verify: false
@ -403,6 +408,11 @@ export const buildingUserAttributesConfig = valueType<DataFieldConfig>()({
perUser: true, perUser: true,
edit: true, edit: true,
verify: false verify: false
},
community_expected_planning_application: {
perUser: true,
edit: true,
verify: false
} }
}); });

View File

@ -90,7 +90,8 @@ const withCopyEdit: (wc: React.ComponentType<CategoryViewProps>) => DataContaine
'planning_list_cat', 'planning_list_cat',
'planning_list_grade', 'planning_list_grade',
'likes_total', 'likes_total',
'community_local_significance_total' 'community_local_significance_total',
'community_expected_planning_application_total'
] ]
for (let key in dataFields) { for (let key in dataFields) {
let fieldName = props.building == undefined ? undefined : props.building[key]; let fieldName = props.building == undefined ? undefined : props.building[key];

View File

@ -81,6 +81,17 @@ const CommunityView: React.FunctionComponent<CategoryViewProps> = (props) => {
mode={props.mode} mode={props.mode}
copy={props.copy} copy={props.copy}
/> />
<UserOpinionEntry
slug='community_expected_planning_application'
title={buildingUserFields.community_expected_planning_application.title}
userValue={props.building.community_expected_planning_application}
onChange={props.onSaveChange}
mode={props.mode}
copy={props.copy}
/>
</div> </div>
<InfoBox>Can you help add information on community use of buildings?</InfoBox> <InfoBox>Can you help add information on community use of buildings?</InfoBox>

View File

@ -139,6 +139,22 @@ export const categoryMapsConfig: {[key in Category]: CategoryMapDefinition[]} =
] ]
} }
}, },
{
mapStyle: 'community_expected_planning_application_total',
legend: {
title: 'Expected planning application',
description: 'People who think the building will be affected by a planning application in the near future',
elements: [
{ color: '#bd0026', text: '100+' },
{ color: '#e31a1c', text: '5099' },
{ color: '#fc4e2a', text: '2049' },
{ color: '#fd8d3c', text: '1019' },
{ color: '#feb24c', text: '39' },
{ color: '#fed976', text: '2' },
{ color: '#ffe8a9', text: '1'}
]
}
},
{ {
mapStyle: 'community_in_public_ownership', mapStyle: 'community_in_public_ownership',
legend: { legend: {

View File

@ -105,6 +105,12 @@ export const buildingUserFields = {
category: Category.Community, category: Category.Community,
title: "Do you think this building should be recorded as a local heritage asset?", title: "Do you think this building should be recorded as a local heritage asset?",
example: true example: true
},
community_expected_planning_application: {
perUser: true,
category: Category.Community,
title: "Do you expect this site to be affected by a planning application in the near future?",
example: true
} }
}; };
@ -562,6 +568,12 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
example: 100, example: 100,
}, },
community_expected_planning_application_total: {
category: Category.Community,
title: "People who think the building will be affected by a planning application in the near future",
example: 100,
},
community_activities_current: { community_activities_current: {
category: Category.Community, category: Category.Community,
title: "Are activities open to the community currently taking place in the building?", title: "Are activities open to the community currently taking place in the building?",

View File

@ -9,6 +9,7 @@ export type BuildingMapTileset = 'date_year' |
'location' | 'location' |
'likes' | 'likes' |
'community_local_significance_total' | 'community_local_significance_total' |
'community_expected_planning_application_total' |
'community_in_public_ownership' | 'community_in_public_ownership' |
'planning_combined' | 'planning_combined' |
'sust_dec' | 'sust_dec' |

View File

@ -115,6 +115,15 @@ const LAYER_QUERIES = {
WHERE WHERE
community_local_significance_total > 0 community_local_significance_total > 0
`, `,
community_expected_planning_application_total: `
SELECT
geometry_id,
community_expected_planning_application_total
FROM
buildings
WHERE
community_expected_planning_application_total > 0
`,
community_in_public_ownership: ` community_in_public_ownership: `
SELECT SELECT
geometry_id, geometry_id,

View File

@ -0,0 +1,5 @@
ALTER TABLE building_user_attributes
DROP COLUMN IF EXISTS community_expected_planning_application;
ALTER TABLE buildings
DROP COLUMN IF EXISTS community_expected_planning_application_total;

View File

@ -0,0 +1,5 @@
ALTER TABLE building_user_attributes
ADD COLUMN community_expected_planning_application BOOLEAN NULL;
ALTER TABLE buildings
ADD COLUMN community_expected_planning_application_total INT DEFAULT 0;