Example #1
0
 public static string GetPartitionKey(RoachRepoId repoId) => EntityKeyUtil.ToKey(repoId);
Example #2
0
        /// <summary>
        /// Get all issues in the specified label which don't have an assignee and / or a milestone.
        /// </summary>
        public async Task <List <RoachIssue> > GetTriageIssues(RoachRepoId repoId, string label, CancellationToken cancellationToken)
        {
            var unassignedFilter = TableQuery.CombineFilters(
                TableQuery.GenerateFilterCondition(nameof(TableEntity.PartitionKey), QueryComparisons.Equal, EntityKeyUtil.ToKey(repoId)),
                TableOperators.And,
                TableQuery.GenerateFilterCondition(nameof(RoachIssueEntity.Assignee), QueryComparisons.Equal, TheBugsConstants.UnassignedName));
            var unassignedList = await AzureUtil.QueryAsync(_issueTable, new TableQuery <RoachIssueEntity>().Where(unassignedFilter), cancellationToken);

            var unknownMilestoneFilter = TableQuery.CombineFilters(
                TableQuery.GenerateFilterCondition(nameof(TableEntity.PartitionKey), QueryComparisons.Equal, EntityKeyUtil.ToKey(repoId)),
                TableOperators.And,
                TableQuery.GenerateFilterConditionForInt(nameof(RoachIssueEntity.MilestoneNumber), QueryComparisons.Equal, RoachMilestoneId.NoneNumber));
            var unknownMilestoneList = await AzureUtil.QueryAsync(_issueTable, new TableQuery <RoachIssueEntity>().Where(unknownMilestoneFilter), cancellationToken);

            var list    = new List <RoachIssue>();
            var hashSet = new HashSet <int>();

            foreach (var entity in unassignedList.Concat(unknownMilestoneList))
            {
                if (hashSet.Add(entity.Number) && entity.Labels.Contains(label) && entity.IssueType == IssueType.Issue)
                {
                    list.Add(entity.Issue);
                }
            }

            return(list);
        }