fixed rounding bug during rating handling

This commit is contained in:
Djairo Hougee 2023-05-10 13:50:16 +02:00
parent fd3c041e28
commit eb0c46a2e1
1 changed files with 1 additions and 1 deletions

View File

@ -32,7 +32,7 @@ fn rating_to_string(r: Option<&MetadataValue>, map: &Rating) -> Option<String> {
match r { match r {
Some(rating) => { Some(rating) => {
if let Some(f) = rating.as_f64() { if let Some(f) = rating.as_f64() {
let i = (f * 10_f64.round()) as i64; let i = (f * 10_f64).round() as i64;
match i { match i {
0 => Some(Rating::repeat(map.nil, 5)), 0 => Some(Rating::repeat(map.nil, 5)),
1 => Some(format!("{}{}", Rating::repeat(map.half, 1), Rating::repeat(map.nil, 4))), 1 => Some(format!("{}{}", Rating::repeat(map.half, 1), Rating::repeat(map.nil, 4))),