diff options
Diffstat (limited to 'front_end/src/cat_page.rs')
-rw-r--r-- | front_end/src/cat_page.rs | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/front_end/src/cat_page.rs b/front_end/src/cat_page.rs index 22698cc..eeaed03 100644 --- a/front_end/src/cat_page.rs +++ b/front_end/src/cat_page.rs @@ -99,20 +99,6 @@ impl<'a> CatPage<'a> { self.related.iter().map(|slug| CATEGORIES.from_slug(slug).0.into_iter().filter(|c| seen.insert(&c.slug)).collect()).filter(|v: &Vec<_>| !v.is_empty()).collect() } - /// Nicely rounded number of downloads - /// - /// To show that these numbers are just approximate. - pub fn downloads(&self, num: u32) -> (String, &'static str) { - match num { - a @ 0..=99 => (format!("{}", a), ""), - a @ 0..=500 => (format!("{}", a / 10 * 10), ""), - a @ 0..=999 => (format!("{}", a / 50 * 50), ""), - a @ 0..=9999 => (format!("{}.{}", a / 1000, a % 1000 / 100), "K"), - a @ 0..=999_999 => (format!("{}", a / 1000), "K"), - a => (format!("{}.{}", a / 1_000_000, a % 1_000_000 / 100_000), "M"), - } - } - /// Metadata about the category pub fn page(&self) -> Page { Page { |