Skip to content
Snippets Groups Projects
Commit 1def4e32 authored by Laurens Oostwegel's avatar Laurens Oostwegel
Browse files

Raise an error if the number stories exceeds 175

parent 73e4031d
No related branches found
No related tags found
1 merge request!11Resolve "[Hotfix]: Number of stories cannot exceed the highest building in the world"
Pipeline #75187 passed
#!/usr/bin/env python3
# Copyright (c) 2023-2024:
# Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
# General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
class StoriesAndFloorspaceRule:
def __call__(self, tags, relations, area, *args, **kwargs):
"""
......@@ -29,6 +48,9 @@ class StoriesAndFloorspaceRule:
stories = ceil(float(story_string))
if stories < 1:
raise ValueError("Number of stories cannot be below 1")
elif stories > 175:
raise ValueError("Number of stories cannot be above 175")
floorspace = stories * area
return {"stories": stories, "floorspace": floorspace}
except ValueError:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment