Compare commits

..
4 Commits
7 changed files with 70 additions and 42 deletions
+1 -1
View File
@@ -1 +1 @@
1.0.46
1.0.49
+1 -1
View File
@@ -9,7 +9,7 @@ namespace JiraTimeBot.Configuration
{
public class Settings
{
public int MinuterPerWorkDay = 8 * 60;
public int MinuterPerWorkDay { get; set; }
public int RountToMinutes { get; set; }
public string JiraUrl = "https://myteam.aeroclub.ru";
+2 -3
View File
@@ -51,8 +51,7 @@ namespace JiraTimeBot.JiraIntegration
try
{
List<Issue> affectedIssues =
jira.Issues.GetIssuesFromJqlAsync(jql, 100, 0, cancellationToken).Result.ToList();
List<Issue> affectedIssues = jira.Issues.GetIssuesFromJqlAsync(jql, 100, 0, cancellationToken).Result.ToList();
return affectedIssues;
}
catch (Exception ex)
@@ -177,7 +176,7 @@ namespace JiraTimeBot.JiraIntegration
}
catch (Exception ex)
{
_log.Error($"Не могу добавить Worklog по задаче {taskTimeItem.Branch}: {ex.Message}.");
_log.Error($"Не могу добавить Worklog по задаче {taskTimeItem.Branch}: {ex.Message} ({ex.InnerException?.Message}).");
continue;
}
}
+31 -31
View File
@@ -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.46")]
[assembly: AssemblyFileVersion("1.0.46")]
[assembly: AssemblyInformationalVersion("1.0.46")]
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.49")]
[assembly: AssemblyFileVersion("1.0.49")]
[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))
{
int minutesPerWorkDay = settings.MinuterPerWorkDay;
int remainMinutes = settings.MinuterPerWorkDay;
int workHours = (settings.MinuterPerWorkDay / 60);
int totalCommitsCount = commits.Count;
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);
_log.Info($"Слишком много задач - уменьшаю интервал до {settings.RountToMinutes}.");
@@ -55,6 +55,7 @@ namespace JiraTimeBot.TaskTime
});
}
int remainMinutes = minutesPerWorkDay;
//Нам нужно раскидать 480 минут в день.
foreach (var taskGroup in commits.GroupBy(f => f.Branch).OrderByDescending(f=>f.Count()))
{
+26 -4
View File
@@ -49,6 +49,8 @@
this.label8 = new System.Windows.Forms.Label();
this.txtTimeControlTask = new System.Windows.Forms.TextBox();
this.chkAutostart = new System.Windows.Forms.CheckBox();
this.lblWorkDay = new System.Windows.Forms.Label();
this.txtWorkDayDuration = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label5
@@ -153,7 +155,7 @@
// chkAddComments
//
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.Size = new System.Drawing.Size(133, 17);
this.chkAddComments.TabIndex = 31;
@@ -162,7 +164,7 @@
//
// 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.Size = new System.Drawing.Size(75, 23);
this.btnSave.TabIndex = 32;
@@ -227,18 +229,36 @@
// chkAutostart
//
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.Size = new System.Drawing.Size(96, 17);
this.chkAutostart.TabIndex = 40;
this.chkAutostart.Text = "Автозагрузка";
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
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
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.label8);
this.Controls.Add(this.txtTimeControlTask);
@@ -294,5 +314,7 @@
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox txtTimeControlTask;
private System.Windows.Forms.CheckBox chkAutostart;
private System.Windows.Forms.Label lblWorkDay;
private System.Windows.Forms.TextBox txtWorkDayDuration;
}
}
+6
View File
@@ -38,6 +38,7 @@ namespace JiraTimeBot.UI
cboWorkType.SelectedIndex = (int) settings.WorkType;
txtTimeControlTask.Text = settings.TimeControlTask;
txtJQL.Text = settings.JiraQuery;
txtWorkDayDuration.Text = settings.MinuterPerWorkDay.ToString();
cboWorkType_SelectedIndexChanged(null, null);
}
@@ -48,6 +49,10 @@ namespace JiraTimeBot.UI
{
roundTo = 15;
}
if (!int.TryParse(txtWorkDayDuration.Text, out var minuterPerWorkDay))
{
minuterPerWorkDay = 8 * 60;
}
var settings = new Settings
{
@@ -61,6 +66,7 @@ namespace JiraTimeBot.UI
WorkType = (WorkType) cboWorkType.SelectedIndex,
JiraQuery = txtJQL.Text,
TimeControlTask = txtTimeControlTask.Text,
MinuterPerWorkDay = minuterPerWorkDay
};
//LockUnlock(false);