Closed kmeesters closed 6 years ago
On closer inspection, it might (also) be that the displayserver is listening to 'list:setArray' message, and the new version sends 'scores:ranking' messages?
This is a job for mhub-relay. It is not in the interest of displaySystem to respond to scoring specific messages.
The idea is that displaysystem is a generic display system (hence the name). As such, it expects an array of arrays with an optional header. How that data is fed into it is out of scope for the application.
There are predefined relay configurations here: https://github.com/FirstLegoLeague/mq-protocols/tree/master/relays
Specifically, the relevant code to pull this off is
data: msg.data.ranking.map(function(rank, index) {
var scores = rank.scores.map((score) => score || 0);
return [rank.rank, rank.team.number, rank.team.name, rank.highest].concat(scores);
})
Note that the ranking
objects in your first message format is mapped to an array per rank
When the current scorings system (in fllscoring repo) is submitting scores over mhub ('broadcast') it does so as an object:
Message { topic: 'scores:ranking', data: { stage: { id: 'qualifying', name: 'Voorrondes', rounds: 3 }, ranking: [ [Object] ] }, headers: {} }
These messages however are not picked up by the displaySystem, (i.e. the list or table is not updated). After some testing, I found out that the message (scores) does get displayed when offered as an array:Message { topic: 'list:setArray', data: { data: [ [Array] ], header: 'Practice Rounds' }, headers: {} }
It seems that the Displaysystem (list or table module) is expecting an Array rather then an object.