From a95c19fe68be87ea650c0af321ec8fa8ed1e358c Mon Sep 17 00:00:00 2001 From: Danil Kislov Date: Wed, 10 Apr 2019 12:10:02 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D1=8F?= =?UTF-8?q?=D0=B5=D0=BC=20=D0=BE=D0=BF=D0=B8=D1=81=D0=B0=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=20=D0=B5=D1=81=D0=BB=D0=B8=20=D0=BE=D0=BD=D0=BE=20=D0=BE=D1=82?= =?UTF-8?q?=D0=BB=D0=B8=D1=87=D0=B0=D0=B5=D1=82=D1=81=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .semver.txt | 2 +- src/JiraTimeBot/JiraIntegration/JiraApi.cs | 11 ++-- src/JiraTimeBot/Properties/AssemblyInfo.cs | 62 +++++++++++----------- 3 files changed, 39 insertions(+), 36 deletions(-) diff --git a/.semver.txt b/.semver.txt index 7cb055c..4ad595c 100644 --- a/.semver.txt +++ b/.semver.txt @@ -1 +1 @@ -1.0.41 +1.0.42 diff --git a/src/JiraTimeBot/JiraIntegration/JiraApi.cs b/src/JiraTimeBot/JiraIntegration/JiraApi.cs index 49fefc3..89f71fa 100644 --- a/src/JiraTimeBot/JiraIntegration/JiraApi.cs +++ b/src/JiraTimeBot/JiraIntegration/JiraApi.cs @@ -123,21 +123,26 @@ namespace JiraTimeBot.JiraIntegration var userWorklogs = workLogs.Where(w => w.StartDate.GetValueOrDefault().Date == date && w.Author.Equals(settings.JiraUserName, StringComparison.InvariantCultureIgnoreCase)).ToList(); + var comment = _descriptionSource.GetDescription(taskTimeItem, addCommentsToWorklog, settings); foreach (var workLog in userWorklogs) { var timeSpent = TimeSpan.FromSeconds(workLog.TimeSpentInSeconds); var timeDiff = Math.Abs((timeSpent - taskTimeItem.Time).TotalMinutes); - if (timeDiff > 1 || userWorklogs.Count > 1) + if (timeDiff > 1 || userWorklogs.Count > 1 || userWorklogs.First().Comment != comment) { if (timeDiff > 1) { _log.Trace($"Время отличается на {timeDiff} минут, удаляю worklog: {taskTimeItem.Branch} {workLog.Author} {workLog.CreateDate}: {workLog.TimeSpent}"); } - else + else if (userWorklogs.Count > 1) { _log.Trace($"Найдено более одного ворклога на задачу, удаляю worklog: {taskTimeItem.Branch} {workLog.Author} {workLog.CreateDate}: {workLog.TimeSpent}"); } + else + { + _log.Trace($"Описание отличается, удаляю worklog: {taskTimeItem.Branch} {workLog.Author} {workLog.CreateDate}: {workLog.TimeSpent}"); + } if (!dummy) { issue.DeleteWorklogAsync(workLog, token: cancellationToken); @@ -155,8 +160,6 @@ namespace JiraTimeBot.JiraIntegration { var timeSpentJira = $"{taskTimeItem.Time.TotalMinutes}m"; - var comment = _descriptionSource.GetDescription(taskTimeItem, addCommentsToWorklog, settings); - Worklog workLogToAdd = new Worklog(timeSpentJira, date.Value, comment); if (!dummy) { diff --git a/src/JiraTimeBot/Properties/AssemblyInfo.cs b/src/JiraTimeBot/Properties/AssemblyInfo.cs index b5ce5eb..3581eaa 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.41")] -[assembly: AssemblyFileVersion("1.0.41")] -[assembly: AssemblyInformationalVersion("1.0.41")] +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.42")] +[assembly: AssemblyFileVersion("1.0.42")] +[assembly: AssemblyInformationalVersion("1.0.42")]