Commit c3837704 authored by oleg.pahhomov's avatar oleg.pahhomov
Browse files

SA0140-537 | do not display duplicate widgets

parent f1210959
......@@ -8,7 +8,7 @@ import java.util.Optional;
public interface UserWidgetRepository extends JpaRepository<UserWidget, Long> {
List<UserWidget> findAllByAppUserAndDashboardAndSelectedOrderByOrderNrAsc(Long user, Long dashboard, boolean selected);
List<UserWidget> findDistinctByAppUserAndDashboardAndSelectedOrderByOrderNrAsc(Long user, Long dashboard, boolean selected);
List<UserWidget> findAllByDashboard(Long dashboard);
......@@ -56,7 +56,7 @@ public class WidgetCustomRepositoryImpl implements WidgetCustomRepository {
public List<Widget> findWidgetByMyDashboard(Long dashboard) {
return entityManager.createNativeQuery("" +
"SELECT w.* from widget w\n" +
"SELECT distinct w.* from widget w\n" +
"join dashboard_widget dw on = dw.widget\n" +
"where dw.dashboard = :dashboard \n", Widget.class)
.setParameter("dashboard", dashboard)
......@@ -17,7 +17,7 @@ public class UserWidgetService {
private UserWidgetRepository userWidgetRepository;
public List<Long> getSelectedWidgets(Dashboard dashboard, StatUser user) {
return userWidgetRepository.findAllByAppUserAndDashboardAndSelectedOrderByOrderNrAsc(user.getId(), dashboard.getId(), true)
return userWidgetRepository.findDistinctByAppUserAndDashboardAndSelectedOrderByOrderNrAsc(user.getId(), dashboard.getId(), true)
Supports Markdown
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