Created
July 10, 2017 16:35
-
-
Save andrelip/1b9275df8daebc69c2fd97752a07a7fa to your computer and use it in GitHub Desktop.
This file contains hidden or 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 get_list do | |
| from(p in Pages, | |
| join: v in ViewedBook, | |
| join: r in Reader, | |
| where: p.viewed_book_id == v.id and v.profile_id == r.id, | |
| where: p.time_spent > 5, | |
| group_by: r.id, | |
| select: %{reader_id: r.id, entity_id: r.entity_id, root_id: r.root_id, time_spent: sum(p.time_spent)}) | |
| |> Repo.all | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment