Исправление ошибок
This commit is contained in:
@@ -20,7 +20,7 @@ namespace JiraTimeBotForm.JiraIntegration
|
|||||||
_jira = Jira.CreateRestClient(_settings.JiraUrl, _settings.JiraUserName, _settings.JiraPassword);
|
_jira = Jira.CreateRestClient(_settings.JiraUrl, _settings.JiraUserName, _settings.JiraPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetTodayWorklog(List<TaskTimeItem> taskTimeItems, DateTime? date = null)
|
public void SetTodayWorklog(List<TaskTimeItem> taskTimeItems, DateTime? date = null, bool dummy = false)
|
||||||
{
|
{
|
||||||
if (date == null)
|
if (date == null)
|
||||||
{
|
{
|
||||||
@@ -48,7 +48,10 @@ namespace JiraTimeBotForm.JiraIntegration
|
|||||||
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}");
|
||||||
issue.DeleteWorklogAsync(workLog, WorklogStrategy.RetainRemainingEstimate);
|
if (!dummy)
|
||||||
|
{
|
||||||
|
issue.DeleteWorklogAsync(workLog, WorklogStrategy.RetainRemainingEstimate);
|
||||||
|
}
|
||||||
hasTodayWorklog = false;
|
hasTodayWorklog = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -62,8 +65,12 @@ namespace JiraTimeBotForm.JiraIntegration
|
|||||||
if (!hasTodayWorklog)
|
if (!hasTodayWorklog)
|
||||||
{
|
{
|
||||||
var timeSpentJira = $"{taskTimeItem.Time.TotalMinutes}m";
|
var timeSpentJira = $"{taskTimeItem.Time.TotalMinutes}m";
|
||||||
var addedWorklog = issue.AddWorklogAsync(new Worklog(timeSpentJira, date.Value)).Result;
|
var workLogToAdd = new Worklog(timeSpentJira, date.Value);
|
||||||
_log.Trace($"Добавили Worklog для {taskTimeItem.Branch}: {addedWorklog.Author} {addedWorklog.CreateDate}: {addedWorklog.TimeSpent}");
|
if (!dummy)
|
||||||
|
{
|
||||||
|
workLogToAdd = issue.AddWorklogAsync(workLogToAdd).Result;
|
||||||
|
}
|
||||||
|
_log.Trace($"Добавили Worklog для {taskTimeItem.Branch}: {workLogToAdd.Author} {workLogToAdd.CreateDate}: {workLogToAdd.TimeSpent}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ApplicationIcon>Google-Noto-Emoji-Smileys-10103-robot-face.ico</ApplicationIcon>
|
<ApplicationIcon>app.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Atlassian.Jira, Version=10.4.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Atlassian.Jira, Version=10.4.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
@@ -74,11 +74,11 @@
|
|||||||
<Compile Include="Extensions\Extensions.cs" />
|
<Compile Include="Extensions\Extensions.cs" />
|
||||||
<Compile Include="Logger.cs" />
|
<Compile Include="Logger.cs" />
|
||||||
<Compile Include="Configuration\Settings.cs" />
|
<Compile Include="Configuration\Settings.cs" />
|
||||||
<Compile Include="Form1.cs">
|
<Compile Include="frmMain.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Form1.Designer.cs">
|
<Compile Include="frmMain.Designer.cs">
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
<DependentUpon>frmMain.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="JiraIntegration\JiraApi.cs" />
|
<Compile Include="JiraIntegration\JiraApi.cs" />
|
||||||
<Compile Include="Passwords\EncryptionClass.cs" />
|
<Compile Include="Passwords\EncryptionClass.cs" />
|
||||||
@@ -87,8 +87,8 @@
|
|||||||
<Compile Include="TaskTime\ITaskTimeDiscoverer.cs" />
|
<Compile Include="TaskTime\ITaskTimeDiscoverer.cs" />
|
||||||
<Compile Include="TaskTime\TaskTimeDiscoverer.cs" />
|
<Compile Include="TaskTime\TaskTimeDiscoverer.cs" />
|
||||||
<Compile Include="TaskTime\TaskTimeItem.cs" />
|
<Compile Include="TaskTime\TaskTimeItem.cs" />
|
||||||
<EmbeddedResource Include="Form1.resx">
|
<EmbeddedResource Include="frmMain.resx">
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
<DependentUpon>frmMain.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Google-Noto-Emoji-Smileys-10103-robot-face.ico" />
|
<Content Include="app.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
|
Before Width: | Height: | Size: 170 KiB After Width: | Height: | Size: 170 KiB |
@@ -45,6 +45,7 @@ namespace JiraTimeBotForm
|
|||||||
this.btnStart = new System.Windows.Forms.Button();
|
this.btnStart = new System.Windows.Forms.Button();
|
||||||
this.ntfyIcon = new System.Windows.Forms.NotifyIcon(this.components);
|
this.ntfyIcon = new System.Windows.Forms.NotifyIcon(this.components);
|
||||||
this.tmrStart = new System.Windows.Forms.Timer(this.components);
|
this.tmrStart = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.txtDummyMode = new System.Windows.Forms.CheckBox();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// actTime
|
// actTime
|
||||||
@@ -168,11 +169,22 @@ namespace JiraTimeBotForm
|
|||||||
this.tmrStart.Interval = 1000;
|
this.tmrStart.Interval = 1000;
|
||||||
this.tmrStart.Tick += new System.EventHandler(this.tmrStart_Tick);
|
this.tmrStart.Tick += new System.EventHandler(this.tmrStart_Tick);
|
||||||
//
|
//
|
||||||
|
// txtDummyMode
|
||||||
|
//
|
||||||
|
this.txtDummyMode.AutoSize = true;
|
||||||
|
this.txtDummyMode.Location = new System.Drawing.Point(48, 234);
|
||||||
|
this.txtDummyMode.Name = "txtDummyMode";
|
||||||
|
this.txtDummyMode.Size = new System.Drawing.Size(114, 17);
|
||||||
|
this.txtDummyMode.TabIndex = 13;
|
||||||
|
this.txtDummyMode.Text = "Òåñòîâûé ïðîãîí";
|
||||||
|
this.txtDummyMode.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// frmMain
|
// frmMain
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(740, 292);
|
this.ClientSize = new System.Drawing.Size(740, 292);
|
||||||
|
this.Controls.Add(this.txtDummyMode);
|
||||||
this.Controls.Add(this.btnStart);
|
this.Controls.Add(this.btnStart);
|
||||||
this.Controls.Add(this.txtLog);
|
this.Controls.Add(this.txtLog);
|
||||||
this.Controls.Add(this.label4);
|
this.Controls.Add(this.label4);
|
||||||
@@ -215,6 +227,7 @@ namespace JiraTimeBotForm
|
|||||||
private System.Windows.Forms.Button btnStart;
|
private System.Windows.Forms.Button btnStart;
|
||||||
private System.Windows.Forms.NotifyIcon ntfyIcon;
|
private System.Windows.Forms.NotifyIcon ntfyIcon;
|
||||||
private System.Windows.Forms.Timer tmrStart;
|
private System.Windows.Forms.Timer tmrStart;
|
||||||
|
private System.Windows.Forms.CheckBox txtDummyMode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,9 +163,9 @@ namespace JiraTimeBotForm
|
|||||||
var taskTimes = taskDiscoverer.GetTaskTimes(settings, date);
|
var taskTimes = taskDiscoverer.GetTaskTimes(settings, date);
|
||||||
if (!taskTimes.Any())
|
if (!taskTimes.Any())
|
||||||
{
|
{
|
||||||
_log.Warn($"{date} вы не сделали ничего полезного =) Использую предыдущий день.");
|
_log.Warn($"{date:dd.MM.yyyy} вы не сделали ничего полезного =) Использую предыдущий день.");
|
||||||
daysDiff--;
|
daysDiff--;
|
||||||
if (daysDiff < 7)
|
if (daysDiff < -7)
|
||||||
{
|
{
|
||||||
_log.Error("Íå íàøëè íè îäíîãî êîììèòà çà ïðåäûäóùèå 7 äíåé. Âîçìîæíî âû â îòïóñêå? Âûõîæó.");
|
_log.Error("Íå íàøëè íè îäíîãî êîììèòà çà ïðåäûäóùèå 7 äíåé. Âîçìîæíî âû â îòïóñêå? Âûõîæó.");
|
||||||
return;
|
return;
|
||||||
@@ -180,7 +180,7 @@ namespace JiraTimeBotForm
|
|||||||
_log.Trace($"- {taskTime.Branch} (êîììèòîâ {taskTime.Commits}): {taskTime.Time}");
|
_log.Trace($"- {taskTime.Branch} (êîììèòîâ {taskTime.Commits}): {taskTime.Time}");
|
||||||
}
|
}
|
||||||
|
|
||||||
jira.SetTodayWorklog(taskTimes);
|
jira.SetTodayWorklog(taskTimes, dummy: txtDummyMode.Checked);
|
||||||
_log.Info("Ãîòîâî.");
|
_log.Info("Ãîòîâî.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user