Fix: average_mmr may be optional

This commit is contained in:
eigenein committed 2023-04-29 23:33:28 +02:00
1 parent fa6ac70d21
commit 632f1781e7
4 files changed
+5 -5

No files matched your search

+3 -3
View File
@@ -6,10 +6,10 @@ pub enum Error {
ZipError(#[from] zip::result::ZipError), ZipError(#[from] zip::result::ZipError),
#[error("Protocol Buffers error")] #[error("Protocol Buffers error")]
DecodeFailed(#[from] prost::DecodeError), ProtobufError(#[from] prost::DecodeError),
#[error("Pickle error")] #[error("Pickle error")]
UnpickleFailed(#[from] serde_pickle::Error), PickleError(#[from] serde_pickle::Error),
#[error("I/O error")] #[error("I/O error")]
IoError(#[from] std::io::Error), IoError(#[from] std::io::Error),
@@ -19,7 +19,7 @@ pub enum Error {
#[cfg(feature = "meta")] #[cfg(feature = "meta")]
#[error("JSON error")] #[error("JSON error")]
JsonDecodeFailed(#[from] serde_json::Error), JsonError(#[from] serde_json::Error),
#[error("invalid magic: {0:#X}, expected: {1:#X}")] #[error("invalid magic: {0:#X}, expected: {1:#X}")]
InvalidMagic(u32, u32), InvalidMagic(u32, u32),
+1 -1
View File
@@ -23,7 +23,7 @@ pub struct Summary {
pub camouflage_slot: u8, pub camouflage_slot: u8,
#[serde(rename(deserialize = "avgMmr"))] #[serde(rename(deserialize = "avgMmr"))]
pub average_mmr: Vec<f64>, pub average_mmr: Vec<Option<f64>>,
#[serde(rename(deserialize = "playerWaitTimes"))] #[serde(rename(deserialize = "playerWaitTimes"))]
pub player_wait_times: HashMap<u32, f64>, pub player_wait_times: HashMap<u32, f64>,
+1 -1
View File
@@ -22,7 +22,7 @@ fn data_ok() -> Result<()> {
assert!(header.summary.is_mouse_enabled); assert!(header.summary.is_mouse_enabled);
assert_eq!(header.summary.matchmaker_type, 2); assert_eq!(header.summary.matchmaker_type, 2);
assert_eq!(header.summary.camouflage_slot, 1); assert_eq!(header.summary.camouflage_slot, 1);
assert_eq!(header.summary.average_mmr, [59.29457753400008, 99.34182121604681]); assert_eq!(header.summary.average_mmr, [Some(59.29457753400008), Some(99.34182121604681)]);
assert_eq!( assert_eq!(
header.summary.account_database_ids, header.summary.account_database_ids,
[ [