Skip to content

Commit

Permalink
updated work item query to filter on current team project
Browse files Browse the repository at this point in the history
  • Loading branch information
kemmis committed Sep 22, 2018
1 parent bc85f95 commit c6a2d02
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public Task GetWorkItemTypesAsync(ObservableCollection<SettingItemModel> collect
var wis = Context.TeamProjectCollection.GetService<WorkItemStore>();
foreach (Project p in wis.Projects)
foreach (WorkItemType t in p.WorkItemTypes)
if (collection.All(s => s.Name != t.Name))
collection.Add(new SettingItemModel {Name = t.Name});
foreach (WorkItemType t in p.WorkItemTypes)
if (collection.All(s => s.Name != t.Name))
collection.Add(new SettingItemModel { Name = t.Name });
}
});
}
Expand All @@ -39,10 +39,10 @@ public Task GetWorkItemStatesAsync(ObservableCollection<SettingItemModel> collec
var wis = Context.TeamProjectCollection.GetService<WorkItemStore>();
foreach (Project p in wis.Projects)
foreach (WorkItemType t in p.WorkItemTypes)
foreach (string stateValue in t.FieldDefinitions["State"].AllowedValues)
if (collection.All(s => s.Name != stateValue))
collection.Add(new SettingItemModel {Name = stateValue});
foreach (WorkItemType t in p.WorkItemTypes)
foreach (string stateValue in t.FieldDefinitions["State"].AllowedValues)
if (collection.All(s => s.Name != stateValue))
collection.Add(new SettingItemModel { Name = stateValue });
}
});
}
Expand All @@ -59,16 +59,18 @@ public Task GetWorkItemsAsync(ObservableCollection<WorkItemModel> collection, Se
var statesString = "'" + string.Join("','", states) + "'";
var types = settings.WorkItemTypes.Where(w => w.Checked).Select(w => w.Name).ToArray();
var typesString = "'" + string.Join("','", types) + "'";
var teamProjectName = Context.TeamProjectName;
var queryText = $@"select * from workitems where
[Team Project] = '{teamProjectName}' and
[Changed Date] > '{sinceDate}' and
[State] in ({statesString}) and
[Assigned To]=@me and
[Work Item Type] in ({typesString})
order by [Changed Date] desc";
var workItems = wis.Query(queryText);
// clear collection so items truely get refreshed
collection.Clear();
Expand Down

0 comments on commit c6a2d02

Please sign in to comment.