Skip to content

Commit

Permalink
Do not request users when ther are no UUIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
khy committed Feb 8, 2017
1 parent f3f36d6 commit cc57c65
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions modules/apis/workouts/app/services/WorkoutsService.scala
Expand Up @@ -30,10 +30,14 @@ class WorkoutsService(
Seq(record.createdByAccount) ++ record.deletedByAccount.toSeq
}

val futUsers = accountClient.findAccounts(guids = userGuids).map { accounts =>
accounts.flatMap {
case user: User => Some(user)
case _ => None
val futUsers = if (userGuids.isEmpty) {
Future.successful(Nil)
} else {
accountClient.findAccounts(guids = userGuids).map { accounts =>
accounts.flatMap {
case user: User => Some(user)
case _ => None
}
}
}

Expand Down

0 comments on commit cc57c65

Please sign in to comment.