/// <summary> /// The main view of the dash board. /// </summary> /// <returns>A view showing two charts of Crashes over time.</returns> public ActionResult Index() { using (FAutoScopedLogTimer LogTimer = new FAutoScopedLogTimer(this.GetType().ToString(), bCreateNewLog: true)) { DateTime Today = DateTime.UtcNow; DateTime AfewMonthsAgo = Today.AddMonths(-6); FAutoScopedLogTimer LogTimerSQL = new FAutoScopedLogTimer("CrashesFilterByDate", "", ""); // Get engine versions from the last 6 months. var TempVersions = _Crashes.GetVersions(); List <string> EngineUE4Versions = new List <string>(); foreach (var Version in TempVersions) { if (Version.StartsWith("4.")) { EngineUE4Versions.Add(Version); } } // Only 4 latest version. EngineUE4Versions = EngineUE4Versions.OrderByDescending(item => item).Take(5).ToList(); var endDate = Today.AddDays(1); IQueryable <Crash> CrashesInTimeFrame = _Crashes.ListAll() .Where(MyCrash => MyCrash.TimeOfCrash >= AfewMonthsAgo && MyCrash.TimeOfCrash <= endDate); //IEnumerable<Crash> Crashes = FRepository.Get().Crashes.FilterByDate( FRepository.Get().Crashes.ListAll(), AfewMonthsAgo, Today ); var VMinimalCrashes = CrashesInTimeFrame.Select(Crash => new { TimeOfCrash = Crash.TimeOfCrash, UserID = Crash.UserId, EngineVersion = Crash.BuildVersion, }) .ToList(); List <FCrashMinimal> MinimalCrashes = new List <FCrashMinimal>(VMinimalCrashes.Count); foreach (var Anotype in VMinimalCrashes) { MinimalCrashes.Add(new FCrashMinimal(Anotype.TimeOfCrash, Anotype.UserID, Anotype.EngineVersion)); } LogTimerSQL.Dispose(); HashSet <int> AnonumousIDs = new HashSet <int>(_entities.UserGroups.First(data => data.Name == "Anonymous").Users.Select(data => data.Id)); int AnonymousID = AnonumousIDs.First(); int GeneralUserGroupId = 1; //FRepository.Get( _Crashes ).FindOrAddGroup( "General" ); int CoderUserGroupId = 3; //FRepository.Get( _Crashes ).FindOrAddGroup( "Coder" ); int EngineQAUserGroupId = 22; //FRepository.Get( _Crashes ).FindOrAddGroup( "EngineQA" ); int GameQAUserGroupId = 21; //FRepository.Get( _Crashes ).FindOrAddGroup( "GameQA" ); // Weekly Dictionary <DateTime, int> WeeklyGeneralResults = GetWeeklyCountsByGroup(MinimalCrashes, GeneralUserGroupId); Dictionary <DateTime, int> WeeklyCoderResults = GetWeeklyCountsByGroup(MinimalCrashes, CoderUserGroupId); Dictionary <DateTime, int> WeeklyEngineQAResults = GetWeeklyCountsByGroup(MinimalCrashes, EngineQAUserGroupId); Dictionary <DateTime, int> WeeklyGameQAResults = GetWeeklyCountsByGroup(MinimalCrashes, GameQAUserGroupId); Dictionary <string, Dictionary <DateTime, int> > WeeklyEngineVersionResults = new Dictionary <string, Dictionary <DateTime, int> >(); foreach (string UE4Version in EngineUE4Versions) { Dictionary <DateTime, int> Results = GetWeeklyCountsByVersion(MinimalCrashes, UE4Version, AnonymousID); WeeklyEngineVersionResults.Add(UE4Version, Results); } Dictionary <DateTime, int> WeeklyAllResults = GetWeeklyCountsByGroup(MinimalCrashes, AllUserGroupId); // Daily Dictionary <DateTime, int> DailyGeneralResults = GetDailyCountsByGroup(MinimalCrashes, GeneralUserGroupId); Dictionary <DateTime, int> DailyCoderResults = GetDailyCountsByGroup(MinimalCrashes, CoderUserGroupId); Dictionary <DateTime, int> DailyEngineQAResults = GetDailyCountsByGroup(MinimalCrashes, EngineQAUserGroupId); Dictionary <DateTime, int> DailyGameQAResults = GetDailyCountsByGroup(MinimalCrashes, GameQAUserGroupId); Dictionary <string, Dictionary <DateTime, int> > DailyEngineVersionResults = new Dictionary <string, Dictionary <DateTime, int> >(); foreach (string UE4Version in EngineUE4Versions) { Dictionary <DateTime, int> Results = GetDailyCountsByVersion(MinimalCrashes, UE4Version, AnonymousID); DailyEngineVersionResults.Add(UE4Version, Results); } Dictionary <DateTime, int> DailyAllResults = GetDailyCountsByGroup(MinimalCrashes, AllUserGroupId); // Get daily buggs stats. List <Bugg> Buggs = _Buggs.ListAll().Where(Bugg => Bugg.TimeOfFirstCrash >= AfewMonthsAgo).ToList(); Dictionary <DateTime, int> BuggDailyAllResults = ( from Bugg in Buggs group Bugg by Bugg.TimeOfFirstCrash.Value.Date into GroupCount orderby GroupCount.Key select new { Count = GroupCount.Count(), Date = GroupCount.Key } ).ToDictionary(x => x.Date, y => y.Count); string CrashesByWeek = ""; foreach (KeyValuePair <DateTime, int> WeeklyResult in WeeklyAllResults) { int GeneralCrashes = 0; WeeklyGeneralResults.TryGetValue(WeeklyResult.Key, out GeneralCrashes); int CoderCrashes = 0; WeeklyCoderResults.TryGetValue(WeeklyResult.Key, out CoderCrashes); int EngineQACrashes = 0; WeeklyEngineQAResults.TryGetValue(WeeklyResult.Key, out EngineQACrashes); int GameQACrashes = 0; WeeklyGameQAResults.TryGetValue(WeeklyResult.Key, out GameQACrashes); string AnonymousLine = ""; foreach (var VersionCrashes in WeeklyEngineVersionResults) { int EngineVersionCrashes = 0; VersionCrashes.Value.TryGetValue(WeeklyResult.Key, out EngineVersionCrashes); AnonymousLine += EngineVersionCrashes; AnonymousLine += ", "; } int Year = WeeklyResult.Key.Year; int Month = WeeklyResult.Key.AddMonths(-1).Month; if (WeeklyResult.Key.Month == 13 || WeeklyResult.Key.Month == 1) { Month = 0; } int Day = WeeklyResult.Key.Day + 6; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + GeneralCrashes + ", " + CoderCrashes + ", " + EngineQACrashes + ", " + GameQACrashes + ", " + AnonymousLine + WeeklyResult.Value + "], "; CrashesByWeek += Line; } CrashesByWeek = CrashesByWeek.TrimEnd(", ".ToCharArray()); string CrashesByDay = ""; foreach (KeyValuePair <DateTime, int> DailyResult in DailyAllResults) { int GeneralCrashes = 0; DailyGeneralResults.TryGetValue(DailyResult.Key, out GeneralCrashes); int CoderCrashes = 0; DailyCoderResults.TryGetValue(DailyResult.Key, out CoderCrashes); int EngineQACrashes = 0; DailyEngineQAResults.TryGetValue(DailyResult.Key, out EngineQACrashes); int GameQACrashes = 0; DailyGameQAResults.TryGetValue(DailyResult.Key, out GameQACrashes); string AnonymousLine = ""; foreach (var VersionCrashes in DailyEngineVersionResults) { int EngineVersionCrashes = 0; VersionCrashes.Value.TryGetValue(DailyResult.Key, out EngineVersionCrashes); AnonymousLine += EngineVersionCrashes; AnonymousLine += ", "; } int Year = DailyResult.Key.Year; int Month = DailyResult.Key.AddMonths(-1).Month; if (DailyResult.Key.Month == 13 || DailyResult.Key.Month == 1) { Month = 0; } int Day = DailyResult.Key.Day; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + GeneralCrashes + ", " + CoderCrashes + ", " + EngineQACrashes + ", " + GameQACrashes + ", " + AnonymousLine + DailyResult.Value + "], "; CrashesByDay += Line; } CrashesByDay = CrashesByDay.TrimEnd(", ".ToCharArray()); string BuggsByDay = ""; foreach (KeyValuePair <DateTime, int> DailyResult in BuggDailyAllResults) { int Year = DailyResult.Key.Year; int Month = DailyResult.Key.AddMonths(-1).Month; if (DailyResult.Key.Month == 13 || DailyResult.Key.Month == 1) { Month = 0; } int Day = DailyResult.Key.Day; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + DailyResult.Value + "], "; BuggsByDay += Line; } BuggsByDay = BuggsByDay.TrimEnd(", ".ToCharArray()); var ResultDashboard = new DashboardViewModel { CrashesByWeek = CrashesByWeek, CrashesByDay = CrashesByDay, BuggsByDay = BuggsByDay, EngineVersions = EngineUE4Versions, }; ResultDashboard.GenerationTime = LogTimer.GetElapsedSeconds().ToString("F2"); return(View("Index", ResultDashboard)); } }
/// <summary> /// The main view of the dash board. /// </summary> /// <returns>A view showing two charts of crashes over time.</returns> public ActionResult Index() { using( FAutoScopedLogTimer LogTimer = new FAutoScopedLogTimer( this.GetType().ToString() ) ) { /* //Temporary code to update pattern in crashes and buggs. DateTime Today11 = DateTime.UtcNow.AddDays(11); DateTime AYear = Today11.AddMonths( -12 ); var CrashList = CrashRepository.Context.Crashes.Where( X => X.TimeOfCrash >= AYear ).Select( X => X ); var BuggList = CrashRepository.Context.Buggs.Select( X => X ); int Current = 0; foreach(Crash Crash in CrashList) { if( string.IsNullOrEmpty(Crash.Pattern) ) { continue; } if( Crash.Pattern[0] != '+' ) { Crash.Pattern = "+" + Crash.Pattern + "+"; } Current++; if( Current % 16384 == 0 ) { CrashRepository.SubmitChanges(); } } foreach(Bugg Bugg in BuggList) { if( string.IsNullOrEmpty( Bugg.Pattern ) ) { continue; } if( Bugg.Pattern[0] != '+' ) { Bugg.Pattern = "+" + Bugg.Pattern + "+"; } Current++; if( Current % 16384 == 0 ) { CrashRepository.SubmitChanges(); } } */ DateTime Today = DateTime.UtcNow; DateTime AfewMonthsAgo = Today.AddMonths( -6 ); FAutoScopedLogTimer LogTimerSQL = new FAutoScopedLogTimer( "CrashesFilterByDate", "", "" ); IQueryable<Crash> Crashes = CrashRepository.FilterByDate( CrashRepository.ListAll(), AfewMonthsAgo, Today ); var VMinimalCrashes = Crashes.Select( Crash => new { TimeOfCrash = Crash.TimeOfCrash.Value, UserID = Crash.UserNameId.Value } ).ToList(); List<FCrashMinimal> MinimalCrashes = new List<FCrashMinimal>( VMinimalCrashes.Count ); foreach( var Anotype in VMinimalCrashes ) { MinimalCrashes.Add( new FCrashMinimal( Anotype.TimeOfCrash, Anotype.UserID ) ); } LogTimerSQL.Dispose(); int GeneralUserGroupId = CrashRepository.FindOrAddUserGroup( "General" ); int CoderUserGroupId = CrashRepository.FindOrAddUserGroup( "Coder" ); int EngineQAUserGroupId = CrashRepository.FindOrAddUserGroup( "EngineQA" ); int GameQAUserGroupId = CrashRepository.FindOrAddUserGroup( "GameQA" ); int AnonymousUserGroupId = CrashRepository.FindOrAddUserGroup( "Anonymous" ); Dictionary<DateTime, int> GeneralResults = GetWeeklyCountsByGroup( MinimalCrashes, GeneralUserGroupId ); Dictionary<DateTime, int> CoderResults = GetWeeklyCountsByGroup( MinimalCrashes, CoderUserGroupId ); Dictionary<DateTime, int> EngineQAResults = GetWeeklyCountsByGroup( MinimalCrashes, EngineQAUserGroupId ); Dictionary<DateTime, int> GameQAResults = GetWeeklyCountsByGroup( MinimalCrashes, GameQAUserGroupId ); Dictionary<DateTime, int> AnonymousResults = GetWeeklyCountsByGroup( MinimalCrashes, AnonymousUserGroupId ); Dictionary<DateTime, int> AllResults = GetWeeklyCountsByGroup( MinimalCrashes, AllUserGroupId ); Dictionary<DateTime, int> DailyGeneralResults = GetDailyCountsByGroup( MinimalCrashes, GeneralUserGroupId ); Dictionary<DateTime, int> DailyCoderResults = GetDailyCountsByGroup( MinimalCrashes, CoderUserGroupId ); Dictionary<DateTime, int> DailyEngineQAResults = GetDailyCountsByGroup( MinimalCrashes, EngineQAUserGroupId ); Dictionary<DateTime, int> DailyGameQAResults = GetDailyCountsByGroup( MinimalCrashes, GameQAUserGroupId ); Dictionary<DateTime, int> DailyAnonymousResults = GetDailyCountsByGroup( MinimalCrashes, AnonymousUserGroupId ); Dictionary<DateTime, int> DailyAllResults = GetDailyCountsByGroup( MinimalCrashes, AllUserGroupId ); // Get daily buggs stats. List<Bugg> Buggs = BuggRepository.ListAll().Where( Bugg => Bugg.TimeOfFirstCrash >= AfewMonthsAgo ).ToList(); Dictionary<DateTime, int> BuggDailyAllResults = ( from Bugg in Buggs group Bugg by Bugg.TimeOfFirstCrash.Value.Date into GroupCount orderby GroupCount.Key select new { Count = GroupCount.Count(), Date = GroupCount.Key } ).ToDictionary( x => x.Date, y => y.Count ); string CrashesByWeek = ""; foreach( KeyValuePair<DateTime, int> Result in AllResults ) { int GeneralCrashes = 0; GeneralResults.TryGetValue( Result.Key, out GeneralCrashes ); int CoderCrashes = 0; CoderResults.TryGetValue( Result.Key, out CoderCrashes ); int EngineQACrashes = 0; EngineQAResults.TryGetValue( Result.Key, out EngineQACrashes ); int GameQACrashes = 0; GameQAResults.TryGetValue( Result.Key, out GameQACrashes ); int AnonymousCrashes = 0; AnonymousResults.TryGetValue( Result.Key, out AnonymousCrashes ); int Year = Result.Key.Year; int Month = Result.Key.AddMonths( -1 ).Month; if( Result.Key.Month == 13 || Result.Key.Month == 1 ) { Month = 0; } int Day = Result.Key.Day + 6; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + GeneralCrashes + ", " + CoderCrashes + ", " + EngineQACrashes + ", " + GameQACrashes + ", " + AnonymousCrashes + ", " + Result.Value + "], "; CrashesByWeek += Line; } CrashesByWeek = CrashesByWeek.TrimEnd( ", ".ToCharArray() ); string CrashesByDay = ""; foreach( KeyValuePair<DateTime, int> DailyResult in DailyAllResults ) { int GeneralCrashes = 0; DailyGeneralResults.TryGetValue( DailyResult.Key, out GeneralCrashes ); int CoderCrashes = 0; DailyCoderResults.TryGetValue( DailyResult.Key, out CoderCrashes ); int EngineQACrashes = 0; DailyEngineQAResults.TryGetValue( DailyResult.Key, out EngineQACrashes ); int GameQACrashes = 0; DailyGameQAResults.TryGetValue( DailyResult.Key, out GameQACrashes ); int AnonymousCrashes = 0; DailyAnonymousResults.TryGetValue( DailyResult.Key, out AnonymousCrashes ); int Year = DailyResult.Key.Year; int Month = DailyResult.Key.AddMonths( -1 ).Month; if( DailyResult.Key.Month == 13 || DailyResult.Key.Month == 1 ) { Month = 0; } int Day = DailyResult.Key.Day; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + GeneralCrashes + ", " + CoderCrashes + ", " + EngineQACrashes + ", " + GameQACrashes + ", " + AnonymousCrashes + ", " + DailyResult.Value + "], "; CrashesByDay += Line; } CrashesByDay = CrashesByDay.TrimEnd( ", ".ToCharArray() ); string BuggsByDay = ""; foreach( KeyValuePair<DateTime, int> DailyResult in BuggDailyAllResults ) { int Year = DailyResult.Key.Year; int Month = DailyResult.Key.AddMonths( -1 ).Month; if( DailyResult.Key.Month == 13 || DailyResult.Key.Month == 1 ) { Month = 0; } int Day = DailyResult.Key.Day; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + DailyResult.Value + "], "; BuggsByDay += Line; } BuggsByDay = BuggsByDay.TrimEnd( ", ".ToCharArray() ); return View( "Index", new DashboardViewModel { CrashesByWeek = CrashesByWeek, CrashesByDay = CrashesByDay, BuggsByDay = BuggsByDay } ); } }
/// <summary> /// The main view of the dash board. /// </summary> /// <returns>A view showing two charts of crashes over time.</returns> public ActionResult Index() { using (FAutoScopedLogTimer LogTimer = new FAutoScopedLogTimer(this.GetType().ToString())) { /* * //Temporary code to update pattern in crashes and buggs. * DateTime Today11 = DateTime.UtcNow.AddDays(11); * DateTime AYear = Today11.AddMonths( -12 ); * * var CrashList = CrashRepository.Context.Crashes.Where( X => X.TimeOfCrash >= AYear ).Select( X => X ); * var BuggList = CrashRepository.Context.Buggs.Select( X => X ); * * int Current = 0; * foreach(Crash Crash in CrashList) * { * if( string.IsNullOrEmpty(Crash.Pattern) ) * { * continue; * } * if( Crash.Pattern[0] != '+' ) * { * Crash.Pattern = "+" + Crash.Pattern + "+"; * } * Current++; * if( Current % 16384 == 0 ) * { * CrashRepository.SubmitChanges(); * } * } * * * foreach(Bugg Bugg in BuggList) * { * if( string.IsNullOrEmpty( Bugg.Pattern ) ) * { * continue; * } * * if( Bugg.Pattern[0] != '+' ) * { * Bugg.Pattern = "+" + Bugg.Pattern + "+"; * } * Current++; * if( Current % 16384 == 0 ) * { * CrashRepository.SubmitChanges(); * } * } */ DateTime Today = DateTime.UtcNow; DateTime AfewMonthsAgo = Today.AddMonths(-6); FAutoScopedLogTimer LogTimerSQL = new FAutoScopedLogTimer("CrashesFilterByDate", "", ""); IQueryable <Crash> Crashes = CrashRepository.FilterByDate(CrashRepository.ListAll(), AfewMonthsAgo, Today); var VMinimalCrashes = Crashes.Select(Crash => new { TimeOfCrash = Crash.TimeOfCrash.Value, UserID = Crash.UserNameId.Value }).ToList(); List <FCrashMinimal> MinimalCrashes = new List <FCrashMinimal>(VMinimalCrashes.Count); foreach (var Anotype in VMinimalCrashes) { MinimalCrashes.Add(new FCrashMinimal(Anotype.TimeOfCrash, Anotype.UserID)); } LogTimerSQL.Dispose(); int GeneralUserGroupId = CrashRepository.FindOrAddUserGroup("General"); int CoderUserGroupId = CrashRepository.FindOrAddUserGroup("Coder"); int EngineQAUserGroupId = CrashRepository.FindOrAddUserGroup("EngineQA"); int GameQAUserGroupId = CrashRepository.FindOrAddUserGroup("GameQA"); int AnonymousUserGroupId = CrashRepository.FindOrAddUserGroup("Anonymous"); Dictionary <DateTime, int> GeneralResults = GetWeeklyCountsByGroup(MinimalCrashes, GeneralUserGroupId); Dictionary <DateTime, int> CoderResults = GetWeeklyCountsByGroup(MinimalCrashes, CoderUserGroupId); Dictionary <DateTime, int> EngineQAResults = GetWeeklyCountsByGroup(MinimalCrashes, EngineQAUserGroupId); Dictionary <DateTime, int> GameQAResults = GetWeeklyCountsByGroup(MinimalCrashes, GameQAUserGroupId); Dictionary <DateTime, int> AnonymousResults = GetWeeklyCountsByGroup(MinimalCrashes, AnonymousUserGroupId); Dictionary <DateTime, int> AllResults = GetWeeklyCountsByGroup(MinimalCrashes, AllUserGroupId); Dictionary <DateTime, int> DailyGeneralResults = GetDailyCountsByGroup(MinimalCrashes, GeneralUserGroupId); Dictionary <DateTime, int> DailyCoderResults = GetDailyCountsByGroup(MinimalCrashes, CoderUserGroupId); Dictionary <DateTime, int> DailyEngineQAResults = GetDailyCountsByGroup(MinimalCrashes, EngineQAUserGroupId); Dictionary <DateTime, int> DailyGameQAResults = GetDailyCountsByGroup(MinimalCrashes, GameQAUserGroupId); Dictionary <DateTime, int> DailyAnonymousResults = GetDailyCountsByGroup(MinimalCrashes, AnonymousUserGroupId); Dictionary <DateTime, int> DailyAllResults = GetDailyCountsByGroup(MinimalCrashes, AllUserGroupId); // Get daily buggs stats. List <Bugg> Buggs = BuggRepository.ListAll().Where(Bugg => Bugg.TimeOfFirstCrash >= AfewMonthsAgo).ToList(); Dictionary <DateTime, int> BuggDailyAllResults = ( from Bugg in Buggs group Bugg by Bugg.TimeOfFirstCrash.Value.Date into GroupCount orderby GroupCount.Key select new { Count = GroupCount.Count(), Date = GroupCount.Key } ).ToDictionary(x => x.Date, y => y.Count); string CrashesByWeek = ""; foreach (KeyValuePair <DateTime, int> Result in AllResults) { int GeneralCrashes = 0; GeneralResults.TryGetValue(Result.Key, out GeneralCrashes); int CoderCrashes = 0; CoderResults.TryGetValue(Result.Key, out CoderCrashes); int EngineQACrashes = 0; EngineQAResults.TryGetValue(Result.Key, out EngineQACrashes); int GameQACrashes = 0; GameQAResults.TryGetValue(Result.Key, out GameQACrashes); int AnonymousCrashes = 0; AnonymousResults.TryGetValue(Result.Key, out AnonymousCrashes); int Year = Result.Key.Year; int Month = Result.Key.AddMonths(-1).Month; if (Result.Key.Month == 13 || Result.Key.Month == 1) { Month = 0; } int Day = Result.Key.Day + 6; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + GeneralCrashes + ", " + CoderCrashes + ", " + EngineQACrashes + ", " + GameQACrashes + ", " + AnonymousCrashes + ", " + Result.Value + "], "; CrashesByWeek += Line; } CrashesByWeek = CrashesByWeek.TrimEnd(", ".ToCharArray()); string CrashesByDay = ""; foreach (KeyValuePair <DateTime, int> DailyResult in DailyAllResults) { int GeneralCrashes = 0; DailyGeneralResults.TryGetValue(DailyResult.Key, out GeneralCrashes); int CoderCrashes = 0; DailyCoderResults.TryGetValue(DailyResult.Key, out CoderCrashes); int EngineQACrashes = 0; DailyEngineQAResults.TryGetValue(DailyResult.Key, out EngineQACrashes); int GameQACrashes = 0; DailyGameQAResults.TryGetValue(DailyResult.Key, out GameQACrashes); int AnonymousCrashes = 0; DailyAnonymousResults.TryGetValue(DailyResult.Key, out AnonymousCrashes); int Year = DailyResult.Key.Year; int Month = DailyResult.Key.AddMonths(-1).Month; if (DailyResult.Key.Month == 13 || DailyResult.Key.Month == 1) { Month = 0; } int Day = DailyResult.Key.Day; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + GeneralCrashes + ", " + CoderCrashes + ", " + EngineQACrashes + ", " + GameQACrashes + ", " + AnonymousCrashes + ", " + DailyResult.Value + "], "; CrashesByDay += Line; } CrashesByDay = CrashesByDay.TrimEnd(", ".ToCharArray()); string BuggsByDay = ""; foreach (KeyValuePair <DateTime, int> DailyResult in BuggDailyAllResults) { int Year = DailyResult.Key.Year; int Month = DailyResult.Key.AddMonths(-1).Month; if (DailyResult.Key.Month == 13 || DailyResult.Key.Month == 1) { Month = 0; } int Day = DailyResult.Key.Day; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + DailyResult.Value + "], "; BuggsByDay += Line; } BuggsByDay = BuggsByDay.TrimEnd(", ".ToCharArray()); return(View("Index", new DashboardViewModel { CrashesByWeek = CrashesByWeek, CrashesByDay = CrashesByDay, BuggsByDay = BuggsByDay })); } }
/// <summary> /// The main view of the dash board. /// </summary> /// <returns>A view showing two charts of crashes over time.</returns> public ActionResult Index() { using( FAutoScopedLogTimer LogTimer = new FAutoScopedLogTimer( this.GetType().ToString(), bCreateNewLog: true ) ) { DateTime Today = DateTime.UtcNow; DateTime AfewMonthsAgo = Today.AddMonths( -6 ); FAutoScopedLogTimer LogTimerSQL = new FAutoScopedLogTimer( "CrashesFilterByDate", "", "" ); // Get engine versions from the last 6 months. var TempVersions = _Crashes.GetVersions(); List<string> EngineUE4Versions = new List<string>(); foreach (var Version in TempVersions) { if( Version.StartsWith("4.") ) { EngineUE4Versions.Add( Version ); } } // Only 4 latest version. EngineUE4Versions = EngineUE4Versions.OrderByDescending( item => item ).Take( 5 ).ToList(); var endDate = Today.AddDays(1); IQueryable<Crash> CrashesInTimeFrame = _Crashes.ListAll() .Where(MyCrash => MyCrash.TimeOfCrash >= AfewMonthsAgo && MyCrash.TimeOfCrash <= endDate); //IEnumerable<Crash> Crashes = FRepository.Get().Crashes.FilterByDate( FRepository.Get().Crashes.ListAll(), AfewMonthsAgo, Today ); var VMinimalCrashes = CrashesInTimeFrame.Select( Crash => new { TimeOfCrash = Crash.TimeOfCrash.Value, UserID = Crash.UserNameId.Value, EngineVersion = Crash.BuildVersion, } ) .ToList(); List<FCrashMinimal> MinimalCrashes = new List<FCrashMinimal>( VMinimalCrashes.Count ); foreach( var Anotype in VMinimalCrashes ) { MinimalCrashes.Add( new FCrashMinimal( Anotype.TimeOfCrash, Anotype.UserID, Anotype.EngineVersion ) ); } LogTimerSQL.Dispose(); HashSet<int> AnonumousIDs = new HashSet<int>(_entities.UserGroups.First(data => data.Name == "Anonymous").Users.Select(data => data.Id)); int AnonymousID = AnonumousIDs.First(); int GeneralUserGroupId = 1;//FRepository.Get( _Crashes ).FindOrAddGroup( "General" ); int CoderUserGroupId = 3;//FRepository.Get( _Crashes ).FindOrAddGroup( "Coder" ); int EngineQAUserGroupId = 22;//FRepository.Get( _Crashes ).FindOrAddGroup( "EngineQA" ); int GameQAUserGroupId = 21;//FRepository.Get( _Crashes ).FindOrAddGroup( "GameQA" ); // Weekly Dictionary<DateTime, int> WeeklyGeneralResults = GetWeeklyCountsByGroup( MinimalCrashes, GeneralUserGroupId ); Dictionary<DateTime, int> WeeklyCoderResults = GetWeeklyCountsByGroup( MinimalCrashes, CoderUserGroupId ); Dictionary<DateTime, int> WeeklyEngineQAResults = GetWeeklyCountsByGroup( MinimalCrashes, EngineQAUserGroupId ); Dictionary<DateTime, int> WeeklyGameQAResults = GetWeeklyCountsByGroup( MinimalCrashes, GameQAUserGroupId ); Dictionary<string, Dictionary<DateTime, int>> WeeklyEngineVersionResults = new Dictionary<string, Dictionary<DateTime, int>>(); foreach (string UE4Version in EngineUE4Versions) { Dictionary<DateTime, int> Results = GetWeeklyCountsByVersion( MinimalCrashes, UE4Version, AnonymousID ); WeeklyEngineVersionResults.Add( UE4Version, Results ); } Dictionary<DateTime, int> WeeklyAllResults = GetWeeklyCountsByGroup( MinimalCrashes, AllUserGroupId ); // Daily Dictionary<DateTime, int> DailyGeneralResults = GetDailyCountsByGroup( MinimalCrashes, GeneralUserGroupId ); Dictionary<DateTime, int> DailyCoderResults = GetDailyCountsByGroup( MinimalCrashes, CoderUserGroupId ); Dictionary<DateTime, int> DailyEngineQAResults = GetDailyCountsByGroup( MinimalCrashes, EngineQAUserGroupId ); Dictionary<DateTime, int> DailyGameQAResults = GetDailyCountsByGroup( MinimalCrashes, GameQAUserGroupId ); Dictionary<string, Dictionary<DateTime, int>> DailyEngineVersionResults = new Dictionary<string, Dictionary<DateTime, int>>(); foreach(string UE4Version in EngineUE4Versions) { Dictionary<DateTime, int> Results = GetDailyCountsByVersion( MinimalCrashes, UE4Version, AnonymousID ); DailyEngineVersionResults.Add( UE4Version, Results ); } Dictionary<DateTime, int> DailyAllResults = GetDailyCountsByGroup( MinimalCrashes, AllUserGroupId ); // Get daily buggs stats. List<Bugg> Buggs = _Buggs.ListAll().Where( Bugg => Bugg.TimeOfFirstCrash >= AfewMonthsAgo ).ToList(); Dictionary<DateTime, int> BuggDailyAllResults = ( from Bugg in Buggs group Bugg by Bugg.TimeOfFirstCrash.Value.Date into GroupCount orderby GroupCount.Key select new { Count = GroupCount.Count(), Date = GroupCount.Key } ).ToDictionary( x => x.Date, y => y.Count ); string CrashesByWeek = ""; foreach( KeyValuePair<DateTime, int> WeeklyResult in WeeklyAllResults ) { int GeneralCrashes = 0; WeeklyGeneralResults.TryGetValue( WeeklyResult.Key, out GeneralCrashes ); int CoderCrashes = 0; WeeklyCoderResults.TryGetValue( WeeklyResult.Key, out CoderCrashes ); int EngineQACrashes = 0; WeeklyEngineQAResults.TryGetValue( WeeklyResult.Key, out EngineQACrashes ); int GameQACrashes = 0; WeeklyGameQAResults.TryGetValue( WeeklyResult.Key, out GameQACrashes ); string AnonymousLine = ""; foreach (var VersionCrashes in WeeklyEngineVersionResults) { int EngineVersionCrashes = 0; VersionCrashes.Value.TryGetValue( WeeklyResult.Key, out EngineVersionCrashes ); AnonymousLine += EngineVersionCrashes; AnonymousLine += ", "; } int Year = WeeklyResult.Key.Year; int Month = WeeklyResult.Key.AddMonths( -1 ).Month; if( WeeklyResult.Key.Month == 13 || WeeklyResult.Key.Month == 1 ) { Month = 0; } int Day = WeeklyResult.Key.Day + 6; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + GeneralCrashes + ", " + CoderCrashes + ", " + EngineQACrashes + ", " + GameQACrashes + ", " + AnonymousLine + WeeklyResult.Value + "], "; CrashesByWeek += Line; } CrashesByWeek = CrashesByWeek.TrimEnd( ", ".ToCharArray() ); string CrashesByDay = ""; foreach( KeyValuePair<DateTime, int> DailyResult in DailyAllResults ) { int GeneralCrashes = 0; DailyGeneralResults.TryGetValue( DailyResult.Key, out GeneralCrashes ); int CoderCrashes = 0; DailyCoderResults.TryGetValue( DailyResult.Key, out CoderCrashes ); int EngineQACrashes = 0; DailyEngineQAResults.TryGetValue( DailyResult.Key, out EngineQACrashes ); int GameQACrashes = 0; DailyGameQAResults.TryGetValue( DailyResult.Key, out GameQACrashes ); string AnonymousLine = ""; foreach (var VersionCrashes in DailyEngineVersionResults) { int EngineVersionCrashes = 0; VersionCrashes.Value.TryGetValue( DailyResult.Key, out EngineVersionCrashes ); AnonymousLine += EngineVersionCrashes; AnonymousLine +=", "; } int Year = DailyResult.Key.Year; int Month = DailyResult.Key.AddMonths( -1 ).Month; if( DailyResult.Key.Month == 13 || DailyResult.Key.Month == 1 ) { Month = 0; } int Day = DailyResult.Key.Day; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + GeneralCrashes + ", " + CoderCrashes + ", " + EngineQACrashes + ", " + GameQACrashes + ", " + AnonymousLine + DailyResult.Value + "], "; CrashesByDay += Line; } CrashesByDay = CrashesByDay.TrimEnd( ", ".ToCharArray() ); string BuggsByDay = ""; foreach( KeyValuePair<DateTime, int> DailyResult in BuggDailyAllResults ) { int Year = DailyResult.Key.Year; int Month = DailyResult.Key.AddMonths( -1 ).Month; if( DailyResult.Key.Month == 13 || DailyResult.Key.Month == 1 ) { Month = 0; } int Day = DailyResult.Key.Day; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + DailyResult.Value + "], "; BuggsByDay += Line; } BuggsByDay = BuggsByDay.TrimEnd( ", ".ToCharArray() ); var ResultDashboard = new DashboardViewModel { CrashesByWeek = CrashesByWeek, CrashesByDay = CrashesByDay, BuggsByDay = BuggsByDay, EngineVersions = EngineUE4Versions, }; ResultDashboard.GenerationTime = LogTimer.GetElapsedSeconds().ToString( "F2" ); return View( "Index", ResultDashboard ); } }
/// <summary> /// The main view of the dash board. /// </summary> /// <returns>A view showing two charts of crashes over time.</returns> public ActionResult Index() { using( FAutoScopedLogTimer LogTimer = new FAutoScopedLogTimer( this.GetType().ToString(), bCreateNewLog: true ) ) { DateTime Today = DateTime.UtcNow; DateTime AfewMonthsAgo = Today.AddMonths( -6 ); FAutoScopedLogTimer LogTimerSQL = new FAutoScopedLogTimer( "CrashesFilterByDate", "", "" ); IQueryable<Crash> CrashesInTimeFrame = _Crashes.ListAll() .Where( MyCrash => MyCrash.TimeOfCrash >= AfewMonthsAgo && MyCrash.TimeOfCrash <= Today.AddDays( 1 ) ); //IEnumerable<Crash> Crashes = FRepository.Get().Crashes.FilterByDate( FRepository.Get().Crashes.ListAll(), AfewMonthsAgo, Today ); var VMinimalCrashes = CrashesInTimeFrame.Select( Crash => new { TimeOfCrash = Crash.TimeOfCrash.Value, UserID = Crash.UserNameId.Value } ).ToList(); List<FCrashMinimal> MinimalCrashes = new List<FCrashMinimal>( VMinimalCrashes.Count ); foreach( var Anotype in VMinimalCrashes ) { MinimalCrashes.Add( new FCrashMinimal( Anotype.TimeOfCrash, Anotype.UserID ) ); } LogTimerSQL.Dispose(); int GeneralUserGroupId = FRepository.Get( _Crashes ).FindOrAddGroup( "General" ); int CoderUserGroupId = FRepository.Get( _Crashes ).FindOrAddGroup( "Coder" ); int EngineQAUserGroupId = FRepository.Get( _Crashes ).FindOrAddGroup( "EngineQA" ); int GameQAUserGroupId = FRepository.Get( _Crashes ).FindOrAddGroup( "GameQA" ); int AnonymousUserGroupId = FRepository.Get( _Crashes ).FindOrAddGroup( "Anonymous" ); Dictionary<DateTime, int> GeneralResults = GetWeeklyCountsByGroup( MinimalCrashes, GeneralUserGroupId ); Dictionary<DateTime, int> CoderResults = GetWeeklyCountsByGroup( MinimalCrashes, CoderUserGroupId ); Dictionary<DateTime, int> EngineQAResults = GetWeeklyCountsByGroup( MinimalCrashes, EngineQAUserGroupId ); Dictionary<DateTime, int> GameQAResults = GetWeeklyCountsByGroup( MinimalCrashes, GameQAUserGroupId ); Dictionary<DateTime, int> AnonymousResults = GetWeeklyCountsByGroup( MinimalCrashes, AnonymousUserGroupId ); Dictionary<DateTime, int> AllResults = GetWeeklyCountsByGroup( MinimalCrashes, AllUserGroupId ); Dictionary<DateTime, int> DailyGeneralResults = GetDailyCountsByGroup( MinimalCrashes, GeneralUserGroupId ); Dictionary<DateTime, int> DailyCoderResults = GetDailyCountsByGroup( MinimalCrashes, CoderUserGroupId ); Dictionary<DateTime, int> DailyEngineQAResults = GetDailyCountsByGroup( MinimalCrashes, EngineQAUserGroupId ); Dictionary<DateTime, int> DailyGameQAResults = GetDailyCountsByGroup( MinimalCrashes, GameQAUserGroupId ); Dictionary<DateTime, int> DailyAnonymousResults = GetDailyCountsByGroup( MinimalCrashes, AnonymousUserGroupId ); Dictionary<DateTime, int> DailyAllResults = GetDailyCountsByGroup( MinimalCrashes, AllUserGroupId ); // Get daily buggs stats. List<Bugg> Buggs = _Buggs.ListAll().Where( Bugg => Bugg.TimeOfFirstCrash >= AfewMonthsAgo ).ToList(); Dictionary<DateTime, int> BuggDailyAllResults = ( from Bugg in Buggs group Bugg by Bugg.TimeOfFirstCrash.Value.Date into GroupCount orderby GroupCount.Key select new { Count = GroupCount.Count(), Date = GroupCount.Key } ).ToDictionary( x => x.Date, y => y.Count ); string CrashesByWeek = ""; foreach( KeyValuePair<DateTime, int> Result in AllResults ) { int GeneralCrashes = 0; GeneralResults.TryGetValue( Result.Key, out GeneralCrashes ); int CoderCrashes = 0; CoderResults.TryGetValue( Result.Key, out CoderCrashes ); int EngineQACrashes = 0; EngineQAResults.TryGetValue( Result.Key, out EngineQACrashes ); int GameQACrashes = 0; GameQAResults.TryGetValue( Result.Key, out GameQACrashes ); int AnonymousCrashes = 0; AnonymousResults.TryGetValue( Result.Key, out AnonymousCrashes ); int Year = Result.Key.Year; int Month = Result.Key.AddMonths( -1 ).Month; if( Result.Key.Month == 13 || Result.Key.Month == 1 ) { Month = 0; } int Day = Result.Key.Day + 6; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + GeneralCrashes + ", " + CoderCrashes + ", " + EngineQACrashes + ", " + GameQACrashes + ", " + AnonymousCrashes + ", " + Result.Value + "], "; CrashesByWeek += Line; } CrashesByWeek = CrashesByWeek.TrimEnd( ", ".ToCharArray() ); string CrashesByDay = ""; foreach( KeyValuePair<DateTime, int> DailyResult in DailyAllResults ) { int GeneralCrashes = 0; DailyGeneralResults.TryGetValue( DailyResult.Key, out GeneralCrashes ); int CoderCrashes = 0; DailyCoderResults.TryGetValue( DailyResult.Key, out CoderCrashes ); int EngineQACrashes = 0; DailyEngineQAResults.TryGetValue( DailyResult.Key, out EngineQACrashes ); int GameQACrashes = 0; DailyGameQAResults.TryGetValue( DailyResult.Key, out GameQACrashes ); int AnonymousCrashes = 0; DailyAnonymousResults.TryGetValue( DailyResult.Key, out AnonymousCrashes ); int Year = DailyResult.Key.Year; int Month = DailyResult.Key.AddMonths( -1 ).Month; if( DailyResult.Key.Month == 13 || DailyResult.Key.Month == 1 ) { Month = 0; } int Day = DailyResult.Key.Day; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + GeneralCrashes + ", " + CoderCrashes + ", " + EngineQACrashes + ", " + GameQACrashes + ", " + AnonymousCrashes + ", " + DailyResult.Value + "], "; CrashesByDay += Line; } CrashesByDay = CrashesByDay.TrimEnd( ", ".ToCharArray() ); string BuggsByDay = ""; foreach( KeyValuePair<DateTime, int> DailyResult in BuggDailyAllResults ) { int Year = DailyResult.Key.Year; int Month = DailyResult.Key.AddMonths( -1 ).Month; if( DailyResult.Key.Month == 13 || DailyResult.Key.Month == 1 ) { Month = 0; } int Day = DailyResult.Key.Day; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + DailyResult.Value + "], "; BuggsByDay += Line; } BuggsByDay = BuggsByDay.TrimEnd( ", ".ToCharArray() ); var ResultDashboard = new DashboardViewModel { CrashesByWeek = CrashesByWeek, CrashesByDay = CrashesByDay, BuggsByDay = BuggsByDay }; ResultDashboard.GenerationTime = LogTimer.GetElapsedSeconds().ToString( "F2" ); return View( "Index", ResultDashboard ); } }
/// <summary> /// The main view of the dash board. /// </summary> /// <returns>A view showing two charts of crashes over time.</returns> public ActionResult Index() { using (FAutoScopedLogTimer LogTimer = new FAutoScopedLogTimer(this.GetType().ToString(), bCreateNewLog: true)) { DateTime Today = DateTime.UtcNow; DateTime AfewMonthsAgo = Today.AddMonths(-6); FAutoScopedLogTimer LogTimerSQL = new FAutoScopedLogTimer("CrashesFilterByDate", "", ""); IQueryable <Crash> CrashesInTimeFrame = _Crashes.ListAll() .Where(MyCrash => MyCrash.TimeOfCrash >= AfewMonthsAgo && MyCrash.TimeOfCrash <= Today.AddDays(1)); //IEnumerable<Crash> Crashes = FRepository.Get().Crashes.FilterByDate( FRepository.Get().Crashes.ListAll(), AfewMonthsAgo, Today ); var VMinimalCrashes = CrashesInTimeFrame.Select(Crash => new { TimeOfCrash = Crash.TimeOfCrash.Value, UserID = Crash.UserNameId.Value }).ToList(); List <FCrashMinimal> MinimalCrashes = new List <FCrashMinimal>(VMinimalCrashes.Count); foreach (var Anotype in VMinimalCrashes) { MinimalCrashes.Add(new FCrashMinimal(Anotype.TimeOfCrash, Anotype.UserID)); } LogTimerSQL.Dispose(); int GeneralUserGroupId = FRepository.Get(_Crashes).FindOrAddGroup("General"); int CoderUserGroupId = FRepository.Get(_Crashes).FindOrAddGroup("Coder"); int EngineQAUserGroupId = FRepository.Get(_Crashes).FindOrAddGroup("EngineQA"); int GameQAUserGroupId = FRepository.Get(_Crashes).FindOrAddGroup("GameQA"); int AnonymousUserGroupId = FRepository.Get(_Crashes).FindOrAddGroup("Anonymous"); Dictionary <DateTime, int> GeneralResults = GetWeeklyCountsByGroup(MinimalCrashes, GeneralUserGroupId); Dictionary <DateTime, int> CoderResults = GetWeeklyCountsByGroup(MinimalCrashes, CoderUserGroupId); Dictionary <DateTime, int> EngineQAResults = GetWeeklyCountsByGroup(MinimalCrashes, EngineQAUserGroupId); Dictionary <DateTime, int> GameQAResults = GetWeeklyCountsByGroup(MinimalCrashes, GameQAUserGroupId); Dictionary <DateTime, int> AnonymousResults = GetWeeklyCountsByGroup(MinimalCrashes, AnonymousUserGroupId); Dictionary <DateTime, int> AllResults = GetWeeklyCountsByGroup(MinimalCrashes, AllUserGroupId); Dictionary <DateTime, int> DailyGeneralResults = GetDailyCountsByGroup(MinimalCrashes, GeneralUserGroupId); Dictionary <DateTime, int> DailyCoderResults = GetDailyCountsByGroup(MinimalCrashes, CoderUserGroupId); Dictionary <DateTime, int> DailyEngineQAResults = GetDailyCountsByGroup(MinimalCrashes, EngineQAUserGroupId); Dictionary <DateTime, int> DailyGameQAResults = GetDailyCountsByGroup(MinimalCrashes, GameQAUserGroupId); Dictionary <DateTime, int> DailyAnonymousResults = GetDailyCountsByGroup(MinimalCrashes, AnonymousUserGroupId); Dictionary <DateTime, int> DailyAllResults = GetDailyCountsByGroup(MinimalCrashes, AllUserGroupId); // Get daily buggs stats. List <Bugg> Buggs = _Buggs.ListAll().Where(Bugg => Bugg.TimeOfFirstCrash >= AfewMonthsAgo).ToList(); Dictionary <DateTime, int> BuggDailyAllResults = ( from Bugg in Buggs group Bugg by Bugg.TimeOfFirstCrash.Value.Date into GroupCount orderby GroupCount.Key select new { Count = GroupCount.Count(), Date = GroupCount.Key } ).ToDictionary(x => x.Date, y => y.Count); string CrashesByWeek = ""; foreach (KeyValuePair <DateTime, int> Result in AllResults) { int GeneralCrashes = 0; GeneralResults.TryGetValue(Result.Key, out GeneralCrashes); int CoderCrashes = 0; CoderResults.TryGetValue(Result.Key, out CoderCrashes); int EngineQACrashes = 0; EngineQAResults.TryGetValue(Result.Key, out EngineQACrashes); int GameQACrashes = 0; GameQAResults.TryGetValue(Result.Key, out GameQACrashes); int AnonymousCrashes = 0; AnonymousResults.TryGetValue(Result.Key, out AnonymousCrashes); int Year = Result.Key.Year; int Month = Result.Key.AddMonths(-1).Month; if (Result.Key.Month == 13 || Result.Key.Month == 1) { Month = 0; } int Day = Result.Key.Day + 6; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + GeneralCrashes + ", " + CoderCrashes + ", " + EngineQACrashes + ", " + GameQACrashes + ", " + AnonymousCrashes + ", " + Result.Value + "], "; CrashesByWeek += Line; } CrashesByWeek = CrashesByWeek.TrimEnd(", ".ToCharArray()); string CrashesByDay = ""; foreach (KeyValuePair <DateTime, int> DailyResult in DailyAllResults) { int GeneralCrashes = 0; DailyGeneralResults.TryGetValue(DailyResult.Key, out GeneralCrashes); int CoderCrashes = 0; DailyCoderResults.TryGetValue(DailyResult.Key, out CoderCrashes); int EngineQACrashes = 0; DailyEngineQAResults.TryGetValue(DailyResult.Key, out EngineQACrashes); int GameQACrashes = 0; DailyGameQAResults.TryGetValue(DailyResult.Key, out GameQACrashes); int AnonymousCrashes = 0; DailyAnonymousResults.TryGetValue(DailyResult.Key, out AnonymousCrashes); int Year = DailyResult.Key.Year; int Month = DailyResult.Key.AddMonths(-1).Month; if (DailyResult.Key.Month == 13 || DailyResult.Key.Month == 1) { Month = 0; } int Day = DailyResult.Key.Day; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + GeneralCrashes + ", " + CoderCrashes + ", " + EngineQACrashes + ", " + GameQACrashes + ", " + AnonymousCrashes + ", " + DailyResult.Value + "], "; CrashesByDay += Line; } CrashesByDay = CrashesByDay.TrimEnd(", ".ToCharArray()); string BuggsByDay = ""; foreach (KeyValuePair <DateTime, int> DailyResult in BuggDailyAllResults) { int Year = DailyResult.Key.Year; int Month = DailyResult.Key.AddMonths(-1).Month; if (DailyResult.Key.Month == 13 || DailyResult.Key.Month == 1) { Month = 0; } int Day = DailyResult.Key.Day; string Line = "[new Date(" + Year + ", " + Month + ", " + Day + "), " + DailyResult.Value + "], "; BuggsByDay += Line; } BuggsByDay = BuggsByDay.TrimEnd(", ".ToCharArray()); var ResultDashboard = new DashboardViewModel { CrashesByWeek = CrashesByWeek, CrashesByDay = CrashesByDay, BuggsByDay = BuggsByDay }; ResultDashboard.GenerationTime = LogTimer.GetElapsedSeconds().ToString("F2"); return(View("Index", ResultDashboard)); } }