public /* for test purposes */ static SummaryReportData CreateSummaryData( AnalysisConfig config, ProjectInfoAnalysisResult result) { if (config == null) { throw new ArgumentNullException("config"); } if (result == null) { throw new ArgumentNullException("result"); } var validProjects = result.GetProjectsByStatus(ProjectInfoValidity.Valid); var summaryData = new SummaryReportData { SkippedProjects = result.Projects.Count(p => p.Status == ProjectInfoValidity.NoFilesToAnalyze), InvalidProjects = result.Projects.Count(p => p.Status == ProjectInfoValidity.InvalidGuid), ExcludedProjects = result.Projects.Count(p => p.Status == ProjectInfoValidity.ExcludeFlagSet), ProductProjects = validProjects.Count(p => p.ProjectType == ProjectType.Product), TestProjects = validProjects.Count(p => p.ProjectType == ProjectType.Test), Succeeded = result.RanToCompletion, DashboardUrl = GetSonarDashboadUrl(config), ProjectDescription = string.Format(System.Globalization.CultureInfo.CurrentCulture, Resources.Report_SonarQubeProjectDescription, config.SonarProjectName, config.SonarProjectKey, config.SonarProjectVersion) }; return(summaryData); }
public ActionResult SummaryReport() { int id = Convert.ToInt32(Session["memberId"].ToString()); List <ServiceRequest> services = db.ServiceRequests.Where(a => a.Job.freelancerID == id && a.verified == true).ToList(); FreelancerClient freelancerObj = db.FreelancerClients.Find(id); CompetitiveSummary competitiveSummary = new CompetitiveSummary(freelancerObj); ProfitSummary profitSummary = new ProfitSummary(id, services); if (freelancerObj != null) { profitSummary.setProfitSummary(); competitiveSummary.calculateCompetitiveSummary(); } SummaryReportData summary = new SummaryReportData() { marketRevenue = Math.Round(competitiveSummary.getRevenue(), 2), marketShare = Math.Round(competitiveSummary.getMarketShare(), 2), numFreelancers = competitiveSummary.getFreelancers(), servicesRendered = services.Count(), totalCustomers = services.Count(), weeklyEarnings = profitSummary.weeklyEarnings, totalEarnings = profitSummary.totalEarnings }; return(View(summary)); }
/* for test purposes */ public static SummaryReportData CreateSummaryData( AnalysisConfig config, ProjectInfoAnalysisResult result) { if (config == null) { throw new ArgumentNullException("config"); } if (result == null) { throw new ArgumentNullException("result"); } SummaryReportData summaryData = new SummaryReportData(); summaryData.SkippedProjects = GetProjectsByStatus(result, ProjectInfoValidity.NoFilesToAnalyze).Count(); summaryData.InvalidProjects = GetProjectsByStatus(result, ProjectInfoValidity.InvalidGuid).Count(); summaryData.InvalidProjects += GetProjectsByStatus(result, ProjectInfoValidity.DuplicateGuid).Count(); summaryData.ExcludedProjects = GetProjectsByStatus(result, ProjectInfoValidity.ExcludeFlagSet).Count(); IEnumerable<ProjectInfo> validProjects = GetProjectsByStatus(result, ProjectInfoValidity.Valid); summaryData.ProductProjects = validProjects.Count(p => p.ProjectType == ProjectType.Product); summaryData.TestProjects = validProjects.Count(p => p.ProjectType == ProjectType.Test); summaryData.Succeeded = result.RanToCompletion; summaryData.DashboardUrl = GetSonarDashboadUrl(config); summaryData.ProjectDescription = string.Format(System.Globalization.CultureInfo.CurrentCulture, Resources.Report_SonarQubeProjectDescription, config.SonarProjectName, config.SonarProjectKey, config.SonarProjectVersion); return summaryData; }
public async Task Save(SummaryReportData summaryReportData) { var wb = new XLWorkbook(); var ws = wb.Worksheets.Add("Часы"); ws.Column(2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; ws.Cell(1, 1).Value = "Имя и фамилия:"; //ws.Cell(1,2).Value = reportData.Name; //TODO ws.Cell(2, 1).Value = "Месяц:"; ws.Cell(2, 2).Value = summaryReportData.Date; ws.Cell(2, 2).Style.DateFormat.Format = "MM.yyyy"; ws.Cell(3, 1).Value = "Запланированных часов:"; ws.Cell(4, 1).Value = "Закрытых часов:"; ws.Cell(4, 2).Value = summaryReportData.ClosedHours; var rngTitle1 = ws.Range(1, 1, 4, 1); SetRangeStyle(rngTitle1); var row = 5; foreach (var reportData in summaryReportData.Projects) { ws.Cell(++row, 1).Value = "Проект:"; ws.Cell(row, 2).Value = reportData.Name; SetRangeStyle(ws.Range(row, 1, row, 1)); ws.Cell(++row, 1).Value = "Часы:"; ws.Cell(row, 2).Value = reportData.ClosedHours; SetRangeStyle(ws.Range(row, 1, row, 1)); ws.Cell(++row, 1).Value = "Название задачи"; ws.Cell(row, 2).Value = "Часы"; SetRangeStyle(ws.Range(row, 1, row, 2), XLAlignmentHorizontalValues.Center); var rngTable = ws.Range(row, 1, row + reportData.Tasks.Length, 2); rngTable.Style.Border.OutsideBorder = XLBorderStyleValues.Thin; rngTable.Style.Border.InsideBorder = XLBorderStyleValues.Thin; ws.Cell(++row, 1).Value = reportData.Tasks.Select(x => new { Name = $"{x.Code} {x.Name}", Hours = double.Parse(x.Hours.ToString(CultureInfo.CurrentCulture)) }) .AsEnumerable(); row += reportData.Tasks.Length; } ws.Columns().AdjustToContents(); await Task.Run(() => wb.SaveAs($"{_reportSettings.ReportSummary.Name} {_reportSettings.ReportSummary.Year}_{_reportSettings.ReportSummary.Month}.xlsx")); }
private void UpdateLegacyTeamBuildSummary(SummaryReportData summaryData) { logger.LogInfo(Resources.Report_UpdatingTeamBuildSummary); using (var summaryLogger = legacyTeamBuildFactory.BuildLegacyBuildSummaryLogger(config.GetTfsUri(), config.GetBuildUri())) { // Add a link to SonarQube dashboard if analysis succeeded if (summaryData.Succeeded) { summaryLogger.WriteMessage(Resources.Report_AnalysisSucceeded, summaryData.ProjectDescription, summaryData.DashboardUrl); } else { summaryLogger.WriteMessage(Resources.Report_AnalysisFailed, summaryData.ProjectDescription); } summaryLogger.WriteMessage(Resources.Report_ProductAndTestMessage, summaryData.ProductProjects, summaryData.TestProjects); summaryLogger.WriteMessage(Resources.Report_InvalidSkippedAndExcludedMessage, summaryData.InvalidProjects, summaryData.SkippedProjects, summaryData.ExcludedProjects); } }
private void GenerateReports() { SummaryReportData summaryData = CreateSummaryData(this.config, this.result); if (this.settings.BuildEnvironment == BuildEnvironment.LegacyTeamBuild && !TeamBuildSettings.SkipLegacyCodeCoverageProcessing) { UpdateLegacyTeamBuildSummary(summaryData); } CreateSummaryMdFile(summaryData); // Write the dashboard link to the output. The sonar-scanner will have written it out earlier, // but writing it again here puts it very close to the end of the output - easier to find, // especially when running from the command line. if (this.result.RanToCompletion) { this.logger.LogInfo(Resources.Report_LinkToDashboard, summaryData.DashboardUrl); } }
private void CreateSummaryMdFile(SummaryReportData summaryData) { logger.LogInfo(Resources.Report_CreatingSummaryMarkdown); Debug.Assert(!string.IsNullOrEmpty(config.SonarOutputDir), "Could not find the output directory"); var summaryMdPath = Path.Combine(config.SonarOutputDir, SummaryMdFilename); using (var sw = new StreamWriter(summaryMdPath, append: false)) { if (summaryData.Succeeded) { sw.WriteLine(Resources.Report_MdSummaryAnalysisSucceeded, summaryData.ProjectDescription, summaryData.DashboardUrl); } else { sw.WriteLine(Resources.Report_MdSummaryAnalysisFailed, summaryData.ProjectDescription); } sw.WriteLine(Resources.Report_MdSummaryProductAndTestMessage, summaryData.ProductProjects, summaryData.TestProjects); sw.WriteLine(Resources.Report_MdSummaryInvalidSkippedAndExcludedMessage, summaryData.InvalidProjects, summaryData.SkippedProjects, summaryData.ExcludedProjects); } }
public async Task <SummaryReportData> GetSummaryReportResults() { /* * The resulting result matrix must have the following format: * [ * [' ','Backlog','Committed','In Progress','Blocked / On Hold','Done'], * ['BDM', '6', '12', '5', '2', '6'], * ['OAS-SIS', '7', '4', '1', '1', '3'], * ['DTS', '1', '1', '0', '3', '1'], * ['CCOE', '2', '6', '3', '2', '1'] * ] * * where the first row contains a non-empty string as the first item and the client titles * then, where the first item of each result set is the client and the remaining are * the tallied number of cards per list in order of Backlog to Done. */ var compiledResults = new List <List <string> >(); var reportResultItems = await this.GetGeneralReportResults(); // Extract the results that have a Client label var applicableResults = reportResultItems .Where(x => x.CardLabels.Where(y => y.Color.Equals(SolutionConstants.TrelloLabelCategory.Client)).Any()) .ToList(); // Compile the count of cards per list by sub-category, where sub-category equals color "Client" // The first-level key is the Client label, the second-level is the Trello list var compiledResultMatrix = new Dictionary <string, Dictionary <string, int> >(); foreach (var result in applicableResults) { var clientKey = this.ExtractClientName(result.CardLabels); // Tally the nbr of cards if (compiledResultMatrix.ContainsKey(clientKey) == false) { compiledResultMatrix.Add(clientKey, new Dictionary <string, int>() { { result.CardCurrentListTitle, 1 } }); } else { if (compiledResultMatrix[clientKey].ContainsKey(result.CardCurrentListTitle) == false) { compiledResultMatrix[clientKey].Add(result.CardCurrentListTitle, 1); } else { compiledResultMatrix[clientKey][result.CardCurrentListTitle]++; } } } // For each client, fetch the total for each Trello list foreach (var client in compiledResultMatrix) { var trelloClientValues = new List <string>(); // Add the first value: client name trelloClientValues.Add(client.Key); // Add the nbr of cards value in explicit list order foreach (var trelloList in SolutionConstants.TrelloListIndexMap.Map) { // Check to see if there's a compiled value for the intended client + trello list, otherwise assign 0. if (compiledResultMatrix[client.Key].ContainsKey(trelloList.Value) == true) { trelloClientValues.Add(compiledResultMatrix[client.Key][trelloList.Value].ToString()); } else { trelloClientValues.Add("0"); } } compiledResults.Add(trelloClientValues); } // Order the clients alphabetically compiledResults = compiledResults.OrderBy(x => x.FirstOrDefault()).ToList(); // Add the first result row. var firstResultSetValues = new List <string>(); firstResultSetValues.Add(" "); firstResultSetValues.Add(SolutionConstants.TrelloLists.Backlog); firstResultSetValues.Add(SolutionConstants.TrelloLists.Committed); firstResultSetValues.Add(SolutionConstants.TrelloLists.InProgress); firstResultSetValues.Add(SolutionConstants.TrelloLists.OnHold); firstResultSetValues.Add(SolutionConstants.TrelloLists.Done); compiledResults.Insert(0, firstResultSetValues); // Gather raw results var reportItemResults = new List <SummaryReportItemResult>(); foreach (var card in applicableResults) { var reportItemResult = new SummaryReportItemResult(); reportItemResult.TaskName = card.CardTitle; reportItemResult.ClientName = this.ExtractClientName(card.CardLabels); reportItemResult.StatusTitle = card.CardCurrentListTitle; reportItemResult.DateStarted = card.CardDateStarted?.ToString(CoreConstants.Formats.DateIso); reportItemResult.DateCompleted = card.CardDateCompleted?.ToString(CoreConstants.Formats.DateIso); reportItemResult.AssignedTo = string.Join(", ", card.CardMembers.Select(x => x.Value).ToList()); reportItemResult.Url = card.CardUrl; reportItemResults.Add(reportItemResult); } // Assign result model values var resultModel = new SummaryReportData(); resultModel.CompiledResults = compiledResults; resultModel.ReportItemResults = reportItemResults; return(resultModel); }
private void UpdateLegacyTeamBuildSummary(SummaryReportData summaryData) { this.logger.LogInfo(Resources.Report_UpdatingTeamBuildSummary); using (BuildSummaryLogger summaryLogger = new BuildSummaryLogger(this.config.GetTfsUri(), this.config.GetBuildUri())) { // Add a link to SonarQube dashboard if analysis succeeded if (summaryData.Succeeded) { summaryLogger.WriteMessage(Resources.Report_AnalysisSucceeded, summaryData.ProjectDescription, summaryData.DashboardUrl); } else { summaryLogger.WriteMessage(Resources.Report_AnalysisFailed, summaryData.ProjectDescription); } summaryLogger.WriteMessage(Resources.Report_ProductAndTestMessage, summaryData.ProductProjects, summaryData.TestProjects); summaryLogger.WriteMessage(Resources.Report_InvalidSkippedAndExcludedMessage, summaryData.InvalidProjects, summaryData.SkippedProjects, summaryData.ExcludedProjects); } }
private void CreateSummaryMdFile(SummaryReportData summaryData) { this.logger.LogInfo(Resources.Report_CreatingSummaryMarkdown); Debug.Assert(!String.IsNullOrEmpty(this.config.SonarOutputDir), "Could not find the output directory"); string summaryMdPath = Path.Combine(this.config.SonarOutputDir, SummaryMdFilename); using (StreamWriter sw = new StreamWriter(summaryMdPath, append: false)) { sw.WriteLine(Resources.Report_MdSummaryTitle); if (summaryData.Succeeded) { sw.WriteLine(Resources.Report_MdSummaryAnalysisSucceeded, summaryData.ProjectDescription, summaryData.DashboardUrl); } else { sw.WriteLine(Resources.Report_MdSummaryAnalysisFailed, summaryData.ProjectDescription); } sw.WriteLine(Resources.Report_MdSummaryProductAndTestMessage, summaryData.ProductProjects, summaryData.TestProjects); sw.WriteLine(Resources.Report_MdSummaryInvalidSkippedAndExcludedMessage, summaryData.InvalidProjects, summaryData.SkippedProjects, summaryData.ExcludedProjects); } }