Esempio n. 1
0
        /// <summary>
        /// Populates the milestone tableo to be equivalent to the current set of milestones on GitHub.
        /// </summary>
        public async Task PopulateMilestones(RoachRepoId repoId, CancellationToken cancellationtoken = default(CancellationToken))
        {
            var milestones = await _storageQueryUtil.GetMilestones(repoId, RoachItemFilter.All, cancellationtoken);

            var map = milestones.ToDictionary(x => x.Number);

            var list = new List <RoachMilestoneEntity>();

            foreach (var milestone in await _githubQueryUtil.GetMilestones(repoId))
            {
                var isOpen = milestone.State == ItemState.Open;

                RoachMilestone r;
                if (!map.TryGetValue(milestone.Number, out r) ||
                    r.Title != milestone.Title ||
                    r.IsOpen != isOpen)
                {
                    r = new RoachMilestone(repoId, milestone.Number, milestone.Title, isOpen);
                    list.Add(new RoachMilestoneEntity(r));
                }
            }

            if (list.Count > 0)
            {
                // TODO: Need to thread through the CancellationToken here.
                await AzureUtil.InsertBatchUnordered(_milestoneTable, list);
            }
        }
Esempio n. 2
0
        public async Task <List <Issue> > GetIssuesInMilestone(RoachMilestone milestone)
        {
            var request = new RepositoryIssueRequest();

            request.Milestone = $"{milestone.Number}";
            return(await GetIssues(milestone.RepoId, request));
        }
Esempio n. 3
0
 public RoachMilestoneEntity(RoachMilestone milestone)
 {
     PartitionKey = GetPartitionKey(milestone.RepoId);
     RowKey       = GetRowKey(milestone);
     Number       = milestone.Number;
     Title        = milestone.Title;
     IsOpen       = milestone.IsOpen;
 }
Esempio n. 4
0
 public static string GetRowKey(RoachMilestone milestone) => milestone.Number.ToString();