Commit df82381f authored by Anton Sudak's avatar Anton Sudak

Fix displaying reviews in admin panel

parent b1d53973
......@@ -45,14 +45,14 @@ import java.util.*;
@NamedQuery(
name = "ReviewSubmission.byUserKeywords",
query = "SELECT DISTINCT s FROM ReviewSubmission s INNER JOIN ReviewBlock b ON s.review.id = b.id WHERE "
+ "(s.id = :term OR b.id = :term OR b.targetId = :term OR s.email LIKE :term) "
+ "(s.id LIKE :term OR b.id LIKE :term OR b.targetId LIKE :term OR s.email LIKE :term) "
+ "ORDER BY s.isApproved ASC, s.createdOn DESC"
),
@NamedQuery(
name = "ReviewSubmission.byUserKeywords.count",
query = "SELECT COUNT(s) FROM ReviewSubmission s WHERE s in ("
+ "SELECT s FROM ReviewSubmission s INNER JOIN ReviewBlock b ON s.review.id = b.id WHERE "
+ "(s.id = :term OR b.id = :term OR b.targetId = :term OR s.email LIKE :term))"
+ "(s.id LIKE :term OR b.id LIKE :term OR b.targetId LIKE :term OR s.email LIKE :term))"
),
@NamedQuery(
name = "ReviewSubmission.byReviewAndApprovedSortedByRating",
......@@ -338,13 +338,13 @@ public class ReviewSubmission extends Model implements WithSchemaorgStructuredDa
private TypedQuery<T> byUserKeywordsResult(String term) {
return jpaApi.em().createNamedQuery("ReviewSubmission.byUserKeywords", getEntityClass())
.setParameter("term", term.trim());
.setParameter("term", "%" + term.trim() + "%");
}
private Long byUserKeywordsCount(String term) {
try {
return jpaApi.em().createNamedQuery("ReviewSubmission.byUserKeywords.count", Long.class)
.setParameter("term", term.trim())
.setParameter("term", "%" + term.trim() + "%")
.getSingleResult();
} catch (NoResultException e) {
return 0L;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment