aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-08-30 16:50:36 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-08-30 16:50:36 +0300
commit95edab32058cedee632dbe27ef1950d5a452cb85 (patch)
tree358ef085a6f013258b32a16362b3e5cc498ff47a /Software/Visual_Studio
parentde0eb1dbfcd48d2e5a0ca3c034befedb4037b72c (diff)
downloadTango-95edab32058cedee632dbe27ef1950d5a452cb85.tar.gz
Tango-95edab32058cedee632dbe27ef1950d5a452cb85.zip
Fixed issue on TFS due to changes with new bug statuses.
Optimized GetMachineWorkitems with start and end dates query.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/DefaultBugReporter.cs6
-rw-r--r--Software/Visual_Studio/Tango.TFS/ResolvedReason.cs2
-rw-r--r--Software/Visual_Studio/Tango.TFS/State.cs4
-rw-r--r--Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs21
4 files changed, 25 insertions, 8 deletions
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/DefaultBugReporter.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/DefaultBugReporter.cs
index 320a1591e..02635192f 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/DefaultBugReporter.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/DefaultBugReporter.cs
@@ -635,7 +635,7 @@ namespace Tango.FSE.UI.BugReporting
}
}
- public async Task<List<Bug>> GetConnectedMachineBugs(DateTime start, DateTime end)
+ public async Task<List<Bug>> GetConnectedMachineBugs(DateTime startUtc, DateTime endUtc)
{
List<Bug> list = new List<Bug>();
@@ -652,11 +652,11 @@ namespace Tango.FSE.UI.BugReporting
await Initialize();
}
- var workItems = await _tfsClient.GetWorkItemsForMachine(Project, MachineProvider.Machine.SerialNumber);
+ var workItems = await _tfsClient.GetWorkItemsForMachine(Project, MachineProvider.Machine.SerialNumber, startUtc, endUtc);
if (workItems.Count > 0)
{
- return workItems.Where(x => x.CreatedDate >= start && x.CreatedDate <= end).Select(x => new Bug()
+ return workItems.Where(x => x.CreatedDate >= startUtc && x.CreatedDate <= endUtc).Select(x => new Bug()
{
Area = x.Area,
AssignedTo = x.AssignedTo,
diff --git a/Software/Visual_Studio/Tango.TFS/ResolvedReason.cs b/Software/Visual_Studio/Tango.TFS/ResolvedReason.cs
index bdd1bf797..c48c64ef2 100644
--- a/Software/Visual_Studio/Tango.TFS/ResolvedReason.cs
+++ b/Software/Visual_Studio/Tango.TFS/ResolvedReason.cs
@@ -9,6 +9,8 @@ namespace Tango.TFS
{
public enum ResolvedReason
{
+ [Description("Unknown")]
+ Unknown,
[Description("As Designed")]
AsDesigned,
[Description("Cannot Reproduce")]
diff --git a/Software/Visual_Studio/Tango.TFS/State.cs b/Software/Visual_Studio/Tango.TFS/State.cs
index dfa905846..511914832 100644
--- a/Software/Visual_Studio/Tango.TFS/State.cs
+++ b/Software/Visual_Studio/Tango.TFS/State.cs
@@ -11,6 +11,8 @@ namespace Tango.TFS
New,
Active,
Resolved,
- Closed
+ Closed,
+ Analyze,
+ Pending
}
}
diff --git a/Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs b/Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs
index ed18241fb..92c56187b 100644
--- a/Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs
+++ b/Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs
@@ -9,6 +9,7 @@ using Microsoft.VisualStudio.Services.WebApi.Patch;
using Microsoft.VisualStudio.Services.WebApi.Patch.Json;
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
@@ -618,7 +619,7 @@ namespace Tango.TFS
});
}
- public Task<List<WorkItem>> GetWorkItemsForMachine(Project project, String serialNumber)
+ public Task<List<WorkItem>> GetWorkItemsForMachine(Project project, String serialNumber, DateTime startUtc, DateTime endUtc)
{
return Task.Factory.StartNew<List<WorkItem>>(() =>
{
@@ -627,7 +628,7 @@ namespace Tango.TFS
var projCollection = new TfsTeamProjectCollection(new Uri(CollectionURL), connection.Credentials);
var store = projCollection.GetService<WorkItemStore>();
- WorkItemCollection queryResults = store.Query($"Select [Id] From WorkItems Where {ExtensionFields.MACHINE_SN} = '{serialNumber}' And [Work Item Type] = 'Bug'");
+ WorkItemCollection queryResults = store.Query($"Select [Id] From WorkItems Where {ExtensionFields.MACHINE_SN} = '{serialNumber}' And [Work Item Type] = 'Bug' AND [Created Date] >= '{startUtc.ToString("MM/dd/yyyy")}' AND [Created Date] <= '{endUtc.ToString("MM/dd/yyyy")}'");
var ids = queryResults.OfType<Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem>().Where(x => x.Project.Name == project.Name).ToList().Select(x => x.Id).ToList();
if (ids.Count == 0) return new List<WorkItem>();
@@ -874,8 +875,20 @@ namespace Tango.TFS
if (item.Fields.ContainsKey(ExtensionFields.RESOLVED_REASON))
{
- workItem.ResolvedReason = ParseEnumByDescription<ResolvedReason>(item.Fields[ExtensionFields.RESOLVED_REASON].ToString());
- workItem.ResolvedDate = DateTime.Parse(item.Fields[ExtensionFields.RESOLVED_DATE].ToString());
+ try
+ {
+ workItem.ResolvedReason = ParseEnumByDescription<ResolvedReason>(item.Fields[ExtensionFields.RESOLVED_REASON].ToString());
+
+ if (item.Fields.ContainsKey(ExtensionFields.RESOLVED_DATE))
+ {
+ workItem.ResolvedDate = DateTime.Parse(item.Fields[ExtensionFields.RESOLVED_DATE].ToString());
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine($"Error parsing TFS work item resolved reason.\n{ex.ToString()}");
+ LogManager.Log(ex, "Error parsing TFS work item resolved reason.");
+ }
}
workItem.Type = (WorkItemType)Enum.Parse(typeof(WorkItemType), item.Fields[GetFieldNameForRead(CoreField.WorkItemType)].ToString());