From d8de5aba1c9d61e5d5eabd738da6c1d993cdafd7 Mon Sep 17 00:00:00 2001 From: Danil Kislov Date: Fri, 13 Sep 2019 10:54:20 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=D0=BC=D0=BD=D0=BE=D0=B3=D0=BE=20?= =?UTF-8?q?=D0=BA=D1=80=D0=B0=D1=81=D0=B8=D0=B2=D0=BE=D1=81=D1=82=D0=B5?= =?UTF-8?q?=D0=B9+=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B2=D1=8B=D0=B1=D0=BE=D1=80=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .semver.txt | 2 +- src/JiraTimeBot/JiraIntegration/JiraApi.cs | 2 +- .../JiraIntegration/JiraHistory.cs | 8 ++- src/JiraTimeBot/Properties/AssemblyInfo.cs | 62 +++++++++---------- .../TasksProcessors/MeetingProcessor.cs | 3 +- 5 files changed, 41 insertions(+), 36 deletions(-) diff --git a/.semver.txt b/.semver.txt index 7f2b140..c8b4742 100644 --- a/.semver.txt +++ b/.semver.txt @@ -1 +1 @@ -1.0.66 +1.0.67 diff --git a/src/JiraTimeBot/JiraIntegration/JiraApi.cs b/src/JiraTimeBot/JiraIntegration/JiraApi.cs index e279e1f..fdb4c40 100644 --- a/src/JiraTimeBot/JiraIntegration/JiraApi.cs +++ b/src/JiraTimeBot/JiraIntegration/JiraApi.cs @@ -85,7 +85,7 @@ namespace JiraTimeBot.JiraIntegration { var workLogs = issue.GetWorklogsAsync(cancellationToken).Result; var userWorklogs = workLogs.Where(w => - w.CreateDate.GetValueOrDefault().Date == date && w.Author.Equals(settings.JiraUserName, + w.StartDate.GetValueOrDefault().Date == date && w.Author.Equals(settings.JiraUserName, StringComparison.InvariantCultureIgnoreCase)).ToList(); foreach (var userWorklog in userWorklogs) { diff --git a/src/JiraTimeBot/JiraIntegration/JiraHistory.cs b/src/JiraTimeBot/JiraIntegration/JiraHistory.cs index 4b73a0a..fe3a3f4 100644 --- a/src/JiraTimeBot/JiraIntegration/JiraHistory.cs +++ b/src/JiraTimeBot/JiraIntegration/JiraHistory.cs @@ -29,7 +29,7 @@ namespace JiraTimeBot.JiraIntegration Settings settings, CancellationToken cancellationToken = default(CancellationToken)) { - var tasks = _jiraApi.GetIssuesByJQL("status changed by '%USER%' during (\"%DATE%\",\"%DATE%\")", settings, date, cancellationToken); + var tasks = _jiraApi.GetIssuesByJQL("worklogDate = \"%DATE%\" and worklogAuthor='%USER%'", settings, date, cancellationToken); List resultItems = new List(); foreach (var issue in tasks) { @@ -37,7 +37,7 @@ namespace JiraTimeBot.JiraIntegration var user = settings.JiraUserName; //user = "Zoya.Aleksandridi"; var userWorklogs = workLogs.Where(w => - w.CreateDate.GetValueOrDefault().Date == date && w.Author.Equals(user, + w.StartDate.GetValueOrDefault().Date == date && w.Author.Equals(user, StringComparison.InvariantCultureIgnoreCase)).ToList(); if (!userWorklogs.Any()) { @@ -50,6 +50,10 @@ namespace JiraTimeBot.JiraIntegration var totalTime = TimeSpan.FromSeconds(userWorklogs.Sum(f => f.TimeSpentInSeconds)); var startDate = firstWorklog?.CreateDate ?? date; var commits = userWorklogs.Sum(f => f.Comment.Count(c => c == '\n')); + if (commits == 0) + { + commits = 1; + } var taskType = CommitType.Task; if (description.Contains("Подготовка и публикация")) { diff --git a/src/JiraTimeBot/Properties/AssemblyInfo.cs b/src/JiraTimeBot/Properties/AssemblyInfo.cs index 79a6a65..6252520 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.66")] -[assembly: AssemblyFileVersion("1.0.66")] -[assembly: AssemblyInformationalVersion("1.0.66")] +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.67")] +[assembly: AssemblyFileVersion("1.0.67")] +[assembly: AssemblyInformationalVersion("1.0.67")] diff --git a/src/JiraTimeBot/TasksProcessors/MeetingProcessor.cs b/src/JiraTimeBot/TasksProcessors/MeetingProcessor.cs index 06470b8..5b6766b 100644 --- a/src/JiraTimeBot/TasksProcessors/MeetingProcessor.cs +++ b/src/JiraTimeBot/TasksProcessors/MeetingProcessor.cs @@ -21,7 +21,8 @@ namespace JiraTimeBot.TasksProcessors public void Process(DateTime setForDate, DateTime realDate, List taskTimes, Settings settings, bool dummyMode, CancellationToken cancellationToken = default(CancellationToken)) { - _log.Trace($"На реальную дату {realDate:dd.MM.yyyy} распределение по задачам:"); + var totalTime = TimeSpan.FromSeconds(taskTimes.Sum(f => f.TimeSpent.TotalSeconds)); + _log.Trace($"На реальную дату {realDate:dd.MM.yyyy} распределение по задачам ({totalTime:hh':'mm':'ss}):"); foreach (var taskTime in taskTimes.Where(f=>f.Type.HasFlag(CommitType.Task)).OrderByDescending(f => f.TimeSpent)) {