Немного красивостей+исправление выборки

This commit is contained in:
Danil Kislov
2019-09-13 10:54:20 +03:00
parent 1e40f0a07c
commit c245d71e53
5 changed files with 41 additions and 36 deletions
+1 -1
View File
@@ -1 +1 @@
1.0.66 1.0.67
+1 -1
View File
@@ -85,7 +85,7 @@ namespace JiraTimeBot.JiraIntegration
{ {
var workLogs = issue.GetWorklogsAsync(cancellationToken).Result; var workLogs = issue.GetWorklogsAsync(cancellationToken).Result;
var userWorklogs = workLogs.Where(w => var userWorklogs = workLogs.Where(w =>
w.CreateDate.GetValueOrDefault().Date == date && w.Author.Equals(settings.JiraUserName, w.StartDate.GetValueOrDefault().Date == date && w.Author.Equals(settings.JiraUserName,
StringComparison.InvariantCultureIgnoreCase)).ToList(); StringComparison.InvariantCultureIgnoreCase)).ToList();
foreach (var userWorklog in userWorklogs) foreach (var userWorklog in userWorklogs)
{ {
@@ -29,7 +29,7 @@ namespace JiraTimeBot.JiraIntegration
Settings settings, Settings settings,
CancellationToken cancellationToken = default(CancellationToken)) CancellationToken cancellationToken = default(CancellationToken))
{ {
var tasks = _jiraApi.GetIssuesByJQL("status changed by '%USER%' during (\"%DATE%\",\"%DATE%\")", settings, date, cancellationToken); var tasks = _jiraApi.GetIssuesByJQL("worklogDate = \"%DATE%\" and worklogAuthor='%USER%'", settings, date, cancellationToken);
List<TaskTimeItem> resultItems = new List<TaskTimeItem>(); List<TaskTimeItem> resultItems = new List<TaskTimeItem>();
foreach (var issue in tasks) foreach (var issue in tasks)
{ {
@@ -37,7 +37,7 @@ namespace JiraTimeBot.JiraIntegration
var user = settings.JiraUserName; var user = settings.JiraUserName;
//user = "Zoya.Aleksandridi"; //user = "Zoya.Aleksandridi";
var userWorklogs = workLogs.Where(w => var userWorklogs = workLogs.Where(w =>
w.CreateDate.GetValueOrDefault().Date == date && w.Author.Equals(user, w.StartDate.GetValueOrDefault().Date == date && w.Author.Equals(user,
StringComparison.InvariantCultureIgnoreCase)).ToList(); StringComparison.InvariantCultureIgnoreCase)).ToList();
if (!userWorklogs.Any()) if (!userWorklogs.Any())
{ {
@@ -50,6 +50,10 @@ namespace JiraTimeBot.JiraIntegration
var totalTime = TimeSpan.FromSeconds(userWorklogs.Sum(f => f.TimeSpentInSeconds)); var totalTime = TimeSpan.FromSeconds(userWorklogs.Sum(f => f.TimeSpentInSeconds));
var startDate = firstWorklog?.CreateDate ?? date; var startDate = firstWorklog?.CreateDate ?? date;
var commits = userWorklogs.Sum(f => f.Comment.Count(c => c == '\n')); var commits = userWorklogs.Sum(f => f.Comment.Count(c => c == '\n'));
if (commits == 0)
{
commits = 1;
}
var taskType = CommitType.Task; var taskType = CommitType.Task;
if (description.Contains("Подготовка и публикация")) if (description.Contains("Подготовка и публикация"))
{ {
+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.66")] [assembly: AssemblyVersion("1.0.67")]
[assembly: AssemblyFileVersion("1.0.66")] [assembly: AssemblyFileVersion("1.0.67")]
[assembly: AssemblyInformationalVersion("1.0.66")] [assembly: AssemblyInformationalVersion("1.0.67")]
@@ -21,7 +21,8 @@ namespace JiraTimeBot.TasksProcessors
public void Process(DateTime setForDate, DateTime realDate, List<TaskTimeItem> taskTimes, Settings settings, bool dummyMode, CancellationToken cancellationToken = default(CancellationToken)) public void Process(DateTime setForDate, DateTime realDate, List<TaskTimeItem> taskTimes, Settings settings, bool dummyMode, CancellationToken cancellationToken = default(CancellationToken))
{ {
_log.Trace($"На реальную дату {realDate:dd.MM.yyyy} распределение по задачам:"); var totalTime = TimeSpan.FromSeconds(taskTimes.Sum(f => f.TimeSpent.TotalSeconds));
_log.Trace($"На реальную дату {realDate:dd.MM.yyyy} распределение по задачам ({totalTime:hh':'mm':'ss}):");
foreach (var taskTime in taskTimes.Where(f=>f.Type.HasFlag(CommitType.Task)).OrderByDescending(f => f.TimeSpent)) foreach (var taskTime in taskTimes.Where(f=>f.Type.HasFlag(CommitType.Task)).OrderByDescending(f => f.TimeSpent))
{ {