mirror of
				https://github.com/gitbucket/gitbucket.git
				synced 2025-11-03 20:15:59 +01:00 
			
		
		
		
	MilestonesService provides a method which returns milestones with issue count.
This commit is contained in:
		@@ -61,8 +61,8 @@ trait MilestonesService {
 | 
			
		||||
      .sortBy(_.milestoneId desc)
 | 
			
		||||
      .firstOption
 | 
			
		||||
 | 
			
		||||
  def getMilestoneIssueCounts(owner: String, repository: String): Map[(Int, Boolean), Int] =
 | 
			
		||||
    Issues
 | 
			
		||||
  def getMilestonesWithIssueCount(owner: String, repository: String): List[(Milestone, Int, Int)] = {
 | 
			
		||||
    val counts = Issues
 | 
			
		||||
      .filter { t =>
 | 
			
		||||
        (t.userName       is owner.bind) &&
 | 
			
		||||
        (t.repositoryName is repository.bind) &&
 | 
			
		||||
@@ -80,6 +80,11 @@ trait MilestonesService {
 | 
			
		||||
      }
 | 
			
		||||
      .toMap
 | 
			
		||||
 | 
			
		||||
    getMilestones(owner, repository).map { milestone =>
 | 
			
		||||
      (milestone, counts.getOrElse((milestone.milestoneId, false), 0), counts.getOrElse((milestone.milestoneId, true), 0))
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  def getMilestones(owner: String, repository: String): List[Milestone] =
 | 
			
		||||
    Query(Milestones)
 | 
			
		||||
      .filter { t =>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user