Еще немного рефакторинга алгоритма распределения в Jira

This commit is contained in:
Danil Kislov
2019-03-20 13:59:33 +03:00
parent 3adab981fe
commit d90d94e8a7
4 changed files with 39 additions and 46 deletions
+1 -1
View File
@@ -1 +1 @@
1.0.24 1.0.25
@@ -34,20 +34,11 @@ namespace JiraTimeBot.JiraIntegration
{ {
return new List<MercurialCommitItem>(); return new List<MercurialCommitItem>();
} }
var comments = issue.GetCommentsAsync(cancellationToken).Result?.ToList() ?? new List<Comment>();
List<Comment> comments = new List<Comment>();
if (issue.Type?.Name != "Дубликат")
{
_log.Trace($"Получаю комментарии по задаче {issue.Key} ({issue.Type?.Name}).");
comments = issue.GetCommentsAsync(cancellationToken).Result?.ToList() ?? new List<Comment>();
}
else
{
_log.Trace($"Пропускаю комментарии по задаче {issue.Key} ({issue.Type?.Name}).");
}
var user = settings.JiraUserName; var user = settings.JiraUserName;
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}.");
if (userComments.Any()) if (userComments.Any())
{ {
+5 -3
View File
@@ -1,5 +1,7 @@
using JiraTimeBot.UI; using JiraTimeBot.UI;
using System; using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
@@ -7,19 +9,19 @@ namespace JiraTimeBot
{ {
static class Program static class Program
{ {
private static Mutex _mutex = new Mutex(true, "{44426B3E-B901-4792-ACEA-1385D79DBAD1}"); private static readonly Mutex Mutex = new Mutex(true, "{44426B3E-B901-4792-ACEA-1385D79DBAD1}");
/// <summary> /// <summary>
/// The main entry point for the application. /// The main entry point for the application.
/// </summary> /// </summary>
[STAThread] [STAThread]
static void Main() static void Main()
{ {
if (_mutex.WaitOne(TimeSpan.Zero, true)) if (Mutex.WaitOne(TimeSpan.Zero, true))
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMain()); Application.Run(new frmMain());
_mutex.ReleaseMutex(); Mutex.ReleaseMutex();
} }
else else
{ {
+31 -31
View File
@@ -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.24")] [assembly: AssemblyVersion("1.0.25")]
[assembly: AssemblyFileVersion("1.0.24")] [assembly: AssemblyFileVersion("1.0.25")]
[assembly: AssemblyInformationalVersion("1.0.24")] [assembly: AssemblyInformationalVersion("1.0.25")]