Skip to content

Commit

Permalink
Merge pull request #2 from directdecisions/results-strength-advantage
Browse files Browse the repository at this point in the history
Add strength and advantage to results
  • Loading branch information
pradovic committed Jan 22, 2024
2 parents e4741e0 + 52645cf commit 47fa595
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ddclient-rs"
version = "0.1.2"
version = "0.1.3"
edition = "2021"
description = "A Rust client library for the Direct Decisions API."
license = "BSD-3-Clause"
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ pub struct VotingResult {
pub index: i32,
pub wins: i32,
pub percentage: f32,
pub strength: usize,
pub advantage: usize,
}

/// Represents a voting.
Expand Down
16 changes: 16 additions & 0 deletions tests/voting_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,24 +236,32 @@ async fn get_voting_results_test() {
index: 0,
wins: 1,
percentage: 50.0,
strength: 1,
advantage: 0,
},
VotingResult {
choice: "Spinoza".to_string(),
index: 1,
wins: 1,
percentage: 50.0,
strength: 1,
advantage: 0,
},
VotingResult {
choice: "Kant".to_string(),
index: 2,
wins: 1,
percentage: 50.0,
strength: 1,
advantage: 0,
},
VotingResult {
choice: "Nietzsche".to_string(),
index: 3,
wins: 1,
percentage: 50.0,
strength: 1,
advantage: 0,
},
],
tie: true,
Expand Down Expand Up @@ -289,24 +297,32 @@ async fn get_voting_results_duels_test() {
index: 0,
wins: 1,
percentage: 50.0,
strength: 1,
advantage: 0,
},
VotingResult {
choice: "Spinoza".to_string(),
index: 1,
wins: 1,
percentage: 50.0,
strength: 1,
advantage: 0,
},
VotingResult {
choice: "Kant".to_string(),
index: 2,
wins: 1,
percentage: 50.0,
strength: 1,
advantage: 0,
},
VotingResult {
choice: "Nietzsche".to_string(),
index: 3,
wins: 1,
percentage: 50.0,
strength: 1,
advantage: 0,
},
],
tie: true,
Expand Down

0 comments on commit 47fa595

Please sign in to comment.