Added initial metadata publish

master
noah metz 2024-01-22 02:28:30 -07:00
parent d72cb2c732
commit d8ad2c7bd2
1 changed files with 4 additions and 2 deletions

@ -1204,10 +1204,12 @@ fn main() {
// For each match, get the score // For each match, get the score
for (_, division) in &mut event.divisions { for (_, division) in &mut event.divisions {
for m in &mut division.matches { 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)); m.score = get_match_score(&tm_connection, struct_tuple_to_tm(m.tuple));
if let Some(score) = &m.score { if let Some(score) = &m.score {
let serialized = serde_json::to_string_pretty(score).unwrap(); let serialized_score = serde_json::to_string_pretty(score).unwrap();
client.publish(m.tuple.topic("/score"), QoS::AtLeastOnce, true, serialized).expect("MQTT publish fail"); client.publish(m.tuple.topic("/score"), QoS::AtLeastOnce, true, serialized_score).expect("MQTT publish fail");
} }
} }
} }