ui(notifications): €/m² to cent precision, link whole address to Maps

- sqm_price now renders with 2 decimals + German comma separator
  (e.g. "(12,35 €/m²)" instead of "(12 €/m²)").
- Map link covers BOTH address lines, not just the street. Telegram
  Markdown can't span link text across newlines, so each line gets its
  own [text](gmaps_url) — same URL, both lines blue + clickable, layout
  stays two-line.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
EiSiMo 2026-04-23 13:56:17 +02:00
parent b759cbb505
commit 62699d6c82

View file

@ -118,7 +118,8 @@ def on_match(user_id: int, flat: dict) -> None:
rent_str = _fmt_num(rent) rent_str = _fmt_num(rent)
if sqm_price: if sqm_price:
rent_str += f" ({sqm_price:.0f} €/m²)" # German-style decimal separator, rounded to the cent.
rent_str += f" ({sqm_price:.2f} €/m²)".replace(".", ",")
body = ( body = (
f"{line1}\n{line2}\n" f"{line1}\n{line2}\n"
@ -129,8 +130,14 @@ def on_match(user_id: int, flat: dict) -> None:
f"Original: {link}\n" f"Original: {link}\n"
f"lazyflat: {deep_link}" f"lazyflat: {deep_link}"
) )
# Telegram Markdown can't span link text across newlines, so emit two
# separate links that share the same Google Maps URL — both lines render
# blue + clickable, layout stays two-line.
addr_md = f"[{line1}]({gmaps})"
if line2:
addr_md += f"\n[{line2}]({gmaps})"
md = ( md = (
f"[{line1}]({gmaps})\n{line2}\n" f"{addr_md}\n"
f"Miete: {rent_str}\n" f"Miete: {rent_str}\n"
f"Fläche: {_fmt_num(size)}\n" f"Fläche: {_fmt_num(size)}\n"
f"Zimmer: {_fmt_num(rooms)}\n" f"Zimmer: {_fmt_num(rooms)}\n"