Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to the calendar #221

Merged
merged 6 commits into from
Oct 23, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down
8 changes: 8 additions & 0 deletions data/processors/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
10 changes: 10 additions & 0 deletions webclient/src/views/view/view-view.inc
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@
<span>{{ view_data.type_common_name }}</span>
</div>
<div class="column col-auto col-ml-auto">
<a
class="btn btn-link btn-action btn-sm"
v-if="view_data.calendar_url"
v-bind:href="view_data.calendar_url"
CommanderStorm marked this conversation as resolved.
Show resolved Hide resolved
>
<svg xmlns="http://www.w3.org/2000/svg" height="14" width="14" fill="currentColor" viewBox="0 0 16 16" style="margin-bottom: -1px">
<path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM2 2a1 1 0 0 0-1 1v1h14V3a1 1 0 0 0-1-1H2zm13 3H1v9a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V5z"/>
<path d="M11 7.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1zm-3 0a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1zm-2 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1zm-3 0a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1z"/>
</svg>
CommanderStorm marked this conversation as resolved.
Show resolved Hide resolved
</a>
<button
class="btn btn-link btn-action btn-sm"
title="${{ _.view_view.header.external_link.tooltip }}$"
Expand Down