Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e8fa0b801 | ||
|
|
61e53c3698 | ||
|
|
6f6f7c3424 |
+1
-1
@@ -1 +1 @@
|
||||
1.0.60
|
||||
1.0.63
|
||||
|
||||
@@ -48,9 +48,10 @@ namespace JiraTimeBot.JiraIntegration
|
||||
{
|
||||
var item = new TaskTimeItem(issue.Key.Value,
|
||||
issue.Summary,
|
||||
1,
|
||||
TimeSpan.Zero,
|
||||
issue.Project,
|
||||
issue.Updated.GetValueOrDefault(date.Value),
|
||||
TimeSpan.Zero,
|
||||
1,
|
||||
1,
|
||||
CommitType.Task);
|
||||
workTasks.Add(item);
|
||||
@@ -60,9 +61,10 @@ namespace JiraTimeBot.JiraIntegration
|
||||
{
|
||||
var item = new TaskTimeItem(issue.Key.Value,
|
||||
issue.Summary,
|
||||
1,
|
||||
TimeSpan.Zero,
|
||||
issue.Project,
|
||||
issue.Updated.GetValueOrDefault(date.Value),
|
||||
TimeSpan.Zero,
|
||||
1,
|
||||
1,
|
||||
CommitType.Task);
|
||||
workTasks.Add(item);
|
||||
|
||||
@@ -48,6 +48,8 @@ namespace JiraTimeBot.Mercurial
|
||||
continue;
|
||||
}
|
||||
|
||||
var directoryInfo = new DirectoryInfo(repoDirectory);
|
||||
|
||||
var repo = new Repository(repoDirectory);
|
||||
var logCommand = new LogCommand
|
||||
{
|
||||
@@ -74,9 +76,10 @@ namespace JiraTimeBot.Mercurial
|
||||
|
||||
var task = new TaskTimeItem(changeset.Branch,
|
||||
commitMessage,
|
||||
1,
|
||||
TimeSpan.Zero,
|
||||
directoryInfo.Name,
|
||||
changeset.Timestamp,
|
||||
TimeSpan.Zero,
|
||||
1,
|
||||
changeset.PathActions.Count,
|
||||
GetCommitType(changeset.Branch));
|
||||
|
||||
@@ -91,7 +94,7 @@ namespace JiraTimeBot.Mercurial
|
||||
var release = task.Branch.Replace("release", "");
|
||||
|
||||
task.Branch = branch;
|
||||
task.Description = $"Подготовка и публикация версии {release}.";
|
||||
task.Description = $"Подготовка и публикация версии {task.Project} {release}.";
|
||||
}
|
||||
workTasks.Add(task);
|
||||
_log?.Trace($" - Найден changeset: {changeset.Timestamp} - {changeset.Branch} - {changeset.AuthorEmailAddress} - {commitMessage}");
|
||||
|
||||
@@ -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.60")]
|
||||
[assembly: AssemblyFileVersion("1.0.60")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.60")]
|
||||
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")]
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
namespace JiraTimeBot.TaskTime.Objects
|
||||
using System;
|
||||
|
||||
namespace JiraTimeBot.TaskTime.Objects
|
||||
{
|
||||
[Flags]
|
||||
public enum CommitType {
|
||||
Task = 0,
|
||||
Release = 1
|
||||
Task = 1,
|
||||
Release = 2
|
||||
}
|
||||
}
|
||||
@@ -11,17 +11,27 @@ namespace JiraTimeBot.TaskTime.Objects
|
||||
public int Commits { get; set; }
|
||||
public int FilesAffected { get; set; }
|
||||
public CommitType Type { get; set; }
|
||||
public string Project { get; set; }
|
||||
|
||||
public TaskTimeItem(string branch, string description, int commits, TimeSpan timeSpent, DateTime startTime,
|
||||
int filesAffected, CommitType type)
|
||||
public TaskTimeItem(string branch, string description, string project, DateTime startTime, TimeSpan timeSpent, int commits,
|
||||
int filesAffected = 1, CommitType type = CommitType.Task)
|
||||
{
|
||||
Branch = branch;
|
||||
Description = description;
|
||||
Project = project;
|
||||
Commits = commits;
|
||||
TimeSpent = timeSpent;
|
||||
StartTime = startTime;
|
||||
FilesAffected = filesAffected;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public void MergeWith(TaskTimeItem toMerge)
|
||||
{
|
||||
Commits += toMerge.Commits;
|
||||
TimeSpent += toMerge.TimeSpent;
|
||||
Description += "\r\n" + toMerge.Description;
|
||||
Type |= toMerge.Type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace JiraTimeBot.TaskTime
|
||||
_spreadHelper = spreadHelper;
|
||||
}
|
||||
|
||||
public List<TaskTimeItem> CalculateTaskTime(List<TaskTimeItem> commits, Settings settings, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public List<TaskTimeItem> CalculateTaskTime(List<TaskTimeItem> commits, Settings settings, CancellationToken cancellationToken = default)
|
||||
{
|
||||
int minutesPerWorkDay = settings.MinuterPerWorkDay + GetRandomMinutes(settings);
|
||||
int workHours = (settings.MinuterPerWorkDay / 60);
|
||||
@@ -59,11 +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.MergeWith(workTask);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -95,9 +94,10 @@ namespace JiraTimeBot.TaskTime
|
||||
{
|
||||
return new TaskTimeItem(timeControlTask,
|
||||
"Ведение учета времени",
|
||||
1,
|
||||
TimeSpan.FromMinutes(minutes),
|
||||
"Service",
|
||||
DateTime.Now,
|
||||
TimeSpan.FromMinutes(minutes),
|
||||
1,
|
||||
1,
|
||||
CommitType.Task);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
@@ -43,9 +43,10 @@ namespace JiraTimeBot.TaskTime
|
||||
var taskTimeItem = new TaskTimeItem(
|
||||
taskGroup.Key,
|
||||
sb.ToString(),
|
||||
taskGroup.Sum(f => f.Commits),
|
||||
timeSpent,
|
||||
taskGroup.First().Project,
|
||||
taskGroup.Min(f => f.StartTime),
|
||||
timeSpent,
|
||||
taskGroup.Sum(f => f.Commits),
|
||||
taskGroup.Sum(f => f.FilesAffected),
|
||||
taskGroup.First().Type);
|
||||
|
||||
|
||||
@@ -19,17 +19,17 @@ namespace JiraTimeBot.TasksProcessors
|
||||
_jiraApi = jiraApi;
|
||||
}
|
||||
|
||||
public void Process(DateTime setForDate, DateTime realDate, List<TaskTimeItem> taskTimes, Settings settings, bool dummyMode, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public void Process(DateTime setForDate, DateTime realDate, List<TaskTimeItem> taskTimes, Settings settings, bool dummyMode, CancellationToken cancellationToken = default)
|
||||
{
|
||||
_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);
|
||||
_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)
|
||||
{
|
||||
var sum = release.Sum(f => (int) f.TimeSpent.TotalMinutes);
|
||||
|
||||
Reference in New Issue
Block a user