public ProjectController(IProjectRepository projectRepository, IOrganizationRepository organizationRepository, IQueue <WorkItemData> workItemQueue, BillingManager billingManager, EventStats stats, ILoggerFactory loggerFactory, IMapper mapper) : base(projectRepository, loggerFactory, mapper) { _organizationRepository = organizationRepository; _workItemQueue = workItemQueue; _billingManager = billingManager; _stats = stats; }
internal EventStats GetStatsCumulativeTotals(List <EventStats> listOfStatsByDay) { EventStats theEventStatsWeWant = new EventStats(); foreach (EventStats eventStat in listOfStatsByDay) { theEventStatsWeWant.tag = eventStat.tag; theEventStatsWeWant.Accepted.Incoming = theEventStatsWeWant.Accepted.Incoming + eventStat.Accepted.Incoming; theEventStatsWeWant.Accepted.Outgoing = theEventStatsWeWant.Accepted.Outgoing + eventStat.Accepted.Outgoing; theEventStatsWeWant.Accepted.Total = theEventStatsWeWant.Accepted.Total + eventStat.Accepted.Total; theEventStatsWeWant.Clicked.Unique = theEventStatsWeWant.Clicked.Unique + eventStat.Clicked.Unique; theEventStatsWeWant.Clicked.Total = theEventStatsWeWant.Clicked.Total + eventStat.Clicked.Total; theEventStatsWeWant.Complained.Total = theEventStatsWeWant.Complained.Total + eventStat.Complained.Total; theEventStatsWeWant.Delivered.Http = theEventStatsWeWant.Delivered.Http + eventStat.Delivered.Http; theEventStatsWeWant.Delivered.Smtp = theEventStatsWeWant.Delivered.Smtp + eventStat.Delivered.Smtp; theEventStatsWeWant.Delivered.Total = theEventStatsWeWant.Delivered.Total + eventStat.Delivered.Total; theEventStatsWeWant.Failed.Permanent.Bounce = theEventStatsWeWant.Failed.Permanent.Bounce + eventStat.Failed.Permanent.Bounce; theEventStatsWeWant.Failed.Permanent.DelayedBounce = theEventStatsWeWant.Failed.Permanent.DelayedBounce + eventStat.Failed.Permanent.DelayedBounce; theEventStatsWeWant.Failed.Permanent.SuppressBounce = theEventStatsWeWant.Failed.Permanent.SuppressBounce + eventStat.Failed.Permanent.SuppressBounce; theEventStatsWeWant.Failed.Permanent.SuppressComplaint = theEventStatsWeWant.Failed.Permanent.SuppressComplaint + eventStat.Failed.Permanent.SuppressComplaint; theEventStatsWeWant.Failed.Permanent.SuppressUnsubscribe = theEventStatsWeWant.Failed.Permanent.SuppressUnsubscribe + eventStat.Failed.Permanent.SuppressUnsubscribe; theEventStatsWeWant.Failed.Permanent.Total = theEventStatsWeWant.Failed.Permanent.Total + eventStat.Failed.Permanent.Total; theEventStatsWeWant.Failed.Temporary.Espblock = theEventStatsWeWant.Failed.Temporary.Espblock + eventStat.Failed.Temporary.Espblock; theEventStatsWeWant.Failed.Temporary.Total = theEventStatsWeWant.Failed.Temporary.Total + eventStat.Failed.Temporary.Total; theEventStatsWeWant.Opened.Unique = theEventStatsWeWant.Opened.Unique + eventStat.Opened.Unique; theEventStatsWeWant.Opened.Total = theEventStatsWeWant.Opened.Total + eventStat.Opened.Total; theEventStatsWeWant.Stored.Total = theEventStatsWeWant.Stored.Total = eventStat.Stored.Total; theEventStatsWeWant.Unsubscribed.Total = theEventStatsWeWant.Unsubscribed.Total + eventStat.Unsubscribed.Total; } return(theEventStatsWeWant); }
public StatsController(IOrganizationRepository organizationRepository, IProjectRepository projectRepository, IStackRepository stackRepository, EventStats stats) { _organizationRepository = organizationRepository; _projectRepository = projectRepository; _stackRepository = stackRepository; _stats = stats; }
private void LiveConsume() { Receive <DataResponse>(c => { for (var i = 0; i < c.Data.Count; i++) { var msgData = c.Data.ElementAt(i); var msg = msgData["__message_id__"].ToString().Trim('(', ')').Split(',').Select(int.Parse).ToArray(); var messageId = MessageIdUtils.GetOffset(new MessageId(msg[0], msg[1], msg[2])); var eventMessage = new EventEnvelope(msgData, messageId, _topicName.ToString()); _buffer.Post(eventMessage); _currentOffset = messageId; } _buffer.Post(new EventStats(new StatsResponse(c.StatementStats))); }); Receive <StatsResponse>(s => { var stats = new EventStats(s); _buffer.Post(stats); }); Receive <ErrorResponse>(s => { var error = new EventError(s); _buffer.Post(error); }); _queryCancelable = _scheduler.ScheduleOnceCancelable(TimeSpan.FromSeconds(60), Query); }
private void Consume() { Receive<DataResponse>(c => { for (var i = 0; i < c.Data.Count; i++) { var msgData = c.Data.ElementAt(i); var msg = msgData["__message_id__"].ToString().Trim('(', ')').Split(',').Select(int.Parse).ToArray(); var messageId = MessageIdUtils.GetOffset(new MessageId(msg[0], msg[1], msg[2])); if (messageId <= _toMessageId) { var eventMessage = new EventEnvelope(msgData, messageId, _topicName.ToString()); _buffer.Post(eventMessage); _currentOffset = messageId; } else Self.GracefulStop(TimeSpan.FromSeconds(5)); } _buffer.Post(new EventStats(new StatsResponse(c.StatementStats))); }); Receive<StatsResponse>(s => { var stats = new EventStats(s); _buffer.Post(stats); }); Receive<ErrorResponse>(s => { var error = new EventError(s); _buffer.Post(error); }); Receive<ReceiveTimeout>(t => { Self.GracefulStop(TimeSpan.FromSeconds(5)); }); //to track last sequence id for lagging player Context.SetReceiveTimeout(TimeSpan.FromSeconds(30)); }
public DailyNotificationJob(IProjectRepository projectRepository, IOrganizationRepository organizationRepository, IUserRepository userRepository, IStackRepository stackRepository, EventStats stats, IMailer mailer, ILockProvider lockProvider) { _projectRepository = projectRepository; _organizationRepository = organizationRepository; _userRepository = userRepository; _stackRepository = stackRepository; _stats = stats; _mailer = mailer; LockProvider = lockProvider; }
public OrganizationController(IOrganizationRepository organizationRepository, IUserRepository userRepository, IProjectRepository projectRepository, BillingManager billingManager, ProjectController projectController, IMailer mailer, IMessagePublisher messagePublisher, EventStats stats) : base(organizationRepository) { _userRepository = userRepository; _projectRepository = projectRepository; _billingManager = billingManager; _projectController = projectController; _mailer = mailer; _messagePublisher = messagePublisher; _stats = stats; }
public DailySummaryJob(IProjectRepository projectRepository, IOrganizationRepository organizationRepository, IUserRepository userRepository, IEventRepository eventRepository, EventStats stats, IMailer mailer, ICacheClient cacheClient, ILoggerFactory loggerFactory = null) : base(loggerFactory) { _projectRepository = projectRepository; _organizationRepository = organizationRepository; _userRepository = userRepository; _eventRepository = eventRepository; _stats = stats; _mailer = mailer; _lockProvider = new ThrottlingLockProvider(cacheClient, 1, TimeSpan.FromHours(1)); }
public OrganizationController(IOrganizationRepository organizationRepository, ICacheClient cacheClient, IUserRepository userRepository, IProjectRepository projectRepository, IQueue <WorkItemData> workItemQueue, BillingManager billingManager, IMailer mailer, IMessagePublisher messagePublisher, EventStats stats, ILoggerFactory loggerFactory, IMapper mapper) : base(organizationRepository, loggerFactory, mapper) { _cacheClient = cacheClient; _userRepository = userRepository; _projectRepository = projectRepository; _workItemQueue = workItemQueue; _billingManager = billingManager; _mailer = mailer; _messagePublisher = messagePublisher; _stats = stats; }
private void PrepareCapture() { serverChannelName = GenerateChannelName(); serverChannel = CreateServerChannel(serverChannelName); clients = new List <int>(); eventQueue = new List <Event>(); eventStats = new EventStats(); ChannelServices.RegisterChannel(serverChannel, false); RemotingServices.Marshal(this, serverChannelName, typeof(IManager)); }
public StatsTests(ITestOutputHelper output) : base(output) { _stats = GetService <EventStats>(); _pipeline = GetService <EventPipeline>(); _eventRepository = GetService <IEventRepository>(); _stackRepository = GetService <IStackRepository>(); _organizationRepository = GetService <IOrganizationRepository>(); _projectRepository = GetService <IProjectRepository>(); Log.SetLogLevel <EventStats>(LogLevel.Trace); }
public ActionResult TagStats(string id, string start, string end) { start = "01/" + start.Substring(3, start.Length - 3); GetDaysInMonth(end, ref end); ViewData["TagID"] = id; DateTime thestartDateWeWant = Convert.ToDateTime(start); ViewData["startdate"] = start; ViewData["enddate"] = end; TagService tagService = new TagService(); EventStats viewModel = tagService.GetTagStats(id, thestartDateWeWant); return(View(viewModel)); }
public EventStats GetEventStats(int eventID) { var result = new EventStats(); var evnt = new Event(); var allLines = new List <BetLine>(); using (var session = RavenDocStore.Store.OpenSession()) { evnt = session.Load <Event>(eventID); } using (var session = RavenDocStore.Store.OpenSession()) { // raven doesnt support selectmany >:[ allLines = session.Query <Event>() .Take(1000) .ToList() .SelectMany(x => x.BetLines) .ToList(); } foreach (var line in evnt.BetLines) { var myStats = new FighterStat(); var myLines = allLines .Where(x => x.FighterName.ToLower().Replace(".", "").Replace(" ", "") == line.FighterName.ToLower().Replace(".", "").Replace(" ", "")) .ToList(); var favorites = myLines.Where(x => x.Odds < 2.00M); var underdogs = myLines.Where(x => x.Odds >= 2.00M); var favoriteWins = favorites.Where(x => x.Result == Result.Win); var favoriteLosses = favorites.Where(x => x.Result == Result.Lose); var underdogWins = underdogs.Where(x => x.Result == Result.Win); var underdogLosses = underdogs.Where(x => x.Result == Result.Lose); myStats.FighterName = line.FighterName; myStats.WinsAsFavorite = favoriteWins.Count(); myStats.LossesAsFavorite = favoriteLosses.Count(); myStats.WinsAsUnderdog = underdogWins.Count(); myStats.LossesAsUnderdog = underdogLosses.Count(); var allWins = favoriteWins.Concat(underdogWins); var allLosses = favoriteLosses.Concat(underdogLosses); var winPayouts = allWins.Sum(x => x.Odds) - allWins.Count(); var totalLoss = (decimal)allLosses.Count(); myStats.TotalOdds = winPayouts - totalLoss; result.FighterStats.Add(myStats); } return(result); }
public StackController(IStackRepository stackRepository, IOrganizationRepository organizationRepository, IProjectRepository projectRepository, IQueue <WorkItemData> workItemQueue, IWebHookRepository webHookRepository, WebHookDataPluginManager webHookDataPluginManager, IQueue <WebHookNotification> webHookNotificationQueue, ICacheClient cacheClient, EventStats eventStats, BillingManager billingManager, FormattingPluginManager formattingPluginManager, ILoggerFactory loggerFactory, IMapper mapper) : base(stackRepository, loggerFactory, mapper) { _stackRepository = stackRepository; _organizationRepository = organizationRepository; _projectRepository = projectRepository; _workItemQueue = workItemQueue; _webHookRepository = webHookRepository; _webHookDataPluginManager = webHookDataPluginManager; _webHookNotificationQueue = webHookNotificationQueue; _cacheClient = cacheClient; _eventStats = eventStats; _billingManager = billingManager; _formattingPluginManager = formattingPluginManager; AllowedFields.AddRange(new[] { "first", "last" }); }
private void UnprepareCapture(bool captureStarted) { RemotingServices.Disconnect(this); ChannelServices.UnregisterChannel(serverChannel); serverChannelName = null; serverChannel = null; clients = null; if (captureStarted) { eventQueue.Sort(); } else { eventQueue = null; } eventStats = null; details = null; }
public void Handle(IMessage message) { _totalEvents++; var eventName = message.GetType().Name; DispatcherHelper.CheckBeginInvokeOnUI(() => { var stat = Statistics.FirstOrDefault(s => s.EventName == eventName); if (stat != null) stat.Hits++; else { stat = new EventStats(eventName, message.GetType().Assembly.FullName) { Hits = 1 }; Statistics.Add(stat); } }); }
public async Task <EventStats> GetEventStats() { EventStats eventStats = new EventStats(); var _events = await unitOfWork.EventRepository.GetAllEventsAsync(); if (_events == null || _events.Count() == 0) { eventStats.EventsLastMonth = 0; eventStats.EventsThisMonth = 0; return(eventStats); } var _current = DateTime.Now; var _lastMonth = DateTime.Now.AddMonths(-1); int eventsThisMonth = _events.Where(x => x.EventStartTime?.Month == _current.Month && x.EventStartTime?.Year == _current.Year).Count(); int eventsLastMonth = _events.Where(x => x.EventStartTime?.Month == _lastMonth.Month && x.EventStartTime?.Year == _lastMonth.Year).Count(); eventStats.EventsLastMonth = eventsLastMonth; eventStats.EventsThisMonth = eventsThisMonth; return(eventStats); }
public void Handle(IMessage message) { _totalEvents++; var eventName = message.GetType().Name; DispatcherHelper.CheckBeginInvokeOnUI(() => { var stat = Statistics.FirstOrDefault(s => s.EventName == eventName); if (stat != null) { stat.Hits++; } else { stat = new EventStats(eventName, message.GetType().Assembly.FullName) { Hits = 1 }; Statistics.Add(stat); } }); }
public StatsController(IStackRepository stackRepository, IProjectRepository projectRepository, EventStats stats) { _stackRepository = stackRepository; _projectRepository = projectRepository; _stats = stats; }
private void UnprepareCapture(bool captureStarted) { RemotingServices.Disconnect(this); ChannelServices.UnregisterChannel(serverChannel); serverChannelName = null; serverChannel = null; clients = null; if (captureStarted) eventQueue.Sort(); else eventQueue = null; eventStats = null; details = null; }
private void PrepareCapture() { serverChannelName = GenerateChannelName(); serverChannel = CreateServerChannel(serverChannelName); clients = new List<int>(); eventQueue = new List<Event>(); eventStats = new EventStats(); ChannelServices.RegisterChannel(serverChannel, false); RemotingServices.Marshal(this, serverChannelName, typeof(IManager)); }
public StatsController(IOrganizationRepository organizationRepository, EventStats stats, ILogger <StatsController> logger) { _organizationRepository = organizationRepository; _stats = stats; _logger = logger; }
public static EventStats GetEventResults(int LeagueID, int LeagueEventID, Dictionary <int, int> handicaps) { EventStats retVal = new EventStats(); retVal.initialize(); Dictionary <int, int> matchups = DatabaseFunctions.GetMatchups(LeagueEventID); Dictionary <string, string> LeagueSettings = DatabaseFunctions.GetLeagueSettings(LeagueID); Dictionary <int, List <byte> > scores = DatabaseFunctions.GetScores(LeagueEventID); CourseInfo courseInfo = DatabaseFunctions.GetCourseInfo(LeagueEventID); Dictionary <int, int> subs = DatabaseFunctions.GetSubs(LeagueEventID); if (handicaps == null) { handicaps = Scoring.GetPlayerHandicapsForEvent(LeagueID, LeagueEventID, scores.Keys.ToList()); } if (LeagueSettings.ContainsKey("MaxHandicap")) { int maxhandicap = int.Parse(LeagueSettings["MaxHandicap"]); List <int> keys = handicaps.Keys.ToList(); foreach (int key in keys) { if (handicaps[key] > maxhandicap) { handicaps[key] = maxhandicap; } } } int Team1PlayerA_ID, Team1PlayerB_ID, Team2PlayerA_ID, Team2PlayerB_ID; //Add No shows to Handicaps and scores var noShowScores = Scoring.GetNoShowScores(courseInfo); scores.Add(0, noShowScores); scores.Add(-1, noShowScores); scores.Add(-2, noShowScores); if (LeagueSettings.ContainsKey("NewScoring")) { handicaps.Add(0, 7); //no show handicaps.Add(-1, 7); //blind1 handicaps.Add(-2, 7); //blind2 } else { handicaps.Add(0, 0); //no show handicaps.Add(-1, 9); //blind1 handicaps.Add(-2, 9); //blind2 } Dictionary <int, Team> teams = DatabaseFunctions.GetTeams(LeagueID); int index = 0; //foreach matchup foreach (int team1ID in matchups.Keys) { Scoring.GetGolferIDs(team1ID, LeagueEventID, subs, handicaps, scores, out Team1PlayerA_ID, out Team1PlayerB_ID); Scoring.GetGolferIDs(matchups[team1ID], LeagueEventID, subs, handicaps, scores, out Team2PlayerA_ID, out Team2PlayerB_ID); Scoring.MatchupResults results_A = Scoring.GetMatchupResults(scores[Team1PlayerA_ID], scores[Team2PlayerA_ID], handicaps[Team1PlayerA_ID], handicaps[Team2PlayerA_ID], courseInfo); results_A.Team1PlayerID = Team1PlayerA_ID; results_A.Team2PlayerID = Team2PlayerA_ID; Scoring.MatchupResults results_B = Scoring.GetMatchupResults(scores[Team1PlayerB_ID], scores[Team2PlayerB_ID], handicaps[Team1PlayerB_ID], handicaps[Team2PlayerB_ID], courseInfo); results_B.Team1PlayerID = Team1PlayerB_ID; results_B.Team2PlayerID = Team2PlayerB_ID; index++; if (LeagueSettings.ContainsKey("SubPtsLimit")) { results_A = AdjustResultsForSubs(results_A, WasPlayerSubbing(Team1PlayerA_ID, team1ID, subs, teams), WasPlayerSubbing(Team2PlayerA_ID, matchups[team1ID], subs, teams)); results_B = AdjustResultsForSubs(results_B, WasPlayerSubbing(Team1PlayerB_ID, team1ID, subs, teams), WasPlayerSubbing(Team2PlayerB_ID, matchups[team1ID], subs, teams)); } if (LeagueSettings.ContainsKey("NewScoring")) { results_A = AdjustResultsForNoShows(results_A, Team1PlayerA_ID, Team2PlayerA_ID); results_B = AdjustResultsForNoShows(results_B, Team1PlayerB_ID, Team2PlayerB_ID); } if (Team1PlayerA_ID > 0) { retVal.grossScores.Add(Team1PlayerA_ID, results_A.grossScorePlayer1); retVal.netScores.Add(Team1PlayerA_ID, results_A.netScorePlayer1); } if (Team2PlayerA_ID > 0) { retVal.grossScores.Add(Team2PlayerA_ID, results_A.grossScorePlayer2); retVal.netScores.Add(Team2PlayerA_ID, results_A.netScorePlayer2); } if (Team1PlayerB_ID > 0) { retVal.netScores.Add(Team1PlayerB_ID, results_B.netScorePlayer1); retVal.grossScores.Add(Team1PlayerB_ID, results_B.grossScorePlayer1); } if (Team2PlayerB_ID > 0) { retVal.grossScores.Add(Team2PlayerB_ID, results_B.grossScorePlayer2); retVal.netScores.Add(Team2PlayerB_ID, results_B.netScorePlayer2); } int team1MedalPlayPts, team2MedalPlayPts; CalculateMedalPlay(out team1MedalPlayPts, out team2MedalPlayPts, results_A, results_B, LeagueSettings); retVal.teamPts.Add(team1ID, results_A.totalPtsPlayer1 + results_B.totalPtsPlayer1 + team1MedalPlayPts); retVal.teamPts.Add(matchups[team1ID], results_A.totalPtsPlayer2 + results_B.totalPtsPlayer2 + team2MedalPlayPts); retVal.matchupResultsA.Add(team1ID, results_A); retVal.matchupResultsB.Add(team1ID, results_B); } return(retVal); }