Skip to content

Commit 2db53d1

Browse files
committed
feat: add logging to USMA ranking watcher
1 parent 1e3764b commit 2db53d1

File tree

3 files changed

+15
-21
lines changed

3 files changed

+15
-21
lines changed

Cargo.lock

Lines changed: 4 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ async-trait = "0.1.83"
1616
chrono = { version = "0.4.39", features = ["serde"] }
1717
reqwest = { version = "0.12.12", features = ["json"] }
1818
riichi_hand = "0.6.3"
19-
scraper = "0.21.0"
19+
scraper = "0.22.0"
2020
serde = "1.0.217"
2121
tokio = { version = "1.42.0", features = ["macros", "rt-multi-thread"] }
2222
slug = "0.1.6"

chombot-kcc/src/ranking_watcher/usma.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use anyhow::{anyhow, Context, Result};
44
use chombot_common::data_watcher::WatchableData;
55
use chombot_common::scraping_utils::{create_chombot_http_client, first_nonempty_text};
66
use chombot_common::{select_all, select_one, unpack_children};
7+
use log::info;
78
use scraper::node::{Element, Node};
89
use scraper::{CaseSensitivity, ElementRef, Html, Selector};
910

@@ -36,7 +37,7 @@ impl RankingEntry {
3637
}
3738
}
3839

39-
#[derive(Default)]
40+
#[derive(Debug, Default)]
4041
pub struct Ranking(pub Vec<RankingEntry>);
4142

4243
impl Ranking {
@@ -137,7 +138,14 @@ pub async fn get_ranking() -> Result<Ranking> {
137138
.await?
138139
.text()
139140
.await?;
140-
parse_document(&body)
141+
let ranking = parse_document(&body)?;
142+
info!(
143+
"Got {} USMA ranking entries: {:?}",
144+
ranking.0.len(),
145+
ranking
146+
);
147+
148+
Ok(ranking)
141149
}
142150

143151
#[cfg(test)]

0 commit comments

Comments
 (0)