diff --git a/data/compile.py b/data/compile.py index 14f034811..238d6b1cd 100644 --- a/data/compile.py +++ b/data/compile.py @@ -61,6 +61,7 @@ def main(): logging.info("-- 34 Infer more props") structure.infer_addresses(data) + structure.extract_calendar_url(data) # TODO: Does it make sense to introduce a type 'sub_building' here? diff --git a/data/processors/structure.py b/data/processors/structure.py index 5777e91bf..33b220cff 100644 --- a/data/processors/structure.py +++ b/data/processors/structure.py @@ -111,3 +111,11 @@ def _get_type(_id, _data): for _id, _data in data.items(): _data["type_common_name"] = _get_type(_id, _data) + + +def extract_calendar_url(data): + """Extracts the calendar from the tumonline data sets it to the proper value. """ + for k, entry in data.items(): + if entry.get("tumonline_data", {}).get("calendar", None): + url = f"https://campus.tum.de/tumonline/{entry['tumonline_data']['calendar']}" + entry["calendar_url"] = url diff --git a/openapi.yaml b/openapi.yaml index 8c0b18c70..dbbde4ed6 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -442,6 +442,7 @@ paths: text: 'Boltzmannstr. 3, EG, 85748 Garching b. München' - name: Sitzplätze text: '522' + calendar_url: "https://campus.tum.de/tumonline/tvKalender.wSicht?cOrg=19691&cRes=12559&cReadonly=J" ranking_factors: rank_combined: 900 rank_type: 100 @@ -1528,6 +1529,13 @@ components: type: array items: $ref: '#/components/schemas/ImageInfo' + calendar_url: + items: + type: string + description: A link to the calendar of the room + example: + - https://campus.tum.de/tumonline/tvKalender.wSicht?cOrg=19691&cRes=12543&cReadonly=J + - https://campus.tum.de/tumonline/tvKalender.wSicht?cOrg=19691&cRes=12559&cReadonly=J ranking_factors: $ref: '#/components/schemas/RankingFactors' required: diff --git a/webclient/src/views/view/view-view.inc b/webclient/src/views/view/view-view.inc index cacbb096f..45edb6c65 100644 --- a/webclient/src/views/view/view-view.inc +++ b/webclient/src/views/view/view-view.inc @@ -94,6 +94,16 @@ {{ view_data.type_common_name }}