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