Added opening hours and a button for the user to view them, but the formatting sucks

This commit is contained in:
denizk0461
2023-04-25 16:55:17 +02:00
parent 6b1d77dfb3
commit 65114264c4
13 changed files with 127 additions and 19 deletions
@@ -94,8 +94,23 @@ class StwParser {
// Parse the HTML using Jsoup to traverse the document
val doc = Jsoup.connect(url).get()
/*
* Retrieve the opening hours for the canteen.
* TODO this formatting sucks
*/
var openingHours = ""
doc.getElementsByClass("details-wrapper")[0].getElementsByTag("p").forEach { p ->
openingHours += "${p.text()}\n"
}
// Save the canteen to persistent storage
repo.insert(OfferCanteen(canteenId, doc.getElementsByClass("pane-title")[1].text()))
repo.insert(
OfferCanteen(
canteenId,
doc.getElementsByClass("pane-title")[1].text(),
openingHours,
)
)
// Iterate through each day for which offers are available
doc.getElementsByClass("food-plan").forEach { dayPlan ->