Compare commits

..
3 Commits
10 changed files with 115 additions and 88 deletions
+1 -1
View File
@@ -1 +1 @@
1.0.57
1.0.60
+2 -2
View File
@@ -107,9 +107,9 @@ namespace JiraTimeBot.JiraIntegration
{
issue = jira.Issues.Queryable.FirstOrDefault(f => f.Key == taskTimeItem.Branch);
}
catch (Exception)
catch (Exception ex)
{
_log.Error($"Ошибка получения задачи из JIRA: {ex.Message} - {ex.InnerException?.Message}");
}
if (issue == null)
{
@@ -46,28 +46,26 @@ namespace JiraTimeBot.JiraIntegration
{
foreach (var comment in userComments.OrderBy(f=>f.CreatedDate))
{
workTasks.Add(new TaskTimeItem
{
StartTime = issue.Updated.GetValueOrDefault(date.Value),
Description = issue.Summary,
Branch = issue.Key.Value,
FilesAffected = 1,
Commits = 1,
Type = CommitType.Task
});
var item = new TaskTimeItem(issue.Key.Value,
issue.Summary,
1,
TimeSpan.Zero,
issue.Updated.GetValueOrDefault(date.Value),
1,
CommitType.Task);
workTasks.Add(item);
}
}
else
{
workTasks.Add(new TaskTimeItem
{
StartTime = issue.Updated.GetValueOrDefault(date.Value),
Description = issue.Summary,
Branch = issue.Key.Value,
FilesAffected = 1,
Commits = 1,
Type = CommitType.Task
});
var item = new TaskTimeItem(issue.Key.Value,
issue.Summary,
1,
TimeSpan.Zero,
issue.Updated.GetValueOrDefault(date.Value),
1,
CommitType.Task);
workTasks.Add(item);
}
}
+1
View File
@@ -92,6 +92,7 @@
<Compile Include="Mercurial\IMercurialLog.cs" />
<Compile Include="Mercurial\Modifiers\TechnicalInfoSkipper.cs" />
<Compile Include="TasksProcessors\IAllTasksProcessors.cs" />
<Compile Include="TaskTime\Objects\CommitType.cs" />
<Compile Include="TaskTime\TaskTimeSpread.cs" />
<Compile Include="UI\frmMain.cs">
<SubType>Form</SubType>
+13 -11
View File
@@ -72,20 +72,22 @@ namespace JiraTimeBot.Mercurial
}
commitMessage = _technicalInfoSkipper.StripTechnicalInfo(commitMessage);
var task = new TaskTimeItem
{
StartTime = changeset.Timestamp,
Description = commitMessage,
Branch = changeset.Branch,
FilesAffected = changeset.PathActions.Count,
Commits = 1,
TimeSpent = TimeSpan.Zero,
Type = GetCommitType(changeset.Branch)
};
var task = new TaskTimeItem(changeset.Branch,
commitMessage,
1,
TimeSpan.Zero,
changeset.Timestamp,
changeset.PathActions.Count,
GetCommitType(changeset.Branch));
if (task.Type == CommitType.Release && task.Description.StartsWith("Merge with", StringComparison.CurrentCultureIgnoreCase))
{
var branch = task.Description.Replace("Merge with", "").Replace(" ", "");
var description = task.Description;
if (description.Contains("\n"))
{
description = description.Split('\n')[0];
}
var branch = description.Replace("Merge with", "").Replace(" ", "");
var release = task.Branch.Replace("release", "");
task.Branch = branch;
+3 -3
View File
@@ -26,6 +26,6 @@ using System.Runtime.InteropServices;
//
// 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.57")]
[assembly: AssemblyFileVersion("1.0.57")]
[assembly: AssemblyInformationalVersion("1.0.57")]
[assembly: AssemblyVersion("1.0.60")]
[assembly: AssemblyFileVersion("1.0.60")]
[assembly: AssemblyInformationalVersion("1.0.60")]
@@ -0,0 +1,7 @@
namespace JiraTimeBot.TaskTime.Objects
{
public enum CommitType {
Task = 0,
Release = 1
}
}
@@ -11,10 +11,17 @@ namespace JiraTimeBot.TaskTime.Objects
public int Commits { get; set; }
public int FilesAffected { get; set; }
public CommitType Type { get; set; }
}
public enum CommitType {
Task = 0,
Release = 1
public TaskTimeItem(string branch, string description, int commits, TimeSpan timeSpent, DateTime startTime,
int filesAffected, CommitType type)
{
Branch = branch;
Description = description;
Commits = commits;
TimeSpent = timeSpent;
StartTime = startTime;
FilesAffected = filesAffected;
Type = type;
}
}
}
@@ -57,7 +57,18 @@ namespace JiraTimeBot.TaskTime
}
var workTasks = _spreadHelper.SpreadTime(taskCommits, remainMinutes, settings.RoundToMinutes);
workTimeItems.AddRange(workTasks);
foreach (var workTask in workTasks)
{
var existingItem = workTimeItems.FirstOrDefault(f => f.Branch == workTask.Branch);
if (existingItem != null)
{
existingItem.TimeSpent += workTask.TimeSpent;
existingItem.Description += "\r\n" + workTask.Description;
continue;
}
workTimeItems.Add(workTask);
}
workTimeItems = workTimeItems.OrderByDescending(f => f.TimeSpent).ToList();
remainMinutes = minutesPerWorkDay - (int) workTimeItems.Sum(f => f.TimeSpent.TotalMinutes);
@@ -82,13 +93,13 @@ namespace JiraTimeBot.TaskTime
//Если указана задача контроля времени - то спишем туда 30 минут и вычеркнем их из общего рабочего времени.
if (!string.IsNullOrEmpty(timeControlTask))
{
return new TaskTimeItem
{
TimeSpent = TimeSpan.FromMinutes(minutes),
Branch = timeControlTask,
Commits = 1,
Description = "Ведение учета времени"
};
return new TaskTimeItem(timeControlTask,
"Ведение учета времени",
1,
TimeSpan.FromMinutes(minutes),
DateTime.Now,
1,
CommitType.Task);
}
return null;
+13 -12
View File
@@ -34,19 +34,20 @@ namespace JiraTimeBot.TaskTime
{
sb.AppendLine($"- {task.Description}");
}
var taskTimeItem = new TaskTimeItem
{
Branch = taskGroup.Key,
TimeSpent = appendTime ?
TimeSpan.FromMinutes(taskGroup.Sum(f=>f.TimeSpent.TotalMinutes)) + TimeSpan.FromMinutes(currentTaskTime):
var timeSpent = appendTime
? TimeSpan.FromMinutes(taskGroup.Sum(f => f.TimeSpent.TotalMinutes)) +
TimeSpan.FromMinutes(currentTaskTime)
,
Commits = taskGroup.Sum(f=>f.Commits),
Description = sb.ToString(),
StartTime = taskGroup.Min(f=>f.StartTime),
FilesAffected = taskGroup.Sum(f=>f.FilesAffected),
Type = taskGroup.First().Type
};
: TimeSpan.FromMinutes(currentTaskTime);
var taskTimeItem = new TaskTimeItem(
taskGroup.Key,
sb.ToString(),
taskGroup.Sum(f => f.Commits),
timeSpent,
taskGroup.Min(f => f.StartTime),
taskGroup.Sum(f => f.FilesAffected),
taskGroup.First().Type);
newList.Add(taskTimeItem);
}