aggregator fixer (#1783)

This commit is contained in:
Dongjia "toka" Zhang 2024-01-08 19:36:41 +01:00 committed by GitHub
parent 88f3ff4a28
commit 3d126f21cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -277,6 +277,14 @@ impl UserStatsValue {
let second = *y as f64 / *b as f64; let second = *y as f64 / *b as f64;
Some(Self::Percent(first + second)) Some(Self::Percent(first + second))
} }
(Self::Percent(x), Self::Ratio(y, b)) => {
let ratio = *y as f64 / *b as f64;
Some(Self::Percent(*x + ratio))
}
(Self::Ratio(x, a), Self::Percent(y)) => {
let ratio = *x as f64 / *a as f64;
Some(Self::Percent(ratio + *y))
}
_ => None, _ => None,
} }
} }