Skip to content

feat(mensa): show the canteen menu on Today - #53

Merged
502Proxy merged 9 commits into
mainfrom
feat/mensa
Oct 28, 2026
Merged

502Proxy merged 9 commits into
mainfrom
feat/mensa

Conversation

@502Proxy

Copy link
Copy Markdown
Owner

Closes #43

What changes and why?

The canteen menu on „Heute“, from the public OpenMensa API v2 (no account needed). One commit per layer:

  1. Domain: Canteen, Meal, CanteenMenu (grouped by category), CanteenService port, setting canteenID (nil = off), MensaSchedule (after 15:00 the next day), LoadCanteenMenuUseCase (keeps the day's menu in memory)
  2. Data: OpenMensaClient + OpenMensaParser: canteens near the university, closed days, meals with student price; 404 and network errors become MensaError
  3. UI: MensaViewModel (off / loading / closed / menu / unavailable), MensaCard, MensaSettingsSection (canteens around Oldenburg, nearest first)
  4. Wiring: card at the end of the right column on „Heute“, section in Settings → Allgemein; refresh with the five-minute loop
  5. Docs: FEATURES.md

Note

openmensa.org was not reachable from my environment, so the parser is tested against sample JSON in the documented API v2 format. Please pick the Uhlhornsweg canteen in the settings and check the card. The app sandbox already allows outgoing connections.

Tests

  • Parser (canteens, meals with/without prices, closed day, date string in Berlin time)
  • Schedule (next day after lunch), cache, grouping, view model states, price formatting
  • 172 tests pass locally (Linux subset); SwiftLint clean

Checklist

  • Linked issue, labels and milestone set
  • New logic has tests
  • Tried in the app with a real canteen
  • Release notes: collected in the 1.12 release PR

Generated by Claude Code

Canteen, Meal and CanteenMenu (grouped by category), a CanteenService
port, the canteen setting (nil hides the menu), MensaSchedule (after
15:00 the next day's menu is more useful) and LoadCanteenMenuUseCase,
which keeps the menu of the day in memory.

Refs #43

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmmqmKmX8VDSfoPbzTS1ew
OpenMensaClient talks to the public OpenMensa API v2: canteens near a
coordinate, whether a day is closed and its meals with the student
price. A missing menu (404) and network errors map to MensaError.

Refs #43

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmmqmKmX8VDSfoPbzTS1ew
MensaViewModel loads the chosen canteen's menu for today (tomorrow after
lunch) and reports off, loading, closed, menu or unavailable.
MensaCard groups the meals by category with the student price;
MensaSettingsSection offers the canteens around Oldenburg.

Refs #43

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmmqmKmX8VDSfoPbzTS1ew
„Heute“ shows the menu card at the end of the right column when a
canteen is chosen; Settings → Allgemein gets a „Mensa“ section. The
menu refreshes with the five-minute background loop, which switches to
tomorrow's menu after lunch.

Refs #43

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmmqmKmX8VDSfoPbzTS1ew
Refs #43

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmmqmKmX8VDSfoPbzTS1ew
@502Proxy 502Proxy added this to the 1.12 milestone Oct 28, 2026 — with Claude
@502Proxy 502Proxy added enhancement New feature or improvement area: mensa Canteen menu labels Oct 28, 2026 — with Claude
# Conflicts:
#	App/AppContainer.swift
#	App/StudyAppApp.swift
#	Presentation/RootView.swift
#	Presentation/Today/TodayView.swift
# Conflicts:
#	Presentation/Settings/SettingsPane.swift
#	docs/FEATURES.md

Copy link
Copy Markdown
Owner Author

CI: „test runner hung before establishing connection“. Das ist derselbe Hänger wie seit ca. 13 Uhr auf main und allen 1.12-PRs, nicht von der Mensa verursacht. Ursache wird in #60 eingegrenzt, ein Fix fehlt noch.


Generated by Claude Code

# Conflicts:
#	App/AppContainer.swift
#	Data/Preferences/UserDefaultsStudyPreferences.swift
#	Domain/Repositories/StudyPreferences.swift
# Conflicts:
#	App/AppContainer.swift
#	App/StudyAppApp.swift
#	Presentation/RootView.swift
#	docs/FEATURES.md
@502Proxy
502Proxy merged commit f040e5b into main Oct 28, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: mensa Canteen menu enhancement New feature or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(mensa): show the canteen menu on Today

2 participants