Compare commits

...
3 Commits
7 changed files with 51 additions and 41 deletions
+1 -1
View File
@@ -1 +1 @@
1.0.61 1.0.64
+31 -31
View File
@@ -1,31 +1,31 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("JiraTimeBot")] [assembly: AssemblyTitle("JiraTimeBot")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JiraTimeBot")] [assembly: AssemblyProduct("JiraTimeBot")]
[assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // 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 // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f3b89316-c38c-4ce6-9d88-0b1373cfba1a")] [assembly: Guid("f3b89316-c38c-4ce6-9d88-0b1373cfba1a")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.61")] [assembly: AssemblyVersion("1.0.64")]
[assembly: AssemblyFileVersion("1.0.61")] [assembly: AssemblyFileVersion("1.0.64")]
[assembly: AssemblyInformationalVersion("1.0.61")] [assembly: AssemblyInformationalVersion("1.0.64")]
@@ -1,7 +1,10 @@
namespace JiraTimeBot.TaskTime.Objects using System;
namespace JiraTimeBot.TaskTime.Objects
{ {
[Flags]
public enum CommitType { public enum CommitType {
Task = 0, Task = 1,
Release = 1 Release = 2
} }
} }
@@ -25,5 +25,13 @@ namespace JiraTimeBot.TaskTime.Objects
FilesAffected = filesAffected; FilesAffected = filesAffected;
Type = type; Type = type;
} }
public void MergeWith(TaskTimeItem toMerge)
{
Commits += toMerge.Commits;
TimeSpent += toMerge.TimeSpent;
Description += "\r\n" + toMerge.Description;
Type |= toMerge.Type;
}
} }
} }
@@ -59,11 +59,10 @@ namespace JiraTimeBot.TaskTime
var workTasks = _spreadHelper.SpreadTime(taskCommits, remainMinutes, settings.RoundToMinutes); var workTasks = _spreadHelper.SpreadTime(taskCommits, remainMinutes, settings.RoundToMinutes);
foreach (var workTask in workTasks) 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) if (existingItem != null)
{ {
existingItem.TimeSpent += workTask.TimeSpent; existingItem.MergeWith(workTask);
existingItem.Description += "\r\n" + workTask.Description;
continue; continue;
} }
+1 -1
View File
@@ -26,7 +26,7 @@ namespace JiraTimeBot.TaskTime
{ {
int currentTaskCommits = taskGroup.Count(); int currentTaskCommits = taskGroup.Count();
int currentTaskTime = (int)RoundTo(minutes / source.Count * currentTaskCommits, roundToMinutes, roundUp); int currentTaskTime = (int)RoundTo(minutes / source.Count * currentTaskCommits, roundToMinutes, roundUp);
remainMinutes = remainMinutes - currentTaskTime; remainMinutes -= currentTaskTime;
var orderedTasks = taskGroup.OrderBy(f => f.StartTime).ToArray(); var orderedTasks = taskGroup.OrderBy(f => f.StartTime).ToArray();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@@ -23,13 +23,13 @@ namespace JiraTimeBot.TasksProcessors
{ {
_log.Trace($"На реальную дату {realDate:dd.MM.yyyy} распределение по задачам:"); _log.Trace($"На реальную дату {realDate:dd.MM.yyyy} распределение по задачам:");
foreach (var taskTime in taskTimes.Where(f=>f.Type == CommitType.Task).OrderByDescending(f => f.TimeSpent)) foreach (var taskTime in taskTimes.Where(f=>f.Type.HasFlag(CommitType.Task)).OrderByDescending(f => f.TimeSpent))
{ {
var taskName = _jiraApi.GetTaskName(taskTime.Branch, settings); var taskName = _jiraApi.GetTaskName(taskTime.Branch, settings);
_log.Trace($" - [{taskTime.Branch}, коммитов {taskTime.Commits}]: {taskName} - {taskTime.TimeSpent}"); _log.Trace($" - [{taskTime.Branch}, коммитов {taskTime.Commits}]: {taskName} - {taskTime.TimeSpent}");
} }
var releases = taskTimes.Where(f => f.Type == CommitType.Release).GroupBy(f=>f.Description); var releases = taskTimes.Where(f => f.Type.HasFlag(CommitType.Release)).GroupBy(f=>f.Description);
foreach (var release in releases) foreach (var release in releases)
{ {
var sum = release.Sum(f => (int) f.TimeSpent.TotalMinutes); var sum = release.Sum(f => (int) f.TimeSpent.TotalMinutes);