Split d4c0bb889b docs: comprehensive documentation for all modules and handlers
- README.md: full project docs with features, API endpoints, Glicko-2 explanation
- main.rs: doc comments for all 18 HTTP handlers
- db/mod.rs: schema and migration documentation
- models/mod.rs: Player struct and Glicko-2 parameter docs
- Fixed route syntax (:id instead of {id}) for Axum 0.7 compatibility
2026-02-07 19:19:50 -05:00

28 lines
961 B
Rust

pub mod rating;
pub mod calculator;
pub mod score_weight;
pub mod doubles;
pub use rating::GlickoRating;
pub use calculator::Glicko2Calculator;
pub use score_weight::calculate_weighted_score;
pub use doubles::{calculate_team_rating, distribute_rating_change};
/// Convenience function to calculate new ratings for a single match
/// Returns (winner_new_rating, loser_new_rating)
pub fn calculate_new_ratings(
player1: &GlickoRating,
player2: &GlickoRating,
player1_score: f64, // 1.0 = win, 0.0 = loss, 0.5 = draw
margin_multiplier: f64, // From calculate_weighted_score
) -> (GlickoRating, GlickoRating) {
let calc = Glicko2Calculator::new();
let player2_score = 1.0 - player1_score;
let new_p1 = calc.update_rating(player1, &[(*player2, player1_score * margin_multiplier.min(1.2))]);
let new_p2 = calc.update_rating(player2, &[(*player1, player2_score * margin_multiplier.min(1.2))]);
(new_p1, new_p2)
}