Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53050ebed3 | ||
|
|
2f6d522636 | ||
|
|
da0968d003 | ||
|
|
882ecf3a4b | ||
|
|
9563b2220d | ||
|
|
9a3adc5059 | ||
|
|
16b15c44a6 | ||
|
|
2afc189307 |
+1
-1
@@ -1 +1 @@
|
||||
1.0.20
|
||||
1.0.22
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Windows.Forms;
|
||||
using Autofac;
|
||||
using Autofac;
|
||||
using Autofac.Extras.AggregateService;
|
||||
using JiraTimeBot.JiraIntegration;
|
||||
using JiraTimeBot.JiraIntegration.Comments;
|
||||
@@ -8,6 +7,8 @@ using JiraTimeBot.Mercurial.Modifiers;
|
||||
using JiraTimeBot.TasksProcessors;
|
||||
using JiraTimeBot.TaskTime;
|
||||
using JiraTimeBot.UI.Tray;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace JiraTimeBot.DI
|
||||
{
|
||||
@@ -21,7 +22,16 @@ namespace JiraTimeBot.DI
|
||||
|
||||
public IContainer Build(TextBox logTextBox)
|
||||
{
|
||||
_builder.Register(f => new Logger(logTextBox)).As<ILog>().AsSelf();
|
||||
_builder.Register(c => logTextBox).AsSelf();
|
||||
|
||||
_builder.Register(f =>
|
||||
{
|
||||
var txt = f.Resolve<TextBox>();
|
||||
return new Logger(message =>
|
||||
{
|
||||
txt.Invoke(new Action<string>(text => txt.AppendText(text)), message + Environment.NewLine);
|
||||
});
|
||||
}).As<ILog>().AsSelf();
|
||||
|
||||
_builder.Register(f => new TrayMenu()).As<ITrayMenu>().AsSelf();
|
||||
_builder.Register(c => new CommitSkipper()).As<ICommitSkipper>();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.TaskTime.Objects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.TaskTime.Objects;
|
||||
|
||||
namespace JiraTimeBot.JiraIntegration.Comments
|
||||
{
|
||||
|
||||
@@ -92,15 +92,24 @@ namespace JiraTimeBot.JiraIntegration
|
||||
|
||||
var hasTodayWorklog = false;
|
||||
var workLogs = issue.GetWorklogsAsync().Result;
|
||||
foreach (var workLog in workLogs)
|
||||
var userWorklogs = workLogs.Where(w =>
|
||||
w.CreateDate.GetValueOrDefault().Date == date && w.Author.Equals(settings.JiraUserName,
|
||||
StringComparison.InvariantCultureIgnoreCase)).ToList();
|
||||
|
||||
foreach (var workLog in userWorklogs)
|
||||
{
|
||||
var timeSpent = TimeSpan.FromSeconds(workLog.TimeSpentInSeconds);
|
||||
if (workLog.CreateDate.GetValueOrDefault().Date == date && workLog.Author == settings.JiraUserName)
|
||||
{
|
||||
var timeDiff = Math.Abs((timeSpent - taskTimeItem.Time).TotalMinutes);
|
||||
if (timeDiff > 1 || userWorklogs.Count > 1)
|
||||
{
|
||||
if (timeDiff > 1)
|
||||
{
|
||||
_log.Trace($"Время отличается на {timeDiff} минут, удаляю worklog: {taskTimeItem.Branch} {workLog.Author} {workLog.CreateDate}: {workLog.TimeSpent}");
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.Trace($"Найдено более одного ворклога на задачу, удаляю worklog: {taskTimeItem.Branch} {workLog.Author} {workLog.CreateDate}: {workLog.TimeSpent}");
|
||||
}
|
||||
if (!dummy)
|
||||
{
|
||||
issue.DeleteWorklogAsync(workLog);
|
||||
@@ -113,7 +122,6 @@ namespace JiraTimeBot.JiraIntegration
|
||||
hasTodayWorklog = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasTodayWorklog)
|
||||
{
|
||||
|
||||
@@ -1,29 +1,23 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace JiraTimeBot
|
||||
{
|
||||
public class Logger : ILog
|
||||
{
|
||||
private readonly TextBox _txt;
|
||||
private readonly AppendLog _safeAppender;
|
||||
private readonly Action<string> _logAction;
|
||||
|
||||
public Logger(TextBox txt)
|
||||
public Logger(Action<string> logAction)
|
||||
{
|
||||
_txt = txt;
|
||||
_safeAppender = text => _txt.AppendText(text);
|
||||
|
||||
_logAction = logAction;
|
||||
}
|
||||
|
||||
private void AppendText(string message)
|
||||
{
|
||||
message = $"{DateTime.Now:HH:mm} {message}";
|
||||
_txt.Invoke(_safeAppender, message + Environment.NewLine);
|
||||
_logAction(message);
|
||||
}
|
||||
|
||||
private delegate void AppendLog(string text);
|
||||
|
||||
public void Info([Localizable(false)] string message)
|
||||
{
|
||||
AppendText(message);
|
||||
|
||||
@@ -1,45 +1,30 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using JiraTimeBot.UI;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using JiraTimeBot.UI;
|
||||
|
||||
namespace JiraTimeBot
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
private static Mutex _mutex = new Mutex(true, "{44426B3E-B901-4792-ACEA-1385D79DBAD1}");
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
if (PriorProcess() != null)
|
||||
if (_mutex.WaitOne(TimeSpan.Zero, true))
|
||||
{
|
||||
|
||||
MessageBox.Show("Another instance of the app is already running.");
|
||||
return;
|
||||
}
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new frmMain());
|
||||
_mutex.ReleaseMutex();
|
||||
}
|
||||
|
||||
public static Process PriorProcess()
|
||||
// Returns a System.Diagnostics.Process pointing to
|
||||
// a pre-existing process with the same name as the
|
||||
// current one, if any; or null if the current process
|
||||
// is unique.
|
||||
else
|
||||
{
|
||||
Process curr = Process.GetCurrentProcess();
|
||||
Process[] procs = Process.GetProcessesByName(curr.ProcessName);
|
||||
foreach (Process p in procs)
|
||||
{
|
||||
if ((p.Id != curr.Id) &&
|
||||
(p.MainModule.FileName == curr.MainModule.FileName))
|
||||
return p;
|
||||
MessageBox.Show("Another instance of the app is already running.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,6 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// 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.20")]
|
||||
[assembly: AssemblyFileVersion("1.0.20")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.20")]
|
||||
[assembly: AssemblyVersion("1.0.22")]
|
||||
[assembly: AssemblyFileVersion("1.0.22")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.22")]
|
||||
|
||||
@@ -78,8 +78,11 @@ namespace JiraTimeBot.TaskTime
|
||||
_log.Trace($"Погрешность распределения времени: {remainMinutes}. Добавляю к первой задаче.");
|
||||
}
|
||||
|
||||
if (workTimeItems.First().Time.TotalMinutes > Math.Abs(remainMinutes) && remainMinutes < 0)
|
||||
{
|
||||
//если переборщили или не достаточно добавили до 8 часов - скореектируем остаток в первой задаче (она самая трудозатратная).
|
||||
workTimeItems.First().Time += TimeSpan.FromMinutes(remainMinutes);
|
||||
}
|
||||
|
||||
return workTimeItems;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
using System;
|
||||
using Autofac;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.DI;
|
||||
using JiraTimeBot.TasksProcessors;
|
||||
using JiraTimeBot.UI.Tray;
|
||||
using JiraTimeBot.Update;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Autofac;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.DI;
|
||||
using JiraTimeBot.TasksProcessors;
|
||||
using JiraTimeBot.UI.Tray;
|
||||
using JiraTimeBot.Update;
|
||||
|
||||
// This is the code for your desktop app.
|
||||
// Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app.
|
||||
|
||||
Reference in New Issue
Block a user