Open lshoo opened 11 years ago
This is the Company object define: object Computer {
def list(page: Int = 0, pageSize: Int = 10, orderBy: Int = 1, filter: String = "*"): Page[(Computer, Option[Company])] = transactional {
val pagination =
paginatedQuery {
(c: Computer) =>
where(toUpperCase(c.name) like filter.toUpperCase) select (c) orderBy {
orderBy match {
case -2 =>
c.name desc
case -3 =>
c.introduced desc
case -4 =>
c.discontinued desc
case -5 =>
c.company.map(_.name) desc
case 2 =>
c.name
case 3 =>
c.introduced
case 4 =>
c.discontinued
case 5 =>
c.company.map(_.name)
}
}
}
val navigator = pagination.navigator(pageSize)
if (navigator.numberOfResults > 0) {
val p = navigator.page(page)
Page(p.map(c => (c, c.company)), page, page * pageSize, navigator.numberOfResults)
} else
Page(Nil, 0, 0, 0)
}
}
full code is here: https://github.com/fwbrasil/activate-example-play/blob/master/app/models/Models.scala
Hi lshoo.
Thanks for the detailed report. This is a bug due the absence of an outer join on the company that is optional. I will provide a fix in the next weeks.
Regards,
Flavio
Thanks Flavio
In the activate-example-play, the Company is the Computer nested property. I run the example, that is fine except this issue: In the http://localhost:9000/computers page, or sort by name, introduced, discontiued, e.g. http://localhost:9000/computers?s=-3&f=ab, that is ok.
but when sort by company http://localhost:9000/computers?s=5&f=ab, the problem happen: This is an issue?