From 76e32d3fdadb182ed112c418b9585446a2e890e7 Mon Sep 17 00:00:00 2001 From: Jerboa-app Date: Sun, 3 Mar 2024 09:12:39 +0000 Subject: [PATCH] top three content in msg --- src/web/stats.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/web/stats.rs b/src/web/stats.rs index 469d45d..437b58d 100644 --- a/src/web/stats.rs +++ b/src/web/stats.rs @@ -353,6 +353,16 @@ impl Stats msg.push_str(format!("Hits since {}\n", from).as_str()); msg.push_str(format!("Total / Unique: {} / {}\n", digest.total_hits, digest.unique_hits).as_str()); + + let mut top_content = String::new(); + for i in 0..2 + { + if digest.top_three_hitters[i].1 > 0 + { + top_content.push_str(format!(" {} : {}\n", digest.top_three_hitters[i].0, digest.top_three_hitters[i].1).as_str()); + } + } + msg.push_str(format!("Top 3 content:\n{}\n", top_content).as_str()); msg.push_str(format!("Hits by hour (UTC):\n\n{}", hits_by_hour_text_graph(digest.hits_by_hour_utc, '-', 10)).as_str()); msg