|
|
@ -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");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|