Skip to content

Commit

Permalink
1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
aryakaul committed Oct 28, 2020
1 parent 0e5f3d8 commit 446140c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@
* bump rodio to v0.12 + move some functions around to get it working
* fix tinytemplate default file shenanigans
* removed italics within the tag counter

## 1.1.3
* changed tagweight table to use percentages instead of floats
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rusty-krab-manager"
version = "1.1.2"
version = "1.1.3"
authors = ["luak <[email protected]>"]
edition = "2018"
readme = "README.md"
Expand Down
18 changes: 14 additions & 4 deletions src/assignment_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,23 @@ pub fn create_weighttable(
let curr_assign = &assign_vec[i];
new.push(curr_assign.tag.clone());
new.push(curr_assign.name.clone());
new.push(format!("{:.4}", tag_weights[i_tags]));
new.push(format!("{:.4}", assign_pdf[i]));
new.push(format!("{:.4}", (assign_pdf[i] * tag_weights[i_tags])));
new.push(format!("{:.2}%", tag_weights[i_tags] * 100.0));
new.push(format!("{:.2}%", assign_pdf[i] * 100.0));
new.push(format!(
"{:.2}%",
(assign_pdf[i] * tag_weights[i_tags] * 100.0)
));
toret.push(new);
}
}
toret.sort_by(|a, b| b[4].cmp(&a[4]));
// following code to sort by percentage values
toret.sort_by(|a, b| {
b[4][..b[4].find("%").unwrap()]
.parse::<f32>()
.unwrap()
.partial_cmp(&a[4][..a[4].find("%").unwrap()].parse::<f32>().unwrap())
.unwrap()
});
return toret;
}

Expand Down

0 comments on commit 446140c

Please sign in to comment.