Exemple #1
0
        public override IEnumerator ReceivePayload(VisualPayload payload)
        {
            var minRound = MinRoundNumber.GetFirstValue(payload.Data);
            var maxRound = MaxRoundNumber.GetFirstValue(payload.Data);

            var roundsList = new List <MutableObject>();

            for (int roundNum = minRound; roundNum <= maxRound; roundNum++)
            {
                var getScoresCommand = new GetScoresForRoundCommand(roundNum);

                var iterator = CommandProcessor.Execute(getScoresCommand);
                while (iterator.MoveNext())
                {
                    yield return(null);
                }

                var teamsList = ParseRoundData(payload.Data, getScoresCommand.Scores);

                var newRound = new MutableObject();
                newRound["Teams"] = teamsList;

                newRound["Round Number"] = roundNum;

                roundsList.Add(newRound);
            }

            RoundsTarget.SetValue(roundsList, payload.Data);

            var groupId = GroupId.GetFirstValue(payload.Data);

            var index = (DataShare.ContainsKey(groupId)
                ? DataShare[groupId]
                : 0);

            if (groupId != "")
            {
                DataShare[groupId] = index + 1;
            }

            DataIndexTarget.SetValue(index, payload.Data);

            var transmitIterator = Router.TransmitAll(payload);

            while (transmitIterator.MoveNext())
            {
                yield return(null);
            }
        }
        public override IEnumerator ReceivePayload(VisualPayload payload)
        {
            var minRound = MinRoundNumber.GetFirstValue(payload.Data);
            var maxRound = MaxRoundNumber.GetFirstValue(payload.Data);

            var scoresList = new List <MutableObject>();

            for (int roundNum = minRound; roundNum <= maxRound; roundNum++)
            {
                var getScoresCommand = new GetScoresForRoundCommand(roundNum);

                var iterator = CommandProcessor.Execute(getScoresCommand);
                while (iterator.MoveNext())
                {
                    yield return(null);
                }

                var roundList = ParseRoundData(payload.Data, getScoresCommand.Scores, roundNum);

                scoresList.AddRange(roundList);
            }

            // if we've just sampled a missing round, fill in with round zero data
            if (scoresList.Count == 0)
            {
                var getScoresCommand = new GetScoresForRoundCommand(0);

                var iterator = CommandProcessor.Execute(getScoresCommand);
                while (iterator.MoveNext())
                {
                    yield return(null);
                }

                // zero out round scores
                foreach (var score in getScoresCommand.Scores)
                {
                    foreach (var subScore in score.SubmissionScores)
                    {
                        subScore.Evaluation.Total = 0;
                        subScore.Availability.Functionality.Total = 0;
                        subScore.Availability.Performance.Total   = 0;
                        subScore.Availability.Total = 0;
                        subScore.Security.Consensus = 0;
                        subScore.Security.Reference = 0;
                        subScore.Security.Total     = 0;
                        subScore.Total = 0;
                    }
                }

                var roundList = ParseRoundData(payload.Data, getScoresCommand.Scores, 0);

                scoresList.AddRange(roundList);
            }

            ScoresTarget.SetValue(scoresList, payload.Data);

            var groupId = GroupId.GetFirstValue(payload.Data);

            var index = (DataShare.ContainsKey(groupId)
                ? DataShare[groupId]
                : 0);

            if (groupId != "")
            {
                DataShare[groupId] = index + 1;
            }

            DataIndexTarget.SetValue(index, payload.Data);

            var transmitIterator = Router.TransmitAll(payload);

            while (transmitIterator.MoveNext())
            {
                yield return(null);
            }
        }