From 4e8fa0b8015747733a2a747f5b68492354d5c7fb Mon Sep 17 00:00:00 2001 From: Danil Kislov Date: Fri, 13 Sep 2019 09:36:38 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BC=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BD=D0=B5=D1=82=D0=BE=D1=87=D0=BD=D0=BE=D1=81=D1=82=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .semver.txt | 2 +- src/JiraTimeBot/Properties/AssemblyInfo.cs | 62 +++++++++---------- .../TaskTime/Objects/TaskTimeItem.cs | 8 +++ .../TaskTime/TaskTimeByCommitsCalculator.cs | 8 +-- src/JiraTimeBot/TaskTime/TaskTimeSpread.cs | 2 +- .../TasksProcessors/MeetingProcessor.cs | 2 +- 6 files changed, 45 insertions(+), 39 deletions(-) diff --git a/.semver.txt b/.semver.txt index 7eeb2c7..32c4ece 100644 --- a/.semver.txt +++ b/.semver.txt @@ -1 +1 @@ -1.0.62 +1.0.63 diff --git a/src/JiraTimeBot/Properties/AssemblyInfo.cs b/src/JiraTimeBot/Properties/AssemblyInfo.cs index 5d11983..3a11b75 100644 --- a/src/JiraTimeBot/Properties/AssemblyInfo.cs +++ b/src/JiraTimeBot/Properties/AssemblyInfo.cs @@ -1,31 +1,31 @@ -using System.Reflection; -using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("JiraTimeBot")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("JiraTimeBot")] -[assembly: AssemblyCopyright("Copyright © 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("f3b89316-c38c-4ce6-9d88-0b1373cfba1a")] -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.62")] -[assembly: AssemblyFileVersion("1.0.62")] -[assembly: AssemblyInformationalVersion("1.0.62")] +using System.Reflection; +using System.Runtime.InteropServices; +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("JiraTimeBot")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("JiraTimeBot")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f3b89316-c38c-4ce6-9d88-0b1373cfba1a")] +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.63")] +[assembly: AssemblyFileVersion("1.0.63")] +[assembly: AssemblyInformationalVersion("1.0.63")] diff --git a/src/JiraTimeBot/TaskTime/Objects/TaskTimeItem.cs b/src/JiraTimeBot/TaskTime/Objects/TaskTimeItem.cs index 88c960d..75e6035 100644 --- a/src/JiraTimeBot/TaskTime/Objects/TaskTimeItem.cs +++ b/src/JiraTimeBot/TaskTime/Objects/TaskTimeItem.cs @@ -25,5 +25,13 @@ namespace JiraTimeBot.TaskTime.Objects FilesAffected = filesAffected; Type = type; } + + public void MergeWith(TaskTimeItem toMerge) + { + Commits += toMerge.Commits; + TimeSpent += toMerge.TimeSpent; + Description += "\r\n" + toMerge.Description; + Type |= toMerge.Type; + } } } diff --git a/src/JiraTimeBot/TaskTime/TaskTimeByCommitsCalculator.cs b/src/JiraTimeBot/TaskTime/TaskTimeByCommitsCalculator.cs index cefaf68..7e1d4a7 100644 --- a/src/JiraTimeBot/TaskTime/TaskTimeByCommitsCalculator.cs +++ b/src/JiraTimeBot/TaskTime/TaskTimeByCommitsCalculator.cs @@ -20,7 +20,7 @@ namespace JiraTimeBot.TaskTime _spreadHelper = spreadHelper; } - public List CalculateTaskTime(List commits, Settings settings, CancellationToken cancellationToken = default(CancellationToken)) + public List CalculateTaskTime(List commits, Settings settings, CancellationToken cancellationToken = default) { int minutesPerWorkDay = settings.MinuterPerWorkDay + GetRandomMinutes(settings); int workHours = (settings.MinuterPerWorkDay / 60); @@ -59,12 +59,10 @@ namespace JiraTimeBot.TaskTime var workTasks = _spreadHelper.SpreadTime(taskCommits, remainMinutes, settings.RoundToMinutes); foreach (var workTask in workTasks) { - var existingItem = workTimeItems.FirstOrDefault(f => f.Branch == workTask.Branch); + TaskTimeItem existingItem = workTimeItems.FirstOrDefault(f => f.Branch == workTask.Branch); if (existingItem != null) { - existingItem.TimeSpent += workTask.TimeSpent; - existingItem.Description += "\r\n" + workTask.Description; - existingItem.Type |= CommitType.Task; + existingItem.MergeWith(workTask); continue; } diff --git a/src/JiraTimeBot/TaskTime/TaskTimeSpread.cs b/src/JiraTimeBot/TaskTime/TaskTimeSpread.cs index d1b762f..11235bf 100644 --- a/src/JiraTimeBot/TaskTime/TaskTimeSpread.cs +++ b/src/JiraTimeBot/TaskTime/TaskTimeSpread.cs @@ -26,7 +26,7 @@ namespace JiraTimeBot.TaskTime { int currentTaskCommits = taskGroup.Count(); int currentTaskTime = (int)RoundTo(minutes / source.Count * currentTaskCommits, roundToMinutes, roundUp); - remainMinutes = remainMinutes - currentTaskTime; + remainMinutes -= currentTaskTime; var orderedTasks = taskGroup.OrderBy(f => f.StartTime).ToArray(); StringBuilder sb = new StringBuilder(); diff --git a/src/JiraTimeBot/TasksProcessors/MeetingProcessor.cs b/src/JiraTimeBot/TasksProcessors/MeetingProcessor.cs index 06470b8..12cb48f 100644 --- a/src/JiraTimeBot/TasksProcessors/MeetingProcessor.cs +++ b/src/JiraTimeBot/TasksProcessors/MeetingProcessor.cs @@ -19,7 +19,7 @@ namespace JiraTimeBot.TasksProcessors _jiraApi = jiraApi; } - public void Process(DateTime setForDate, DateTime realDate, List taskTimes, Settings settings, bool dummyMode, CancellationToken cancellationToken = default(CancellationToken)) + public void Process(DateTime setForDate, DateTime realDate, List taskTimes, Settings settings, bool dummyMode, CancellationToken cancellationToken = default) { _log.Trace($"На реальную дату {realDate:dd.MM.yyyy} распределение по задачам:");