From 583c59d005773d090114d5ad2074362fbb8cbbf4 Mon Sep 17 00:00:00 2001 From: achester88 Date: Wed, 7 Aug 2024 19:50:46 +0000 Subject: [PATCH] Added Code to Show two decimals places for Price/ticket ratio --- src/format.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/format.rs b/src/format.rs index 45a66d9..248a66b 100644 --- a/src/format.rs +++ b/src/format.rs @@ -33,7 +33,7 @@ pub fn format_item_diff( }, if let Some(real_price) = real_price { format!( - " _(${real_price} - ${}/hr)_", + " _(${real_price} - ${:.2}/hr)_", (*real_price as f32) / (new.price as f32) ) } else { @@ -285,7 +285,7 @@ mod diff_tests { Some( indoc! {" *Name:* Test - *Price:* 1 → 2 🔼 _($50 - $25/hr)_"} + *Price:* 1 → 2 🔼 _($50 - $25.00/hr)_"} .into() ) );