Skip to content

Commit 31a9b92

Browse files
authored
Fix in area endpoints. (#108)
1 parent e441d8e commit 31a9b92

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

api/routers/areas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ async def create_area(new_area: AreaConfigDTO, reboot_processor: Optional[bool]
4444
Adds a new area to the processor.
4545
"""
4646
config_dict = extract_config()
47-
areas_name = [x for x in config_dict.keys() if x.startswith("Area")]
47+
areas_name = [x for x in config_dict.keys() if x.startswith("Area_")]
4848
areas = [map_section_from_config(x, config_dict) for x in areas_name]
4949
if new_area.id in [area["id"] for area in areas]:
5050
raise HTTPException(status_code=400, detail="Area already exists")
@@ -97,7 +97,7 @@ async def delete_area(area_id: str, reboot_processor: Optional[bool] = True):
9797
Deletes the configuration related to the area <area_id>
9898
"""
9999
config_dict = extract_config()
100-
areas_name = [x for x in config_dict.keys() if x.startswith("Area")]
100+
areas_name = [x for x in config_dict.keys() if x.startswith("Area_")]
101101
areas = [map_section_from_config(x, config_dict) for x in areas_name]
102102
areas_ids = [area["id"] for area in areas]
103103
try:

api/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def handle_response(response, success, status_code=status.HTTP_200_OK):
8080

8181
def reestructure_areas(config_dict):
8282
"""Ensure that all [Area_0, Area_1, ...] are consecutive"""
83-
area_names = [x for x in config_dict.keys() if x.startswith("Area")]
83+
area_names = [x for x in config_dict.keys() if x.startswith("Area_")]
8484
area_names.sort()
8585
for index, area_name in enumerate(area_names):
8686
if f"Area_{index}" != area_name:

0 commit comments

Comments
 (0)