Skip to content

Commit

Permalink
Fix buffet nord widget for off days (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
eliabieri authored Jan 23, 2023
1 parent 7c9afd4 commit 6567e98
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "app"
version = "1.1.1"
version = "1.1.2"
edition = "2021"
readme = "README.md"
repository = "https://github.com/eliabieri/wg_display"
Expand Down
8 changes: 6 additions & 2 deletions app/src/renderer/widgets/buffet_nord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ impl BuffetNord {
let menu_item_selector =
Selector::parse(r"#__layout > div > div.main > div > article > div > section").unwrap();

let mut text = "No menu today".to_string();
for menu_item in document.select(&menu_item_selector) {
let mut menu_items = document.select(&menu_item_selector).peekable();
if menu_items.peek().is_none() {
return "No menu today".to_string();
}
let mut text = String::new();
for menu_item in menu_items {
let title = BuffetNord::parse_title(&menu_item);
let dietary = BuffetNord::parse_dietary(&menu_item);
match title {
Expand Down

0 comments on commit 6567e98

Please sign in to comment.