Skip to content

Commit

Permalink
fixed compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed May 5, 2024
1 parent f1f81e7 commit b06edf1
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 365 deletions.
308 changes: 0 additions & 308 deletions data/data_format_geo-entry.yaml

This file was deleted.

1 change: 1 addition & 0 deletions data/external/models/test_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Literal

import pytest

from external.models import nat, public_transport, roomfinder, tumonline


Expand Down
5 changes: 3 additions & 2 deletions data/external/models/tumonline.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class Seats(PydanticConfiguration):

# pylint: disable-next=too-many-instance-attributes
class Room(PydanticConfiguration):
alt_name: str
address: Address
seats: Seats
floor_type: str
Expand All @@ -27,6 +26,7 @@ class Room(PydanticConfiguration):
building_id: int
main_operator_id: int
usage_id: int
alt_name: str | None = None
arch_name: str | None = None
calendar_resource_nr: int | None = None
patched: bool = False
Expand All @@ -41,8 +41,9 @@ def load_all(cls) -> dict[str, "Room"]:
class Building(PydanticConfiguration):
address: Address
area_id: int
filter_id: int
name: str
tumonline_id: int
filter_id: int | None = None

@classmethod
def load_all(cls) -> dict[str, "Building"]:
Expand Down
4 changes: 2 additions & 2 deletions data/processors/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ def export_for_search(data: dict, path: str) -> None:
# For all other parents, only the ids and their keywords (TODO) are searchable
"parent_keywords": [maybe_slugify(value) for value in parent_building_names + entry["parents"][1:]],
"campus": maybe_slugify(campus_name),
"address": address.get("street", None),
"place": address.get("place", None),
"address": address.get("street", None) if isinstance(address, dict) else address.street,
"place": address.get("place", None) if isinstance(address, dict) else address.place,
"usage": maybe_slugify(entry.get("usage", {}).get("name", None)),
"rank": int(entry["ranking_factors"]["rank_combined"]),
**geo,
Expand Down
10 changes: 3 additions & 7 deletions data/processors/sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@ def extract_tumonline_props(data: dict[str, dict[str, Any]]) -> None:
),
"id": entry["tumonline_data"]["operator_id"],
}
if entry.get("tumonline_data", {}).get("room_link", None):
room_url: str = entry["tumonline_data"]["room_link"]
entry["props"]["tumonline_room_nr"] = int(room_url.removeprefix("wbRaum.editRaum?pRaumNr="))
elif entry.get("tumonline_data", {}).get("address_link", None):
adress_url: str = entry["tumonline_data"]["address_link"]
entry["props"]["tumonline_room_nr"] = int(adress_url.removeprefix("ris.einzelraum?raumkey="))
if tumonline_id := entry.get("tumonline_data", {}).get("tumonline_id", None):
entry["props"]["tumonline_room_nr"] = tumonline_id


def compute_floor_prop(data: dict[str, Any]) -> None:
Expand Down Expand Up @@ -253,7 +249,7 @@ def _gen_computed_props(
building_names = ", ".join([p.ljust(4, "x") for p in b_prefix])
computed.append({_("Gebäudekennungen"): building_names})
if address := props.get("address"):
computed.append({_("Adresse"): f"{address['street']}, {address['zip_code']} {address['place']}"})
computed.append({_("Adresse"): f"{address['street']}, {address['plz_place']}"})
if stats := props.get("stats"):
_append_if_present(stats, computed, "n_buildings", _("Anzahl Gebäude"))
_append_if_present(stats, computed, "n_seats", _("Sitzplätze"))
Expand Down
Loading

0 comments on commit b06edf1

Please sign in to comment.