public IFixtureDetails GetFixtureDetail(string fixtureId)
        {
            if(string.IsNullOrEmpty(fixtureId))
                return null;

            var overview = Supervisor.GetFixtureOverview(fixtureId);

            FixtureDetails details = new FixtureDetails();
            FillFixtureOverview(details, overview);

            foreach(var update in overview.GetFeedAudit())
            {
                FixtureProcessingEntry entry = new FixtureProcessingEntry();
                FillProcessingEntry(entry, update);
                details.AddProcessingEntry(entry);
            }

            return details;
        }
        private void OnFixtureUpdate(IFixtureOverviewDelta fixture)
        {
            if (fixture == null)
                return;

            FixtureDetails details = new FixtureDetails {Id = fixture.Id};

            // ListenerOverview is not suitable to use here....
            // we have to get the FixtureOverview to have all data
            var overview = Supervisor.GetFixtureOverview(fixture.Id);
            FillFixtureOverview(details, overview);

            if (fixture.ListenerOverview != null)
            {
                details.IsDeleted = fixture.ListenerOverview.IsDeleted.GetValueOrDefault();
                details.IsOver = fixture.ListenerOverview.IsOver.GetValueOrDefault();
            }

            if(fixture.FeedUpdate != null)
            {
                FixtureProcessingEntry entry = new FixtureProcessingEntry();
                FillProcessingEntry(entry, fixture.FeedUpdate);
                details.AddProcessingEntry(entry);
            }

            Supervisor.Service.StreamingService.OnFixtureUpdate(details);

            if(fixture.LastError != null && fixture.LastError.IsErrored)
            {
                ProcessingEntryError error = new ProcessingEntryError
                {
                    FixtureId = fixture.Id,
                    FixtureDescription = overview.Name,
                    Sequence = fixture.LastError.Sequence
                };

                FillProcessingEntryError(error, fixture.LastError);
                Supervisor.Service.StreamingService.OnError(error);
            }
            
        }
 private static void FillProcessingEntry(FixtureProcessingEntry entry, FeedUpdateOverview update)
 {
     entry.Epoch = update.Epoch.ToString();
     entry.EpochChangeReasons = update.LastEpochChangeReason;
     entry.Exception = update.LastError;
     entry.IsUpdate = !update.IsSnapshot;
     entry.Sequence = update.Sequence.ToString();
     entry.Timestamp = update.Issued;
     entry.State = update.IsProcessed ? FixtureProcessingState.PROCESSED : FixtureProcessingState.PROCESSING;
 }
        public IEnumerable<IFixtureProcessingEntry> GetFixtureHistory(string fixtureId)
        {
            if (string.IsNullOrEmpty(fixtureId))
                return Enumerable.Empty<IFixtureProcessingEntry>();

            List<IFixtureProcessingEntry> ret = new List<IFixtureProcessingEntry>();

            var tmp = Supervisor.GetFixtureOverview(fixtureId);
            foreach(var update in tmp.GetFeedAudit())
            {
                FixtureProcessingEntry entry = new FixtureProcessingEntry();
                FillProcessingEntry(entry, update);
                ret.Add(entry);
            }

            return ret;
        }