Exemple #1
0
        private static string CreateHourlyEffortTable(EffortSheet sheet)
        {
            string result = Environment.NewLine;

            result += Environment.NewLine;
            result += "| Aktivität | Projekt | Von | Bis | Aufwand | " + Environment.NewLine;
            result += "| --- | --- | --- | --- | ---: |";

            IReadOnlyList <HourlyEffortGroup> effortGroups        = sheet.GetAllEffortGroups();
            IEnumerable <HourlyEffortGroup>   orderedEffortGroups = effortGroups
                                                                    .OrderBy(x => x.RepositoryName)
                                                                    .ThenBy(x => x.FirstDate)
                                                                    .ToList();

            foreach (var group in orderedEffortGroups)
            {
                result += Environment.NewLine;
                result += $"| [{group.Name}]({group.LinkToDetailedDescription.AbsolutePath}) ";
                result += $"| {group.RepositoryName} ";
                result += $"| {group.FirstDate.ToShortDateString()} ";
                result += $"| {group.LastDate.ToShortDateString()} ";
                result += $"| {group.EffortInHours}h |";
            }

            result += Environment.NewLine;
            result += $"| Summe | |";
            result += $" {sheet.From.ToShortDateString()} | {sheet.To.ToShortDateString()} | {sheet.SumHourlyEffort()}h |";

            return(result);
        }
Exemple #2
0
        private static string CreateSummary(EffortSheet sheet)
        {
            string result = $"Der noch abzurechnende stündliche Aufwand beträgt: **{sheet.SumHourlyEffort()}h**";

            result += Environment.NewLine;
            result += $"Die noch abzurechnende Anzahl an Iterationen beträgt: **{sheet.SumIterations()} Iterationen**";
            return(result);
        }
Exemple #3
0
        public string GetEffortOverviewForUpdate(EffortSheet sheet)
        {
            string result = CreateSheetOverviewInMarkdown(sheet);

            result += Environment.NewLine;
            result += Environment.NewLine;
            result += "Update vom: " + DateTime.Now;

            return(result);
        }
Exemple #4
0
        public NewIssue CreateEffortOverviewForCustomer(EffortSheet sheet)
        {
            string sheetOverviewInMarkdown = CreateSheetOverviewInMarkdown(sheet);

            NewIssue result = new NewIssue(sheet.Name)
            {
                Body = sheetOverviewInMarkdown
            };

            return(result);
        }
Exemple #5
0
        private static string CreateSheetOverviewInMarkdown(EffortSheet sheet)
        {
            string result = CreateSummary(sheet);

            result += Environment.NewLine;

            result += CreateHourlyEffortTable(sheet);

            result += CreateIterationListing(sheet);

            result += Environment.NewLine;
            return(result);
        }
Exemple #6
0
        private static string CreateIterationListing(EffortSheet sheet)
        {
            string result = Environment.NewLine;

            result += Environment.NewLine;
            result += "Iterationen: " + Environment.NewLine;

            IReadOnlyList <Iteration> iterations = sheet.GetAllIterations();

            foreach (var it in iterations)
            {
                result += Environment.NewLine;
                result += " - " + it.ProjectName + " - " + it.Name;

                IReadOnlyList <IterationEntry> itEntries = it.GetAllEntries();
                foreach (var entry in itEntries)
                {
                    result += Environment.NewLine;
                    result += "   - [" + entry.Title + "](" + entry.LinkToDetailedDescription + ")";
                }
            }

            return(result);
        }
        /// <summary>
        /// Erstellt eine neue Aufwandsübersicht mit Einträgen von GitHub
        /// </summary>
        /// <remarks>
        /// Holt alle relevanten, bezogen auf den Aufwand, Issues und deren Kommentare von GitHub
        /// und erstellt daraus eine entsprechende Übersicht.
        /// </remarks>
        /// <param name="name"></param>
        /// <returns></returns>
        public EffortSheet CreateNew(string name)
        {
            EffortSheet sheet = new EffortSheet(name);

            foreach (var issue in issueRepository.GetAllEffortRelatedIssues("Aufwand: ", "suchja"))
            {
                IReadOnlyCollection <IssueComment> comments = issueRepository.GetAllEffortRelatedComments("Aufwand: ", issue);

                HourlyEffortGroup eIssue = new HourlyEffortGroup(issue);
                foreach (var item in comments)
                {
                    HourlyEffortEntry eComment = new HourlyEffortEntry(item);
                    eIssue.AddEffortComment(eComment);
                }

                if (eIssue.EffortInHours > 0.0f)
                {
                    sheet.AddEffortEntry(eIssue);
                }
                // Anzeige, dass dem Anwender klar ist, dass noch etwas passiert.
                Console.Write(".");
            }

            foreach (var issue in issueRepository.GetAllEffortRelatedIssues("Iteration: ", "suchja"))
            {
                IReadOnlyCollection <IssueComment> comments = issueRepository.GetAllEffortRelatedComments("Iteration: ", issue);

                foreach (var item in comments)
                {
                    if (item.Body.StartsWith("Iteration: ") && item.Reactions.Hooray == 0)
                    {
                        // extract owner and repository name
                        string[] repoUrlSegments = new Uri(issue.Url).Segments;
                        string   repoName        = repoUrlSegments[3].TrimEnd('/');

                        // Namen extrahieren
                        string itName;
                        int    itNameEndPosition = item.Body.IndexOf(Environment.NewLine);
                        itName = item.Body.Remove(itNameEndPosition, item.Body.Length - itNameEndPosition);

                        var it = sheet.GetIteration(itName);
                        if (it == null)
                        {
                            it = new Iteration(itName, repoName);
                            it.AddIterationEntry(new IterationEntry(issue));
                            sheet.AddIteration(it);
                        }
                        else
                        {
                            it.AddIterationEntry(new IterationEntry(issue));
                        }

                        // wir brauchen nur einen Kommentar um zu bestätigen, dass dieses Issue
                        // tatsächlich zu einer Iteration gehört.
                        break;
                    }
                }

                // Anzeige, dass dem Anwender klar ist, dass noch etwas passiert.
                Console.Write(".");
            }
            return(sheet);
        }