Пример #1
0
 private static void ReportTableRow(
     StreamWriter file,
     string prefix,
     TableReport.Row row,
     bool shouldHyperLink,
     bool useRepositoriesFromIssues = true,
     bool makeCountBold             = true)
 {
     ReportTableRow(file,
                    "  ",
                    $"<b title=\"{row.Query.ToString()}\">{row.Name}</b>" +
                    (row.Team == null ? "" : $" - <small>{row.Team.Name}</small>"),
                    row.Columns.SelectMany(filteredIssues =>
     {
         string count = HtmlQueryCountLink.Create(
             filteredIssues.Query,
             filteredIssues.End,
             shouldHyperLink,
             useRepositoriesFromIssues);
         return(new string[] {
             makeCountBold ? $"<b>{count}</b>" : count,
             $"<i>{(filteredIssues.End.Count() - filteredIssues.Begin.Count()).ToString("+#;-#;0")}</i>",
             $"<i>+{filteredIssues.EndOrMiddleOnly.Count()}</i>",
             $"<i>-{filteredIssues.BeginOrMiddleOnly.Count()}</i>"
         });
     }));
 }
Пример #2
0
        private void Report(
            StreamWriter file,
            IEnumerable <TableReport.Row> rows,
            bool shouldHyperLink = true)
        {
            // Heading row
            {
                file.WriteLine("<table border=\"1\">");
                ReportTableRow(file, "  ",
                               "&nbsp;",
                               _report.Columns.SelectMany(col => new string[] {
                    $"<b title=\"{col.Query.ToString()}\">{col.Name}</b>",
                    "<i>(diff)</i>",
                    "<i>(new)</i>",
                    "<i>(gone)</i>"
                }));
            }

            // All "middle" rows
            {
                foreach (TableReport.Row row in rows)
                {
                    ReportTableRow(file, "  ", row, shouldHyperLink, useRepositoriesFromIssues: true, makeCountBold: false);
                }
            }

            // "Other (missing above)" row
            {
                Expression      otherRowQuery = Expression.And(rows.Select(row => Expression.Not(row.Query)).ToArray());
                TableReport.Row otherRow      = new TableReport.Row(
                    "Other (missing above)",
                    otherRowQuery,
                    null,
                    _report.Columns,
                    _report.BeginIssues,
                    _report.MiddleIssues,
                    _report.EndIssues);

                ReportTableRow(file, "  ", otherRow, shouldHyperLink, useRepositoriesFromIssues: false, makeCountBold: true);
            }

            // "Total" row
            {
                TableReport.Row totalRow = new TableReport.Row(
                    "Total",
                    ExpressionConstant.True,
                    null,
                    _report.Columns,
                    _report.BeginIssues,
                    _report.MiddleIssues,
                    _report.EndIssues);

                ReportTableRow(file, "  ", totalRow, shouldHyperLink, useRepositoriesFromIssues: false, makeCountBold: true);
            }

            file.WriteLine("</table>");
        }
Пример #3
0
        private void Report(
            string csvFileName,
            IEnumerable <TableReport.Row> rows)
        {
            using (CsvWriter file = new CsvWriter(csvFileName))
            {
                // Prepare last row - "Other (missing above)"
                Expression      otherRowQuery = Expression.And(rows.Select(row => Expression.Not(row.Query)).ToArray());
                TableReport.Row otherRow      = new TableReport.Row(
                    "Other (missing above)",
                    otherRowQuery,
                    null,
                    _report.Columns,
                    _report.BeginIssues,
                    _report.MiddleIssues,
                    _report.EndIssues);

                TableReport.Row totalRow = new TableReport.Row(
                    "Total",
                    ExpressionConstant.True,
                    null,
                    _report.Columns,
                    _report.BeginIssues,
                    _report.MiddleIssues,
                    _report.EndIssues);

                // Write heading row
                file.Write(_reportName ?? "");
                file.WriteLine(_report.Columns.SelectMany(col => new string[] { col.Name, "new", "gone" }));

                // Write all "middle" rows and last row
                foreach (TableReport.Row row in rows.Concat(new TableReport.Row[] { otherRow, totalRow }))
                {
                    file.Write(row.Name);
                    file.WriteLine(row.Columns.SelectMany(filteredIssues => new string[] {
                        filteredIssues.End.Count().ToString(),
                        filteredIssues.EndOrMiddleOnly.Count().ToString(),
                        filteredIssues.BeginOrMiddleOnly.Count().ToString()
                    }));
                }
            }
        }