From d8ad2c7bd27b0b0f1d11607fe50f902d01001755 Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Mon, 22 Jan 2024 02:28:30 -0700 Subject: [PATCH] Added initial metadata publish --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 56f454d..66d4101 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1204,10 +1204,12 @@ fn main() { // For each match, get the score for (_, division) in &mut event.divisions { for m in &mut division.matches { + let serialized = serde_json::to_string_pretty(&m.info).unwrap(); + client.publish(m.tuple.topic(""), QoS::AtLeastOnce, true, serialized).expect("MQTT publish fail"); m.score = get_match_score(&tm_connection, struct_tuple_to_tm(m.tuple)); if let Some(score) = &m.score { - let serialized = serde_json::to_string_pretty(score).unwrap(); - client.publish(m.tuple.topic("/score"), QoS::AtLeastOnce, true, serialized).expect("MQTT publish fail"); + let serialized_score = serde_json::to_string_pretty(score).unwrap(); + client.publish(m.tuple.topic("/score"), QoS::AtLeastOnce, true, serialized_score).expect("MQTT publish fail"); } } }