Skip to content

Instantly share code, notes, and snippets.

@kyu999
Created November 23, 2014 08:38
Show Gist options
  • Save kyu999/006e1e158b88f64847ea to your computer and use it in GitHub Desktop.
Save kyu999/006e1e158b88f64847ea to your computer and use it in GitHub Desktop.
def findWeeklyContents(page: Int = 1, amount: Int = 8): List[LightContent] = {
toLightContents(coll.find("date" $gt get_last_week()).take(amount))
}
def findMonthlyContents(page: Int = 1, amount: Int = 8): List[LightContent]
= toLightContents(coll.find("date" $gt get_last_month()).take(amount))
def findWeeklyPopularContents(page: Int = 1, amount: Int = 8): List[LightContent]
= toLightContents(coll.find("date" $gt get_last_week()).sort(DBObject("views" -> -1)))
def findMonthlyPopularContents(page: Int = 1, amount: Int = 8): List[LightContent]
= toLightContents(coll.find("date" $gt get_last_month()).sort(DBObject("views" -> -1)).take(amount))
// manga
def findRecentMangas(page: Int = 1, amount: Int = 12): List[LightContent] = {
val (start, end) = pageToIndex(page)
toLightContents(coll.find("date" $gt get_last_month()).sort(DBObject("date" -> -1)).slice(start, end).take(amount))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment