Created
August 5, 2015 17:30
-
-
Save dhoss/6aece47aeec33f6ddafc to your computer and use it in GitHub Desktop.
got: scala.concurrent.Future[List[List[models.Commit]]] want: scala.concurrent.Future[List[models.Commit]]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def crawlProjectRepos(project: String) = { | |
Logger.info("crawling " + project + " by API") | |
// a list of Futures containing a Tuple2 of a repository name and a Future[WSResponse] | |
val repoList = reposFor(project).map { repo => | |
(repo, callApi(buildCommitUrl(project, repo))) | |
} | |
Future.traverse(repoList) ( | |
repoCommits => | |
repoCommits._2.filter(_.status==200).map { res => | |
(res.json \ "values").as[List[JsValue]].map { c => | |
Commit(0, | |
(c \ "id").as[String], | |
(c \ "message").as[String], | |
(c \ "author" \ "name").as[String], | |
(c \ "author" \ "emailAddress").as[String], | |
(c \ "authorTimestamp").as[Option[DateTime]](Reads.optionWithNull(jodaDateReads("yyyy-MM-dd'T'HH:mm:ss'Z"))), | |
repoCommits._1, | |
Option(new DateTime), | |
Option(new DateTime) | |
)} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment