From e503ee4dcc8dbeeecda537f7204a0611cd38101b Mon Sep 17 00:00:00 2001 From: MeldaS Date: Wed, 1 Apr 2020 12:18:19 +0100 Subject: [PATCH] Modify files for adding construction attributes --- app/src/api/services/building.ts | 3 + app/src/frontend/building/building-view.tsx | 3 +- app/src/frontend/building/categories.tsx | 2 +- .../building/data-containers/construction.tsx | 109 ++++++++++-------- app/src/frontend/data_fields.ts | 18 +++ maintenance/extract_data/README.txt | 3 + .../extract_data/export_attributes.sql | 3 + 7 files changed, 93 insertions(+), 48 deletions(-) diff --git a/app/src/api/services/building.ts b/app/src/api/services/building.ts index 79511324..b12451c1 100644 --- a/app/src/api/services/building.ts +++ b/app/src/api/services/building.ts @@ -379,6 +379,9 @@ const BUILDING_FIELD_WHITELIST = new Set([ 'size_floor_area_ground', 'size_floor_area_total', 'size_width_frontage', + 'construction_core_material', + 'construction_secondary_materials', + 'construction_roof_covering', 'planning_portal_link', 'planning_in_conservation_area', 'planning_conservation_area_name', diff --git a/app/src/frontend/building/building-view.tsx b/app/src/frontend/building/building-view.tsx index 797e8b69..850e79e2 100644 --- a/app/src/frontend/building/building-view.tsx +++ b/app/src/frontend/building/building-view.tsx @@ -74,9 +74,8 @@ const BuildingView: React.FunctionComponent = (props) => { return ; case 'team': return = (props) => ( desc="Methods & materials" slug="construction" help="https://pages.colouring.london/construction" - inactive={true} + inactive={false} mode={props.mode} building_id={props.building_id} /> diff --git a/app/src/frontend/building/data-containers/construction.tsx b/app/src/frontend/building/data-containers/construction.tsx index d72d0499..44258c89 100644 --- a/app/src/frontend/building/data-containers/construction.tsx +++ b/app/src/frontend/building/data-containers/construction.tsx @@ -1,55 +1,74 @@ import React, { Fragment } from 'react'; +import { dataFields } from '../../data_fields'; +import DataEntry from '../data-components/data-entry'; +import SelectDataEntry from '../data-components/select-data-entry'; import withCopyEdit from '../data-container'; +import { CategoryViewProps } from './category-view-props'; + +const ConstructionMaterialsOptions = [ + 'Wood', + 'Stone', + 'Brick', + 'Steel', + 'Reinforced Concrete', + 'Other Metal', + 'Other Natural Material', + 'Other Man-Made Material' +]; + +const RoofCoveringOptions = [ + 'Slate', + 'Clay Tile', + 'Wood', + 'Asphalt', + 'Iron or Steel', + 'Other Metal', + 'Other Natural Material', + 'Other Man-Made Material' +]; + /** * Construction view/edit section */ -const ConstructionView = (props) => ( - -

{props.intro}

-
    -
  • Construction system
  • - { - // "disabled": true, - // "slug": "construction_system", - // "type": "text" - } -
  • Primary materials
  • - { - // "disabled": true, - // "slug": "construction_primary_material", - // "type": "text" - } -
  • Secondary materials
  • - { - // "disabled": true, - // "slug": "construction_secondary_material", - // "type": "text" - } -
  • Roofing material
  • - { - // "disabled": true, - // "slug": "construction_roofing_material", - // "type": "text" - } -
  • Percentage of facade glazed
  • - { - // "disabled": true, - // "slug": "construction_facade_percentage_glazed", - // "type": "number", - // "step": 5 - } -
  • BIM reference or link
  • - { - // "disabled": true, - // "slug": "construction_bim_reference", - // "type": "text", - // "placeholder": "https://..." - } -
-
-); +const ConstructionView: React.FunctionComponent = (props) => { + return ( + + + + + + ); + }; + const ConstructionContainer = withCopyEdit(ConstructionView); export default ConstructionContainer; diff --git a/app/src/frontend/data_fields.ts b/app/src/frontend/data_fields.ts index 7e46cdad..7ffc537b 100644 --- a/app/src/frontend/data_fields.ts +++ b/app/src/frontend/data_fields.ts @@ -282,6 +282,24 @@ export const dataFields = { //tooltip: , }, + construction_core_material: { + category: Category.Construction, + title: "Core Material", + tooltip:"The main structural material", + }, + + construction_secondary_materials: { + category: Category.Construction, + title: "Secondary Construction Material/s", + tooltip:"Other construction materials", + }, + + construction_roof_covering: { + category: Category.Construction, + title: "Main Roof Covering", + tooltip:'Main roof covering material', + }, + sust_breeam_rating: { category: Category.Sustainability, title: "BREEAM Rating", diff --git a/maintenance/extract_data/README.txt b/maintenance/extract_data/README.txt index 54db7145..1dbe7ca7 100644 --- a/maintenance/extract_data/README.txt +++ b/maintenance/extract_data/README.txt @@ -64,6 +64,9 @@ This is the main table, containing almost all data collected by Colouring London - `size_floor_area_ground`: ground floor floor area in square metres - `size_floor_area_total`: total floor area in square metres - `size_width_frontage`: width of frontage in metres +- `construction_core_material`: main structural material +- `construction_secondary_materials`: other structural materials +- `construction_roof_covering`: main roof covering - `sust_breeam_rating`: BREEAM rating - `sust_dec`: DEC rating - `sust_retrofit_date`: year of last significant retrofit diff --git a/maintenance/extract_data/export_attributes.sql b/maintenance/extract_data/export_attributes.sql index 87159603..b2cdd2fa 100644 --- a/maintenance/extract_data/export_attributes.sql +++ b/maintenance/extract_data/export_attributes.sql @@ -37,6 +37,9 @@ COPY (SELECT sust_breeam_rating, sust_dec, sust_retrofit_date, + construction_core_material, + construction_secondary_materials, + construction_roof_covering, planning_portal_link, planning_in_conservation_area, planning_conservation_area_name,