Resolve length issue in Slick.

https://github.com/slick/slick/issues/170
This commit is contained in:
takezoe
2013-10-09 03:11:27 +09:00
parent fe23a5c6da
commit 72b25591a5
2 changed files with 4 additions and 11 deletions

View File

@@ -49,12 +49,8 @@ trait IssuesService {
* @return the count of the search result * @return the count of the search result
*/ */
def countIssue(condition: IssueSearchCondition, filterUser: Map[String, String], onlyPullRequest: Boolean, def countIssue(condition: IssueSearchCondition, filterUser: Map[String, String], onlyPullRequest: Boolean,
repos: (String, String)*): Int = { repos: (String, String)*): Int =
// TODO It must be _.length instead of map (_.issueId) list).length. Query(searchIssueQuery(repos, condition, filterUser, onlyPullRequest).length).first
// But it does not work on Slick 1.0.1 (worked on Slick 1.0.0).
// https://github.com/slick/slick/issues/170
(searchIssueQuery(repos, condition, filterUser, onlyPullRequest) map (_.issueId) list).length
}
/** /**
* Returns the Map which contains issue count for each labels. * Returns the Map which contains issue count for each labels.
* *

View File

@@ -201,13 +201,10 @@ trait RepositoryService { self: AccountService =>
} }
} }
// TODO It must be _.length instead of map (_.issueId) list).length.
// But it does not work on Slick 1.0.1 (worked on Slick 1.0.0).
// https://github.com/slick/slick/issues/170
private def getForkedCount(userName: String, repositoryName: String): Int = private def getForkedCount(userName: String, repositoryName: String): Int =
Query(Repositories).filter { t => Query(Repositories.filter { t =>
(t.originUserName is userName.bind) && (t.originRepositoryName is repositoryName.bind) (t.originUserName is userName.bind) && (t.originRepositoryName is repositoryName.bind)
}.list.length }.length).first
def getForkedRepositories(userName: String, repositoryName: String): List[String] = def getForkedRepositories(userName: String, repositoryName: String): List[String] =