diff --git a/.semver.txt b/.semver.txt index 3c92cd0..bde91a2 100644 --- a/.semver.txt +++ b/.semver.txt @@ -1 +1 @@ -1.0.46 +1.0.47 diff --git a/src/JiraTimeBot/Configuration/Settings.cs b/src/JiraTimeBot/Configuration/Settings.cs index b0791e5..7577240 100644 --- a/src/JiraTimeBot/Configuration/Settings.cs +++ b/src/JiraTimeBot/Configuration/Settings.cs @@ -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"; diff --git a/src/JiraTimeBot/Properties/AssemblyInfo.cs b/src/JiraTimeBot/Properties/AssemblyInfo.cs index 4c72434..4c67d0c 100644 --- a/src/JiraTimeBot/Properties/AssemblyInfo.cs +++ b/src/JiraTimeBot/Properties/AssemblyInfo.cs @@ -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.47")] +[assembly: AssemblyFileVersion("1.0.47")] +[assembly: AssemblyInformationalVersion("1.0.47")] diff --git a/src/JiraTimeBot/TaskTime/TaskTimeByCommitsCalculator.cs b/src/JiraTimeBot/TaskTime/TaskTimeByCommitsCalculator.cs index 066679d..019029f 100644 --- a/src/JiraTimeBot/TaskTime/TaskTimeByCommitsCalculator.cs +++ b/src/JiraTimeBot/TaskTime/TaskTimeByCommitsCalculator.cs @@ -22,6 +22,7 @@ namespace JiraTimeBot.TaskTime { int minutesPerWorkDay = settings.MinuterPerWorkDay; int remainMinutes = settings.MinuterPerWorkDay; + int workHours = (settings.MinuterPerWorkDay / 60); int totalCommitsCount = commits.Count; if (!commits.Any()) @@ -30,7 +31,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}."); diff --git a/src/JiraTimeBot/UI/frmSettings.Designer.cs b/src/JiraTimeBot/UI/frmSettings.Designer.cs index 0abbfa0..48f1ba6 100644 --- a/src/JiraTimeBot/UI/frmSettings.Designer.cs +++ b/src/JiraTimeBot/UI/frmSettings.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/src/JiraTimeBot/UI/frmSettings.cs b/src/JiraTimeBot/UI/frmSettings.cs index ba8e90f..112aa16 100644 --- a/src/JiraTimeBot/UI/frmSettings.cs +++ b/src/JiraTimeBot/UI/frmSettings.cs @@ -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);