mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 15:05:50 +01:00
Small fix for MilestonesService.
This commit is contained in:
@@ -45,22 +45,16 @@ trait MilestonesService {
|
|||||||
.sortBy(_.milestoneId desc)
|
.sortBy(_.milestoneId desc)
|
||||||
.firstOption
|
.firstOption
|
||||||
|
|
||||||
def getMilestoneIssueCounts(owner: String, repository: String): Map[(Int, Boolean), Int] = {
|
def getMilestoneIssueCounts(owner: String, repository: String): Map[(Int, Boolean), Int] =
|
||||||
import scala.slick.jdbc.GetResult
|
|
||||||
|
|
||||||
case class IssueCount(milestoneId: Int, closed: Boolean, count: Int)
|
|
||||||
implicit val getIssueCount = GetResult(r => IssueCount(r.<<, r.<<, r.<<))
|
|
||||||
|
|
||||||
sql"""
|
sql"""
|
||||||
select MILESTONE_ID, CLOSED, COUNT(ISSUE_ID)
|
select MILESTONE_ID, CLOSED, COUNT(ISSUE_ID)
|
||||||
from ISSUE
|
from ISSUE
|
||||||
where USER_NAME = $owner AND REPOSITORY_NAME = $repository AND MILESTONE_ID IS NOT NULL
|
where USER_NAME = $owner AND REPOSITORY_NAME = $repository AND MILESTONE_ID IS NOT NULL
|
||||||
group by USER_NAME, REPOSITORY_NAME, MILESTONE_ID, CLOSED"""
|
group by USER_NAME, REPOSITORY_NAME, MILESTONE_ID, CLOSED"""
|
||||||
.as[IssueCount]
|
.as[(Int, Boolean, Int)]
|
||||||
.list
|
.list
|
||||||
.map { x => (x.milestoneId, x.closed) -> x.count }
|
.map { case (milestoneId, closed, count) => (milestoneId, closed) -> count }
|
||||||
.toMap
|
.toMap
|
||||||
}
|
|
||||||
|
|
||||||
def getMilestones(owner: String, repository: String): List[Milestone] =
|
def getMilestones(owner: String, repository: String): List[Milestone] =
|
||||||
Query(Milestones)
|
Query(Milestones)
|
||||||
|
|||||||
Reference in New Issue
Block a user