Skip to content

Commit

Permalink
#2494 Update Spring Boot to 3.1.6, fix querying to handle null errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dwalizer committed Dec 8, 2023
1 parent 509df30 commit c79f192
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<guava.version>29.0-jre</guava.version>

<!-- !!!!!IMPORTANT!!!!!: when changing the springboot.version property, make sure you also change it in the spring-boot-starter-parent definition -->
<springboot.version>3.1.4</springboot.version>
<springboot.version>3.1.6</springboot.version>

<greenmail.version>2.0.0</greenmail.version>
<wiremock.version>2.27.2</wiremock.version>
Expand All @@ -52,7 +52,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<!-- !!!!!IMPORTANT!!!!!: when changing this version make sure to also update springboot.version property -->
<version>3.1.4</version>
<version>3.1.6</version>
<relativePath/>
</parent>

Expand Down
1 change: 1 addition & 0 deletions service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@
<licenseMerge>The Apache Software License, Version 2.0|Apache License, Version 2.0</licenseMerge>
<licenseMerge>The Apache Software License, Version 2.0|Apache Public License 2.0</licenseMerge>
<licenseMerge>The Apache Software License, Version 2.0|Apache 2.0</licenseMerge>
<licenseMerge>The Apache Software License, Version 2.0|Apache-2.0</licenseMerge>
<licenseMerge>The Apache Software License, Version 2.0|Apache 2</licenseMerge>
<licenseMerge>The Apache Software License, Version 2.0|The Apache License, Version 2.0</licenseMerge>
<licenseMerge>The Apache Software License, Version 2.0|Apache License, version 2.0</licenseMerge>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ class UserActionsHistoryService {
String quizFilter,
String itemIdFilter,
DashboardAction actionFilter) {
String projectIdFilterQuery = projectIdFilter ? '%' + projectIdFilter.toLowerCase() + '%' : null
String userFilterQuery = userFilter ? '%' + userFilter.toLowerCase() + '%' : null
String quizFilterQuery = quizFilter ? '%' + quizFilter.toLowerCase() + '%' : null
String itemIdFilterQuery = itemIdFilter ? '%' + itemIdFilter.toLowerCase() + '%' : null
Page<UserActionsHistoryRepo.UserActionsPreview> userActionsPreviewFromDB = userActionsHistoryRepo.getActions(
projectIdFilter, itemFilter, userFilter, quizFilter, itemIdFilter, actionFilter, pageRequest)
projectIdFilterQuery, itemFilter, userFilterQuery, quizFilterQuery, itemIdFilterQuery, actionFilter, pageRequest)
Long totalRows = userActionsPreviewFromDB.getTotalElements()
List<DashboardUserActionRes> actionResList = userActionsPreviewFromDB.getContent().collect {
new DashboardUserActionRes(
Expand Down Expand Up @@ -146,8 +150,10 @@ class UserActionsHistoryService {
}

DashboardUserActionsFilterOptions getUserActionsFilterOptions(String projectId = null, String quizId = null) {
List<DashboardAction> dashboardActions = userActionsHistoryRepo.findDistinctDashboardActions(projectId, quizId)
List<DashboardItem> dashboardItems = userActionsHistoryRepo.findDistinctDashboardItems(projectId, quizId)
String projectIdFilter = projectId ? projectId.toLowerCase() : null
String quizIdFilter = quizId ? quizId.toLowerCase() : null
List<DashboardAction> dashboardActions = userActionsHistoryRepo.findDistinctDashboardActions(projectIdFilter, quizIdFilter)
List<DashboardItem> dashboardItems = userActionsHistoryRepo.findDistinctDashboardItems(projectIdFilter, quizIdFilter)

return new DashboardUserActionsFilterOptions(
actionFilterOptions: dashboardActions.collect { it.toString() },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ interface UserActionsHistoryRepo extends CrudRepository<UserActionsHistory, Long
userAttrs.lastName as lastName
from UserActionsHistory action, UserAttrs userAttrs
where action.userId = userAttrs.userId
and (:projectIdFilter is null OR lower(action.projectId) like lower(concat('%', :projectIdFilter, '%')))
and (:projectIdFilter is null OR lower(action.projectId) like :projectIdFilter)
and (:itemFilter is null OR action.item = :itemFilter)
and (:userFilter is null OR (
lower(userAttrs.userIdForDisplay) like lower(concat('%', :userFilter, '%'))) OR
((lower(CONCAT(userAttrs.firstName, ' ', userAttrs.lastName, ' (', userAttrs.userIdForDisplay, ')')) like lower(CONCAT('%', :userFilter, '%'))) OR
(lower(CONCAT(userAttrs.userIdForDisplay, ' (', userAttrs.lastName, ', ', userAttrs.firstName, ')')) like lower(CONCAT('%', :userFilter, '%'))) )
lower(userAttrs.userIdForDisplay) like :userFilter) OR
((lower(CONCAT(userAttrs.firstName, ' ', userAttrs.lastName, ' (', userAttrs.userIdForDisplay, ')')) like :userFilter) OR
(lower(CONCAT(userAttrs.userIdForDisplay, ' (', userAttrs.lastName, ', ', userAttrs.firstName, ')')) like :userFilter))
)
and (:quizFilter is null OR lower(action.quizId) like lower(concat('%', :quizFilter, '%')))
and (:itemIdFilter is null OR lower(action.itemId) like lower(concat('%', :itemIdFilter, '%')))
and (:quizFilter is null OR lower(action.quizId) like :quizFilter)
and (:itemIdFilter is null OR lower(action.itemId) like :itemIdFilter)
and (:actionFilter is null OR action.action = :actionFilter)
''')
Page<UserActionsPreview> getActions(@Nullable @Param("projectIdFilter") String projectIdFilter,
Expand All @@ -80,17 +80,17 @@ interface UserActionsHistoryRepo extends CrudRepository<UserActionsHistory, Long
@Nullable
@Query('''select distinct action.action
from UserActionsHistory action
where (:projectId is null OR lower(action.projectId) = lower(:projectId))
and (:quizId is null OR lower(action.quizId) = lower(:quizId))
where (:projectId is null OR lower(action.projectId) = :projectId)
and (:quizId is null OR lower(action.quizId) = :quizId)
''')
List<DashboardAction> findDistinctDashboardActions(@Nullable @Param("projectId") String projectId,
@Nullable @Param("quizId") String quizId)

@Nullable
@Query('''select distinct action.item
from UserActionsHistory action
where (:projectId is null OR lower(action.projectId) = lower(:projectId))
and (:quizId is null OR lower(action.quizId) = lower(:quizId))
where (:projectId is null OR lower(action.projectId) = :projectId)
and (:quizId is null OR lower(action.quizId) = :quizId)
''')
List<DashboardItem> findDistinctDashboardItems(@Nullable @Param("projectId") String projectId,
@Nullable @Param("quizId") String quizId)
Expand Down

0 comments on commit c79f192

Please sign in to comment.