Skip to content

Commit

Permalink
Merge branch 'main' into vue3
Browse files Browse the repository at this point in the history
# Conflicts:
#	webclient/src/core.js
#	webclient/src/views/view/view-view.js
  • Loading branch information
CommanderStorm committed May 13, 2023
2 parents 4716cae + fc76a9e commit 016543f
Show file tree
Hide file tree
Showing 42 changed files with 545 additions and 283 deletions.
40 changes: 0 additions & 40 deletions .github/dependabot.yml

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/_docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- uses: docker/setup-buildx-action@v2
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
Expand All @@ -54,5 +55,5 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GIT_COMMIT_SHA=${{ github.sha }}
cache-from: type=registry,ref=user/app:latest
cache-to: type=inline
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
ports:
- 7700
steps:
- uses: actions/checkout@v3.0.0
- uses: actions/checkout@v3.5.2
- uses: ATiltedTree/[email protected]
with:
rust-version: 1.67
Expand Down
2 changes: 1 addition & 1 deletion data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ The data compilation is made of indiviual processing steps, where each step adds
_areatree_. After them, no new entries are being added to the data.
- **Steps 0x**: Supplement the base data with extended custom data.
- **Steps 1x**: Import rooms and building information from external sources
- **Steps 2x**: -
- **Steps 2x**: Import POIs
- **Steps 30-89**: Later steps are intended to augment the entries with even more
information and to ensure a consistent format. After them, no new (external or custom)
information should be added to the data.
Expand Down
7 changes: 6 additions & 1 deletion data/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
maps,
merge,
nat,
poi,
roomfinder,
search,
sections,
Expand All @@ -33,7 +34,6 @@ def main():

logging.info("-- 02 rooms extendend")
data = merge.patch_rooms(data, "sources/02_rooms-extended.yaml")
merge.add_coordinates(data, "sources/coordinates/")

# Add source information for these entries, which are up to here
# always declared by navigatum
Expand Down Expand Up @@ -63,6 +63,10 @@ def main():
logging.info("-- 17 NAT rooms")
nat.merge_nat_rooms(data)

# --- POIs ---
logging.info("-- 21 POIs")
poi.merge_poi(data)

# At this point, no more areas or rooms will be added or removed.
# --- Make data more coherent ---
logging.info("-- 30 Add children properties")
Expand All @@ -80,6 +84,7 @@ def main():
structure.infer_type_common_name(data)

logging.info("-- 40 Coordinates")
merge.add_coordinates(data, "sources/coordinates/")
coords.add_and_check_coords(data)

logging.info("-- 45 Roomfinder maps")
Expand Down
4 changes: 2 additions & 2 deletions data/processors/coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def assign_coordinates(data):
if "source" not in entry["coords"]:
entry["coords"]["source"] = "navigatum"
else:
# For rooms, we check whether its parent has a coordinate
if entry["type"] in {"room", "virtual_room"}:
# For rooms & POIs, we check whether its parent has a coordinate
if entry["type"] in {"room", "virtual_room", "poi"}:
building_parent = [data[e] for e in entry["parents"] if data[e]["type"] == "building"]
if len(building_parent) != 1:
logging.error(f"Could not find distinct parent building for {_id}")
Expand Down
31 changes: 31 additions & 0 deletions data/processors/poi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from utils import TranslatableStr as _
from processors import merge


def merge_poi(data):
"""Merge POIs from `sources/21_pois.yaml` into the data"""
poi_data = merge.load_yaml("sources/21_pois.yaml")

for _id, poi in poi_data.items():
if _id in data:
raise ValueError(f"The id '{_id}' is already used, cannot use it for a new POI")

if poi["parent"] not in data:
raise ValueError(f"Parent '{poi['parent']}' of POI '{_id}' not found")

poi["type"] = "poi"

# make sure that name and usage is internationalized
poi["usage"]["name"] = _(poi["usage"]["name"])
poi["name"] = _(poi["name"])
links = poi.get("description", {}).get("links", [])
for link in links:
link["text"] = _(link["text"])

parent_id = poi.pop("parent")
parent = data[parent_id]
poi["parents"] = parent["parents"] + [parent["id"]]

poi.setdefault("sources", {"base": [{"name": "NavigaTUM"}]})

return merge.recursively_merge(data, poi_data)
6 changes: 1 addition & 5 deletions data/processors/sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,7 @@ def _gen_computed_props(_id, entry, props):
)
computed.append({_("Anzahl Räume"): value})
if "generic" in props:
for entity in props["generic"]:
if isinstance(entity[1], dict):
computed.append({"name": entity[0], **entity[1]})
else:
computed.append({"name": entity[0], "text": entity[1]})
computed.extend(props["generic"])
return computed


Expand Down
1 change: 1 addition & 0 deletions data/processors/sitemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def _extract_sitemap_data(new_data, old_data, old_sitemaps) -> dict[str, list[di
"joined_building": "building",
"room": "room",
"virtual_room": "room",
"poi": "poi",
}[entry["type"]]
url = f"https://nav.tum.de/{url_type_name}/{_id}"
if _id not in old_data or entry != old_data[_id]:
Expand Down
3 changes: 2 additions & 1 deletion data/processors/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def infer_type_common_name(data):
def _get_type(_id, _data):
if _data["type"] == "building" and data[_data["parents"][-1]]["type"] == "joined_building":
return _("Gebäudeteil")
if _data["type"] in ["virtual_room", "room"] and "usage" in _data:
if _data["type"] in {"room", "virtual_room", "poi"} and "usage" in _data:
return _data["usage"]["name"]
return {
"root": _("Standortübersicht"),
Expand All @@ -104,6 +104,7 @@ def _get_type(_id, _data):
"building": _("Gebäude"),
"room": _("Raum"),
"virtual_room": _("Raum/Gebäudeteil"),
"poi": "POI",
}[_data["type"]]

for _id, _data in data.items():
Expand Down
5 changes: 3 additions & 2 deletions data/processors/tumonline.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def merge_tumonline_rooms(data):
missing_buildings[b_id] += 1
continue

operator = room["operator"].strip(OPERATOR_STRIP_CHARS)
r_data = {
"id": room["roomcode"],
"type": "room",
Expand All @@ -117,8 +118,8 @@ def merge_tumonline_rooms(data):
"operator_id": int(room["op_link"].strip(OPERATOR_WEBNAV_LINK_PREFIX)),
"operator_link": room["op_link"],
"operator_name": _(
orgs_de.get(room["operator"].strip(OPERATOR_STRIP_CHARS), {}).get("name"),
orgs_en.get(room["operator"].strip(OPERATOR_STRIP_CHARS), {}).get("name"),
orgs_de.get(operator, {}).get("name", f"Inaktive Organisation ({operator})"),
orgs_en.get(operator, {}).get("name", f"Inactive Organisation ({operator})"),
),
"room_link": room["room_link"],
"calendar": room["calendar"],
Expand Down
2 changes: 1 addition & 1 deletion data/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ defusedxml~=0.7.1
lxml~=4.9.2
Pillow~=9.5.0
pyyaml~=6.0
ruamel.yaml~=0.17.21
ruamel.yaml~=0.17.24
tqdm~=4.65.0
utm~=0.7.0
3 changes: 2 additions & 1 deletion data/sources/02_rooms-extended.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# ========================== Innenstadt =============================
# === Arcisstraße ===
"2907.01.130":
name: Fachschaft Lehrertum/Lehramt
name: Fachschaft Lehrertum/Lehramt/Educational Sciences
short_name: Lehramt
"0501.05.131":
name: Vorhoelzer-Forum Dachterasse
"0502.EG.221":
Expand Down
159 changes: 159 additions & 0 deletions data/sources/21_pois.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
parabelrutsche:
parent: "mi"
name: "Parabelrutsche"

usage:
name: "Gravitatives Transportmittel"

props:
generic:
- name:
de: "Formel"
en: "Formula"
text: "z = y = hx²/d²"

# === Validierungsautomaten ===
validierungsautomat-1:
parent: "5101"
name: "Validierungsautomat 1 (Physik)"
usage: { name: "Validierungsautomat" }
props:
links:
- { text: "Status", url: "https://campus.tum.de/valistatus/" }

validierungsautomat-2:
parent: "5501"
name: "Validierungsautomat 2 (MW)"
usage: { name: "Validierungsautomat" }
props:
links:
- { text: "Status", url: "https://campus.tum.de/valistatus/" }

validierungsautomat-3:
parent: "4101"
name: "Validierungsautomat 3 (School of Life Sciences Poststelle)"
usage: { name: "Validierungsautomat" }
props:
links:
- { text: "Status", url: "https://campus.tum.de/valistatus/" }
comment:
de: Der Validierungsautomat befindet sich im Treppenhaus
en: The validation machine is located in the staircase

validierungsautomat-4:
parent: "0501"
name: "Validierungsautomat 4 (Zentralgelände)"
usage: { name: "Validierungsautomat" }
props:
links:
- { text: "Status", url: "https://campus.tum.de/valistatus/" }

validierungsautomat-5:
parent: "5606"
name: "Validierungsautomat 5 (MI)"
usage: { name: "Validierungsautomat" }
props:
links:
- { text: "Status", url: "https://campus.tum.de/valistatus/" }

validierungsautomat-6:
parent: "2330.01.207"
name: "Validierungsautomat 6 (Olympiapark)"
usage: { name: "Validierungsautomat" }
props:
links:
- { text: "Status", url: "https://campus.tum.de/valistatus/" }

validierungsautomat-7:
parent: "5606"
name: "Validierungsautomat 7 (MI)"
usage: { name: "Validierungsautomat" }
props:
links:
- { text: "Status", url: "https://campus.tum.de/valistatus/" }

validierungsautomat-8:
parent: "5501"
name: "Validierungsautomat 8 (MW)"
usage: { name: "Validierungsautomat" }
props:
links:
- { text: "Status", url: "https://campus.tum.de/valistatus/" }

validierungsautomat-9:
parent: "0501"
name: "Validierungsautomat 9 (Zentralgelände)"
usage: { name: "Validierungsautomat" }
props:
links:
- { text: "Status", url: "https://campus.tum.de/valistatus/" }

validierungsautomat-10:
parent: "4220"
name: "Validierungsautomat 10 (School of Life Sciences Bibliothek)"
usage: { name: "Validierungsautomat" }
props:
links:
- { text: "Status", url: "https://campus.tum.de/valistatus/" }
comment:
de: Der Validierungsautomat befindet sich im Eingangsbereich
en: The validation machine is located in the entrance area

validierungsautomat-11:
parent: "5401"
name: "Validierungsautomat 11 (Chemie)"
usage: { name: "Validierungsautomat" }
props:
links:
- { text: "Status", url: "https://campus.tum.de/valistatus/" }

validierungsautomat-12:
parent: "1902"
name: "Validierungsautomat 12 (Heilbronn)"
usage: { name: "Validierungsautomat" }
props:
links:
- { text: "Status", url: "https://campus.tum.de/valistatus/" }
comment:
de: Direkt neben Raum L.1.30 (1902.01.130)
en: Directly next to room L.1.30 (1902.01.130)

validierungsautomat-14:
parent: "1551"
name: "Validierungsautomat 14 (Klinikum rechts der Isar)"
usage: { name: "Validierungsautomat" }
props:
links:
- { text: "Status", url: "https://campus.tum.de/valistatus/" }

validierungsautomat-16:
parent: "5901"
name: "Validierungsautomat 14 (Elektrotechnik)"
usage: { name: "Validierungsautomat" }
props:
links:
- { text: "Status", url: "https://campus.tum.de/valistatus/" }

validierungsautomat-21:
parent: "0201"
name: "Validierungsautomat 21 (StudiTUM Innenstadt)"
usage: { name: "Validierungsautomat" }
props:
links:
- { text: "Status", url: "https://campus.tum.de/valistatus/" }

validierungsautomat-sot:
parent: "2907.01.130"
name: "Validierungsautomat (School of Social Sciences and Technology)"
usage: { name: "Validierungsautomat" }
props:
links:
- { text: "Status", url: "https://campus.tum.de/valistatus/" }

validierungsautomat-straubing:
parent: "2927.EG.002"
name: "Validierungsautomat (Straubing)"
usage: { name: "Validierungsautomat" }
props:
links:
- { text: "Status", url: "https://campus.tum.de/valistatus/" }
Loading

0 comments on commit 016543f

Please sign in to comment.