blob: 923f2ed5483aed0c5dd91fe80cb138aeba788832 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package reading.models
case class Book(
title: String,
author: String,
year: String,
parts: Int = 1,
period: Option[Period],
genres: Seq[Genre],
themes: Seq[Theme],
programs: Seq[Program],
level: Level,
resume: Option[String] = None
) extends Ordered[Book] {
def compare(that: Book) =
Compare.format(this.title).compare(Compare.format(that.title))
}
object Book {
def filter(books: Seq[Book], search: String = ""): Seq[Book] =
books.filter { book =>
(Search(book.title, search)
|| Search(book.author, search))
}
}
|