mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 06:25:51 +01:00
refactoring. avoid Option#get
This commit is contained in:
@@ -9,13 +9,10 @@ trait PullRequestService { self: IssuesService =>
|
|||||||
import PullRequestService._
|
import PullRequestService._
|
||||||
|
|
||||||
def getPullRequest(owner: String, repository: String, issueId: Int): Option[(Issue, PullRequest)] =
|
def getPullRequest(owner: String, repository: String, issueId: Int): Option[(Issue, PullRequest)] =
|
||||||
defining(getIssue(owner, repository, issueId.toString)){ issue =>
|
getIssue(owner, repository, issueId.toString).flatMap{ issue =>
|
||||||
if(issue.isDefined){
|
Query(PullRequests).filter(_.byPrimaryKey(owner, repository, issueId)).firstOption.map{
|
||||||
Query(PullRequests).filter(_.byPrimaryKey(owner, repository, issueId)).firstOption match {
|
pullreq => (issue, pullreq)
|
||||||
case Some(pullreq) => Some((issue.get, pullreq))
|
|
||||||
case None => None
|
|
||||||
}
|
}
|
||||||
} else None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def getPullRequestCountGroupByUser(closed: Boolean, owner: String, repository: Option[String]): List[PullRequestCount] =
|
def getPullRequestCountGroupByUser(closed: Boolean, owner: String, repository: Option[String]): List[PullRequestCount] =
|
||||||
|
|||||||
Reference in New Issue
Block a user