Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84ef070eb6 | ||
|
|
448a6ddb57 | ||
|
|
a95c19fe68 | ||
|
|
e0c610399e |
+1
-1
@@ -1 +1 @@
|
|||||||
1.0.40
|
1.0.44
|
||||||
|
|||||||
@@ -123,25 +123,38 @@ namespace JiraTimeBot.JiraIntegration
|
|||||||
var userWorklogs = workLogs.Where(w =>
|
var userWorklogs = workLogs.Where(w =>
|
||||||
w.StartDate.GetValueOrDefault().Date == date && w.Author.Equals(settings.JiraUserName,
|
w.StartDate.GetValueOrDefault().Date == date && w.Author.Equals(settings.JiraUserName,
|
||||||
StringComparison.InvariantCultureIgnoreCase)).ToList();
|
StringComparison.InvariantCultureIgnoreCase)).ToList();
|
||||||
|
var comment = _descriptionSource.GetDescription(taskTimeItem, addCommentsToWorklog, settings);
|
||||||
|
|
||||||
foreach (var workLog in userWorklogs)
|
foreach (var workLog in userWorklogs)
|
||||||
{
|
{
|
||||||
var timeSpent = TimeSpan.FromSeconds(workLog.TimeSpentInSeconds);
|
var timeSpent = TimeSpan.FromSeconds(workLog.TimeSpentInSeconds);
|
||||||
var timeDiff = Math.Abs((timeSpent - taskTimeItem.Time).TotalMinutes);
|
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)
|
if (timeDiff > 1)
|
||||||
{
|
{
|
||||||
_log.Trace($"Время отличается на {timeDiff} минут, удаляю worklog: {taskTimeItem.Branch} {workLog.Author} {workLog.CreateDate}: {workLog.TimeSpent}");
|
_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}");
|
_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)
|
if (!dummy)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
issue.DeleteWorklogAsync(workLog, token: cancellationToken);
|
issue.DeleteWorklogAsync(workLog, token: cancellationToken);
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_log.Error($"Не могу удалить Worklog по задаче {taskTimeItem.Branch}: {ex.Message}.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
hasTodayWorklog = false;
|
hasTodayWorklog = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -155,13 +168,19 @@ namespace JiraTimeBot.JiraIntegration
|
|||||||
{
|
{
|
||||||
var timeSpentJira = $"{taskTimeItem.Time.TotalMinutes}m";
|
var timeSpentJira = $"{taskTimeItem.Time.TotalMinutes}m";
|
||||||
|
|
||||||
var comment = _descriptionSource.GetDescription(taskTimeItem, addCommentsToWorklog, settings);
|
|
||||||
|
|
||||||
Worklog workLogToAdd = new Worklog(timeSpentJira, date.Value, comment);
|
Worklog workLogToAdd = new Worklog(timeSpentJira, date.Value, comment);
|
||||||
if (!dummy)
|
if (!dummy)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
workLogToAdd = issue.AddWorklogAsync(workLogToAdd, token: cancellationToken).Result;
|
workLogToAdd = issue.AddWorklogAsync(workLogToAdd, token: cancellationToken).Result;
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_log.Error($"Не могу добавить Worklog по задаче {taskTimeItem.Branch}: {ex.Message}.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
_log.Trace($"Добавили Worklog для {taskTimeItem.Branch}: {workLogToAdd.Author} {workLogToAdd.CreateDate}: {workLogToAdd.TimeSpent}");
|
_log.Trace($"Добавили Worklog для {taskTimeItem.Branch}: {workLogToAdd.Author} {workLogToAdd.CreateDate}: {workLogToAdd.TimeSpent}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,6 @@ using System.Runtime.InteropServices;
|
|||||||
//
|
//
|
||||||
// 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.40")]
|
[assembly: AssemblyVersion("1.0.44")]
|
||||||
[assembly: AssemblyFileVersion("1.0.40")]
|
[assembly: AssemblyFileVersion("1.0.44")]
|
||||||
[assembly: AssemblyInformationalVersion("1.0.40")]
|
[assembly: AssemblyInformationalVersion("1.0.44")]
|
||||||
|
|||||||
Generated
+18
-13
@@ -34,6 +34,7 @@
|
|||||||
this.tmrStart = new System.Windows.Forms.Timer(this.components);
|
this.tmrStart = new System.Windows.Forms.Timer(this.components);
|
||||||
this.tmrUpdate = new System.Windows.Forms.Timer(this.components);
|
this.tmrUpdate = new System.Windows.Forms.Timer(this.components);
|
||||||
this.tlpControls = new System.Windows.Forms.TableLayoutPanel();
|
this.tlpControls = new System.Windows.Forms.TableLayoutPanel();
|
||||||
|
this.txtLog = new System.Windows.Forms.TextBox();
|
||||||
this.panel2 = new System.Windows.Forms.Panel();
|
this.panel2 = new System.Windows.Forms.Panel();
|
||||||
this.btnCancel = new System.Windows.Forms.Button();
|
this.btnCancel = new System.Windows.Forms.Button();
|
||||||
this.btnMeeting = new System.Windows.Forms.Button();
|
this.btnMeeting = new System.Windows.Forms.Button();
|
||||||
@@ -43,7 +44,6 @@
|
|||||||
this.btnDoForDate = new System.Windows.Forms.Button();
|
this.btnDoForDate = new System.Windows.Forms.Button();
|
||||||
this.dteForDay = new System.Windows.Forms.DateTimePicker();
|
this.dteForDay = new System.Windows.Forms.DateTimePicker();
|
||||||
this.btnSettings = new System.Windows.Forms.Button();
|
this.btnSettings = new System.Windows.Forms.Button();
|
||||||
this.txtLog = new System.Windows.Forms.TextBox();
|
|
||||||
this.tlpControls.SuspendLayout();
|
this.tlpControls.SuspendLayout();
|
||||||
this.panel2.SuspendLayout();
|
this.panel2.SuspendLayout();
|
||||||
this.pnlTopControls.SuspendLayout();
|
this.pnlTopControls.SuspendLayout();
|
||||||
@@ -82,6 +82,18 @@
|
|||||||
this.tlpControls.Size = new System.Drawing.Size(759, 416);
|
this.tlpControls.Size = new System.Drawing.Size(759, 416);
|
||||||
this.tlpControls.TabIndex = 19;
|
this.tlpControls.TabIndex = 19;
|
||||||
//
|
//
|
||||||
|
// txtLog
|
||||||
|
//
|
||||||
|
this.txtLog.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.txtLog.Location = new System.Drawing.Point(153, 3);
|
||||||
|
this.txtLog.Multiline = true;
|
||||||
|
this.txtLog.Name = "txtLog";
|
||||||
|
this.txtLog.ReadOnly = true;
|
||||||
|
this.tlpControls.SetRowSpan(this.txtLog, 2);
|
||||||
|
this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||||
|
this.txtLog.Size = new System.Drawing.Size(603, 410);
|
||||||
|
this.txtLog.TabIndex = 27;
|
||||||
|
//
|
||||||
// panel2
|
// panel2
|
||||||
//
|
//
|
||||||
this.panel2.Controls.Add(this.btnCancel);
|
this.panel2.Controls.Add(this.btnCancel);
|
||||||
@@ -103,6 +115,7 @@
|
|||||||
this.btnCancel.TabIndex = 19;
|
this.btnCancel.TabIndex = 19;
|
||||||
this.btnCancel.Text = "Отменить операцию";
|
this.btnCancel.Text = "Отменить операцию";
|
||||||
this.btnCancel.UseVisualStyleBackColor = true;
|
this.btnCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
||||||
//
|
//
|
||||||
// btnMeeting
|
// btnMeeting
|
||||||
//
|
//
|
||||||
@@ -112,6 +125,7 @@
|
|||||||
this.btnMeeting.TabIndex = 18;
|
this.btnMeeting.TabIndex = 18;
|
||||||
this.btnMeeting.Text = "Митинг";
|
this.btnMeeting.Text = "Митинг";
|
||||||
this.btnMeeting.UseVisualStyleBackColor = true;
|
this.btnMeeting.UseVisualStyleBackColor = true;
|
||||||
|
this.btnMeeting.Click += new System.EventHandler(this.btnMeeting_Click);
|
||||||
//
|
//
|
||||||
// txtDummyMode
|
// txtDummyMode
|
||||||
//
|
//
|
||||||
@@ -131,6 +145,7 @@
|
|||||||
this.btnStart.TabIndex = 16;
|
this.btnStart.TabIndex = 16;
|
||||||
this.btnStart.Text = "Проставить время";
|
this.btnStart.Text = "Проставить время";
|
||||||
this.btnStart.UseVisualStyleBackColor = true;
|
this.btnStart.UseVisualStyleBackColor = true;
|
||||||
|
this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
|
||||||
//
|
//
|
||||||
// pnlTopControls
|
// pnlTopControls
|
||||||
//
|
//
|
||||||
@@ -151,6 +166,7 @@
|
|||||||
this.btnDoForDate.TabIndex = 25;
|
this.btnDoForDate.TabIndex = 25;
|
||||||
this.btnDoForDate.Text = "Проставить на дату";
|
this.btnDoForDate.Text = "Проставить на дату";
|
||||||
this.btnDoForDate.UseVisualStyleBackColor = true;
|
this.btnDoForDate.UseVisualStyleBackColor = true;
|
||||||
|
this.btnDoForDate.Click += new System.EventHandler(this.btnDoForDate_Click);
|
||||||
//
|
//
|
||||||
// dteForDay
|
// dteForDay
|
||||||
//
|
//
|
||||||
@@ -171,18 +187,7 @@
|
|||||||
this.btnSettings.TabIndex = 23;
|
this.btnSettings.TabIndex = 23;
|
||||||
this.btnSettings.Text = "Настройки";
|
this.btnSettings.Text = "Настройки";
|
||||||
this.btnSettings.UseVisualStyleBackColor = true;
|
this.btnSettings.UseVisualStyleBackColor = true;
|
||||||
//
|
this.btnSettings.Click += new System.EventHandler(this.btnSettings_Click);
|
||||||
// txtLog
|
|
||||||
//
|
|
||||||
this.txtLog.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
this.txtLog.Location = new System.Drawing.Point(153, 3);
|
|
||||||
this.txtLog.Multiline = true;
|
|
||||||
this.txtLog.Name = "txtLog";
|
|
||||||
this.txtLog.ReadOnly = true;
|
|
||||||
this.tlpControls.SetRowSpan(this.txtLog, 2);
|
|
||||||
this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
|
||||||
this.txtLog.Size = new System.Drawing.Size(603, 410);
|
|
||||||
this.txtLog.TabIndex = 27;
|
|
||||||
//
|
//
|
||||||
// frmMain
|
// frmMain
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user