Advertisement
Guest User

Untitled

a guest
Mar 4th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 1.40 KB | None | 0 0
  1. /**
  2.    * Find all groups with the count of their posts.
  3.    *
  4.    * @return List[GroupLink]
  5.    */
  6.   def findGroupLinks() = {
  7.     DB withSession { implicit session =>
  8.       val q = (for {
  9.         groups <- slickGroups
  10.         posts <- slickPosts if groups.id === posts.groupId
  11.       } yield (groups.title, posts)).groupBy(_._1.title)
  12.  
  13.       q.map {
  14.         case (groupTitle, groupPosts) => GroupLink(groupTitle, groupPosts.length)
  15.       }.list
  16.     }
  17.   }
  18.  
  19. [error] /Users/arturgajewski/workspace/scala/cobase-pro/app/models/daos/GroupDAO.scala:41: type mismatch;
  20. [error]  found   : scala.slick.lifted.Column[String]
  21. [error]  required: String
  22. [error]         case (groupTitle, groupPosts) => GroupLink(groupTitle, groupPosts.length)
  23. [error]                                                    ^
  24. [error] /Users/arturgajewski/workspace/scala/cobase-pro/app/models/daos/GroupDAO.scala:41: type mismatch;
  25. [error]  found   : scala.slick.lifted.Column[Int]
  26. [error]  required: Int
  27. [error]         case (groupTitle, groupPosts) => GroupLink(groupTitle, groupPosts.length)
  28. [error]                                                                           ^
  29. [error] /Users/arturgajewski/workspace/scala/cobase-pro/app/models/services/GroupService.scala:23: type mismatch;
  30. [error]  found   : List[Unit]
  31. [error]  required: List[models.GroupLink]
  32. [error]   def findGroupLinks(): List[GroupLink] = groupDAO.findGroupLinks()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement