@@ -85,7 +85,7 @@ class GithubClient(token: Secret)(implicit val system: ActorSystem)
85
85
contributors <- getContributors(repo.ref)
86
86
openIssues <- getOpenIssues(repo.ref)
87
87
chatroom <- getGitterChatRoom(repo.ref)
88
- scalaPercentage <- getPercentageOfLanguage(repo.ref, language = " Scala" )
88
+ (scalaLines, scalaPercentage) <- getPercentageOfLanguage(repo.ref, language = " Scala" )
89
89
} yield GithubInfo (
90
90
homepage = repo.homepage.map(Url ),
91
91
description = repo.description,
@@ -103,7 +103,8 @@ class GithubClient(token: Secret)(implicit val system: ActorSystem)
103
103
codeOfConduct = communityProfile.flatMap(_.codeOfConductFile).map(Url ),
104
104
chatroom = chatroom.map(Url ),
105
105
openIssues = openIssues.map(_.toGithubIssue).toList,
106
- scalaPercentage = Option (scalaPercentage)
106
+ scalaPercentage = Option (scalaPercentage),
107
+ scalaLines = scalaLines
107
108
)
108
109
109
110
def getReadme (ref : Project .Reference ): Future [Option [String ]] = {
@@ -191,14 +192,15 @@ class GithubClient(token: Secret)(implicit val system: ActorSystem)
191
192
.fallbackTo(Future .successful(Seq .empty))
192
193
}
193
194
194
- def getPercentageOfLanguage (ref : Project .Reference , language : String ): Future [Int ] = {
195
+ def getPercentageOfLanguage (ref : Project .Reference , language : String ): Future [( Option [ Int ], Int ) ] = {
195
196
def toPercentage (portion : Int , total : Int ): Int =
196
197
((portion.toFloat / total) * 100 ).toInt
197
198
val request =
198
199
HttpRequest (uri = s " ${repoUrl(ref)}/languages " ).addHeader(acceptJson).addCredentials(credentials)
199
200
get[Map [String , Int ]](request).map { response =>
200
201
val totalNumBytes = response.values.sum
201
- response.get(language).fold(0 )(toPercentage(_, totalNumBytes))
202
+ val lines = response.get(language)
203
+ (lines, lines.fold(0 )(toPercentage(_, totalNumBytes)))
202
204
}
203
205
}
204
206
0 commit comments