Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b82ad07460 | ||
|
|
2a74eba1d4 | ||
|
|
90be770027 | ||
|
|
63b74263bd | ||
|
|
8c38726588 | ||
|
|
3ea3cbcce8 | ||
|
|
84ef070eb6 |
+1
-1
@@ -1 +1 @@
|
|||||||
1.0.43
|
1.0.49
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace JiraTimeBot.Configuration
|
|||||||
{
|
{
|
||||||
public class Settings
|
public class Settings
|
||||||
{
|
{
|
||||||
public int MinuterPerWorkDay = 8 * 60;
|
public int MinuterPerWorkDay { get; set; }
|
||||||
public int RountToMinutes { get; set; }
|
public int RountToMinutes { get; set; }
|
||||||
|
|
||||||
public string JiraUrl = "https://myteam.aeroclub.ru";
|
public string JiraUrl = "https://myteam.aeroclub.ru";
|
||||||
|
|||||||
@@ -51,8 +51,7 @@ namespace JiraTimeBot.JiraIntegration
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<Issue> affectedIssues =
|
List<Issue> affectedIssues = jira.Issues.GetIssuesFromJqlAsync(jql, 100, 0, cancellationToken).Result.ToList();
|
||||||
jira.Issues.GetIssuesFromJqlAsync(jql, 100, 0, cancellationToken).Result.ToList();
|
|
||||||
return affectedIssues;
|
return affectedIssues;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -177,7 +176,7 @@ namespace JiraTimeBot.JiraIntegration
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_log.Error($"Не могу добавить Worklog по задаче {taskTimeItem.Branch}: {ex.Message}.");
|
_log.Error($"Не могу добавить Worklog по задаче {taskTimeItem.Branch}: {ex.Message} ({ex.InnerException?.Message}).");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace JiraTimeBot.JiraIntegration
|
|||||||
var comments = issue.GetCommentsAsync(cancellationToken).Result?.ToList() ?? new List<Comment>();
|
var comments = issue.GetCommentsAsync(cancellationToken).Result?.ToList() ?? new List<Comment>();
|
||||||
|
|
||||||
var user = settings.JiraUserName;
|
var user = settings.JiraUserName;
|
||||||
user = "Zoya.Aleksandridi";
|
//user = "Zoya.Aleksandridi";
|
||||||
var userComments = comments.Where(f => f.Author.Equals(user, StringComparison.InvariantCultureIgnoreCase)).ToList();
|
var userComments = comments.Where(f => f.Author.Equals(user, StringComparison.InvariantCultureIgnoreCase)).ToList();
|
||||||
_log.Trace($"Получены комментарии по задаче {issue.Key} ({issue.Type?.Name}): {userComments.Count}.");
|
_log.Trace($"Получены комментарии по задаче {issue.Key} ({issue.Type?.Name}): {userComments.Count}.");
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ namespace JiraTimeBot
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (cancellationToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_log.Warn($"{realDate:dd.MM.yyyy} вы не сделали ничего полезного =) Использую предыдущий день.");
|
_log.Warn($"{realDate:dd.MM.yyyy} вы не сделали ничего полезного =) Использую предыдущий день.");
|
||||||
daysDiff--;
|
daysDiff--;
|
||||||
|
|||||||
@@ -1,31 +1,31 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("JiraTimeBot")]
|
[assembly: AssemblyTitle("JiraTimeBot")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("JiraTimeBot")]
|
[assembly: AssemblyProduct("JiraTimeBot")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
// 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
|
// to COM components. If you need to access a type in this assembly from
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
[assembly: Guid("f3b89316-c38c-4ce6-9d88-0b1373cfba1a")]
|
[assembly: Guid("f3b89316-c38c-4ce6-9d88-0b1373cfba1a")]
|
||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
//
|
//
|
||||||
// Major Version
|
// Major Version
|
||||||
// Minor Version
|
// Minor Version
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
// 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.43")]
|
[assembly: AssemblyVersion("1.0.49")]
|
||||||
[assembly: AssemblyFileVersion("1.0.43")]
|
[assembly: AssemblyFileVersion("1.0.49")]
|
||||||
[assembly: AssemblyInformationalVersion("1.0.43")]
|
[assembly: AssemblyInformationalVersion("1.0.49")]
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace JiraTimeBot.TaskTime
|
|||||||
public List<TaskTimeItem> CalculateTaskTime(List<MercurialCommitItem> commits, Settings settings, CancellationToken cancellationToken = default(CancellationToken))
|
public List<TaskTimeItem> CalculateTaskTime(List<MercurialCommitItem> commits, Settings settings, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
{
|
{
|
||||||
int minutesPerWorkDay = settings.MinuterPerWorkDay;
|
int minutesPerWorkDay = settings.MinuterPerWorkDay;
|
||||||
int remainMinutes = settings.MinuterPerWorkDay;
|
int workHours = (settings.MinuterPerWorkDay / 60);
|
||||||
int totalCommitsCount = commits.Count;
|
int totalCommitsCount = commits.Count;
|
||||||
|
|
||||||
if (!commits.Any())
|
if (!commits.Any())
|
||||||
@@ -30,7 +30,7 @@ namespace JiraTimeBot.TaskTime
|
|||||||
}
|
}
|
||||||
|
|
||||||
//если кол-во коммитов более чем кол-во интервалов - то уменьшим интервал вдвое.
|
//если кол-во коммитов более чем кол-во интервалов - то уменьшим интервал вдвое.
|
||||||
while (totalCommitsCount > (8 * (60.0 / settings.RountToMinutes)))
|
while (totalCommitsCount > (workHours * (60.0 / settings.RountToMinutes)))
|
||||||
{
|
{
|
||||||
settings.RountToMinutes = (int)RoundTo((decimal)(settings.RountToMinutes / 2.0), 5);
|
settings.RountToMinutes = (int)RoundTo((decimal)(settings.RountToMinutes / 2.0), 5);
|
||||||
_log.Info($"Слишком много задач - уменьшаю интервал до {settings.RountToMinutes}.");
|
_log.Info($"Слишком много задач - уменьшаю интервал до {settings.RountToMinutes}.");
|
||||||
@@ -55,6 +55,7 @@ namespace JiraTimeBot.TaskTime
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int remainMinutes = minutesPerWorkDay;
|
||||||
//Нам нужно раскидать 480 минут в день.
|
//Нам нужно раскидать 480 минут в день.
|
||||||
foreach (var taskGroup in commits.GroupBy(f => f.Branch).OrderByDescending(f=>f.Count()))
|
foreach (var taskGroup in commits.GroupBy(f => f.Branch).OrderByDescending(f=>f.Count()))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ namespace JiraTimeBot.UI
|
|||||||
if (txtDummyMode.Checked)
|
if (txtDummyMode.Checked)
|
||||||
{
|
{
|
||||||
_log.Info("Выключаем режим Тестового прогона");
|
_log.Info("Выключаем режим Тестового прогона");
|
||||||
|
txtDummyMode.Checked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var tokenSource = GetTokenSource())
|
using (var tokenSource = GetTokenSource())
|
||||||
|
|||||||
+26
-4
@@ -49,6 +49,8 @@
|
|||||||
this.label8 = new System.Windows.Forms.Label();
|
this.label8 = new System.Windows.Forms.Label();
|
||||||
this.txtTimeControlTask = new System.Windows.Forms.TextBox();
|
this.txtTimeControlTask = new System.Windows.Forms.TextBox();
|
||||||
this.chkAutostart = new System.Windows.Forms.CheckBox();
|
this.chkAutostart = new System.Windows.Forms.CheckBox();
|
||||||
|
this.lblWorkDay = new System.Windows.Forms.Label();
|
||||||
|
this.txtWorkDayDuration = new System.Windows.Forms.TextBox();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// label5
|
// label5
|
||||||
@@ -153,7 +155,7 @@
|
|||||||
// chkAddComments
|
// chkAddComments
|
||||||
//
|
//
|
||||||
this.chkAddComments.AutoSize = true;
|
this.chkAddComments.AutoSize = true;
|
||||||
this.chkAddComments.Location = new System.Drawing.Point(65, 277);
|
this.chkAddComments.Location = new System.Drawing.Point(65, 308);
|
||||||
this.chkAddComments.Name = "chkAddComments";
|
this.chkAddComments.Name = "chkAddComments";
|
||||||
this.chkAddComments.Size = new System.Drawing.Size(133, 17);
|
this.chkAddComments.Size = new System.Drawing.Size(133, 17);
|
||||||
this.chkAddComments.TabIndex = 31;
|
this.chkAddComments.TabIndex = 31;
|
||||||
@@ -162,7 +164,7 @@
|
|||||||
//
|
//
|
||||||
// btnSave
|
// btnSave
|
||||||
//
|
//
|
||||||
this.btnSave.Location = new System.Drawing.Point(86, 300);
|
this.btnSave.Location = new System.Drawing.Point(86, 331);
|
||||||
this.btnSave.Name = "btnSave";
|
this.btnSave.Name = "btnSave";
|
||||||
this.btnSave.Size = new System.Drawing.Size(75, 23);
|
this.btnSave.Size = new System.Drawing.Size(75, 23);
|
||||||
this.btnSave.TabIndex = 32;
|
this.btnSave.TabIndex = 32;
|
||||||
@@ -227,18 +229,36 @@
|
|||||||
// chkAutostart
|
// chkAutostart
|
||||||
//
|
//
|
||||||
this.chkAutostart.AutoSize = true;
|
this.chkAutostart.AutoSize = true;
|
||||||
this.chkAutostart.Location = new System.Drawing.Point(65, 254);
|
this.chkAutostart.Location = new System.Drawing.Point(65, 285);
|
||||||
this.chkAutostart.Name = "chkAutostart";
|
this.chkAutostart.Name = "chkAutostart";
|
||||||
this.chkAutostart.Size = new System.Drawing.Size(96, 17);
|
this.chkAutostart.Size = new System.Drawing.Size(96, 17);
|
||||||
this.chkAutostart.TabIndex = 40;
|
this.chkAutostart.TabIndex = 40;
|
||||||
this.chkAutostart.Text = "Автозагрузка";
|
this.chkAutostart.Text = "Автозагрузка";
|
||||||
this.chkAutostart.UseVisualStyleBackColor = true;
|
this.chkAutostart.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// lblWorkDay
|
||||||
|
//
|
||||||
|
this.lblWorkDay.AutoSize = true;
|
||||||
|
this.lblWorkDay.Location = new System.Drawing.Point(15, 258);
|
||||||
|
this.lblWorkDay.Name = "lblWorkDay";
|
||||||
|
this.lblWorkDay.Size = new System.Drawing.Size(117, 13);
|
||||||
|
this.lblWorkDay.TabIndex = 42;
|
||||||
|
this.lblWorkDay.Text = "Минут в рабочем дне:";
|
||||||
|
//
|
||||||
|
// txtWorkDayDuration
|
||||||
|
//
|
||||||
|
this.txtWorkDayDuration.Location = new System.Drawing.Point(133, 254);
|
||||||
|
this.txtWorkDayDuration.Name = "txtWorkDayDuration";
|
||||||
|
this.txtWorkDayDuration.Size = new System.Drawing.Size(99, 20);
|
||||||
|
this.txtWorkDayDuration.TabIndex = 41;
|
||||||
|
//
|
||||||
// frmSettings
|
// frmSettings
|
||||||
//
|
//
|
||||||
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(243, 334);
|
this.ClientSize = new System.Drawing.Size(243, 362);
|
||||||
|
this.Controls.Add(this.lblWorkDay);
|
||||||
|
this.Controls.Add(this.txtWorkDayDuration);
|
||||||
this.Controls.Add(this.chkAutostart);
|
this.Controls.Add(this.chkAutostart);
|
||||||
this.Controls.Add(this.label8);
|
this.Controls.Add(this.label8);
|
||||||
this.Controls.Add(this.txtTimeControlTask);
|
this.Controls.Add(this.txtTimeControlTask);
|
||||||
@@ -294,5 +314,7 @@
|
|||||||
private System.Windows.Forms.Label label8;
|
private System.Windows.Forms.Label label8;
|
||||||
private System.Windows.Forms.TextBox txtTimeControlTask;
|
private System.Windows.Forms.TextBox txtTimeControlTask;
|
||||||
private System.Windows.Forms.CheckBox chkAutostart;
|
private System.Windows.Forms.CheckBox chkAutostart;
|
||||||
|
private System.Windows.Forms.Label lblWorkDay;
|
||||||
|
private System.Windows.Forms.TextBox txtWorkDayDuration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,6 +38,7 @@ namespace JiraTimeBot.UI
|
|||||||
cboWorkType.SelectedIndex = (int) settings.WorkType;
|
cboWorkType.SelectedIndex = (int) settings.WorkType;
|
||||||
txtTimeControlTask.Text = settings.TimeControlTask;
|
txtTimeControlTask.Text = settings.TimeControlTask;
|
||||||
txtJQL.Text = settings.JiraQuery;
|
txtJQL.Text = settings.JiraQuery;
|
||||||
|
txtWorkDayDuration.Text = settings.MinuterPerWorkDay.ToString();
|
||||||
|
|
||||||
cboWorkType_SelectedIndexChanged(null, null);
|
cboWorkType_SelectedIndexChanged(null, null);
|
||||||
}
|
}
|
||||||
@@ -48,6 +49,10 @@ namespace JiraTimeBot.UI
|
|||||||
{
|
{
|
||||||
roundTo = 15;
|
roundTo = 15;
|
||||||
}
|
}
|
||||||
|
if (!int.TryParse(txtWorkDayDuration.Text, out var minuterPerWorkDay))
|
||||||
|
{
|
||||||
|
minuterPerWorkDay = 8 * 60;
|
||||||
|
}
|
||||||
|
|
||||||
var settings = new Settings
|
var settings = new Settings
|
||||||
{
|
{
|
||||||
@@ -61,6 +66,7 @@ namespace JiraTimeBot.UI
|
|||||||
WorkType = (WorkType) cboWorkType.SelectedIndex,
|
WorkType = (WorkType) cboWorkType.SelectedIndex,
|
||||||
JiraQuery = txtJQL.Text,
|
JiraQuery = txtJQL.Text,
|
||||||
TimeControlTask = txtTimeControlTask.Text,
|
TimeControlTask = txtTimeControlTask.Text,
|
||||||
|
MinuterPerWorkDay = minuterPerWorkDay
|
||||||
};
|
};
|
||||||
|
|
||||||
//LockUnlock(false);
|
//LockUnlock(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user