diff --git a/app/src/frontend/building-edit.js b/app/src/frontend/building-edit.js
index 8af3716e..50e3324b 100644
--- a/app/src/frontend/building-edit.js
+++ b/app/src/frontend/building-edit.js
@@ -27,9 +27,9 @@ class BuildingEdit extends Component {
facade_upper: props.facade_upper,
facade_lower: props.facade_lower,
facade_source: props.facade_source,
- size_attic: props.size_attic,
- size_core: props.size_core,
- size_basement: props.size_basement,
+ size_storeys_attic: props.size_storeys_attic,
+ size_storeys_core: props.size_storeys_core,
+ size_storeys_basement: props.size_storeys_basement,
likes_total: props.likes_total,
liked: props.liked
};
@@ -41,7 +41,7 @@ class BuildingEdit extends Component {
handleChange(event) {
const target = event.target;
- const value = target.value;
+ const value = (target.value === '')? null : target.value;
const name = target.name;
this.setState({
@@ -202,24 +202,24 @@ class BuildingEdit extends Component {
-
+
-
+
-
+
diff --git a/app/src/frontend/building-view.js b/app/src/frontend/building-view.js
index 10ce5bba..7b126094 100644
--- a/app/src/frontend/building-view.js
+++ b/app/src/frontend/building-view.js
@@ -64,11 +64,11 @@ const BuildingView = function(props){
Size
- Attic storeys
- - {props.size_attic? props.size_attic : '-'}
+ - {props.size_storeys_attic? props.size_storeys_attic : '-'}
- Core storeys
- - {props.size_core? props.size_core : '-'}
+ - {props.size_storeys_core? props.size_storeys_core : '-'}
- Basement storeys
- - {props.size_basement? props.size_basement : '-'}
+ - {props.size_storeys_basement? props.size_storeys_basement : '-'}
diff --git a/app/src/tileserver.js b/app/src/tileserver.js
index 6247f1ed..88bcb3e3 100644
--- a/app/src/tileserver.js
+++ b/app/src/tileserver.js
@@ -81,7 +81,10 @@ router.get('/size_storeys/:z/:x/:y.png', function(req, res) {
// const table_def = 'geometries'
const table_def = `(
SELECT
- (b.size_attic + b.size_core) as size_storeys,
+ (
+ coalesce(b.size_storeys_attic, 0) +
+ coalesce(b.size_storeys_core, 0)
+ ) as size_storeys,
g.geometry_geom
FROM
geometries as g,
diff --git a/migrations/004.location-date-size-like.up.sql b/migrations/004.location-date-size-like.up.sql
index 2e62b36b..97b03bc0 100644
--- a/migrations/004.location-date-size-like.up.sql
+++ b/migrations/004.location-date-size-like.up.sql
@@ -51,11 +51,11 @@ ALTER TABLE buildings ADD CONSTRAINT buildings_facade_source_len CHECK (length(f
-- Size
-- Attic storeys
-ALTER TABLE buildings ADD COLUMN IF NOT EXISTS size_storeys_attic smallint;
+ALTER TABLE buildings ADD COLUMN IF NOT EXISTS size_storeys_attic smallint DEFAULT 0;
-- Core storeys
-ALTER TABLE buildings ADD COLUMN IF NOT EXISTS size_storeys_core smallint;
+ALTER TABLE buildings ADD COLUMN IF NOT EXISTS size_storeys_core smallint DEFAULT 0;
-- Basement storeys
-ALTER TABLE buildings ADD COLUMN IF NOT EXISTS size_storeys_basement smallint;
+ALTER TABLE buildings ADD COLUMN IF NOT EXISTS size_storeys_basement smallint DEFAULT 0;
-- Height to apex (m)
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS size_height_apex real;