Skip to content

Commit 788dc5e

Browse files
committed
wip: adding latest check in chart search query
1 parent 9defaea commit 788dc5e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/appStore/discover/repository/AppStoreApplicationVersionRepository.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,10 @@ func (impl *AppStoreApplicationVersionRepositoryImpl) SearchAppStoreChartByName(
257257
" inner join app_store aps on asv.app_store_id = aps.id" +
258258
" left join chart_repo chr on aps.chart_repo_id = chr.id" +
259259
" left join docker_artifact_store das on aps.docker_artifact_store_id = das.id" +
260-
" where aps.name like '%" + chartName + "%' and asv.id = (SELECT MAX(id) FROM app_store_application_version WHERE app_store_id = asv.app_store_id) and aps.active=true order by aps.name asc;"
260+
" where aps.name like '%" +
261+
chartName + "%' and" +
262+
" ( ( aps.docker_artifact_store_id is NOT NULL and asv.id = (SELECT MAX(id) FROM app_store_application_version WHERE app_store_id = asv.app_store_id)) or (aps.chart_repo_id is NOT NULL and asv.created = (SELECT MAX(created) FROM app_store_application_version WHERE app_store_id = asv.app_store_id)) ) " +
263+
"and aps.active=true order by aps.name asc;"
261264
_, err := impl.dbConnection.Query(&chartRepos, queryTemp)
262265
if err != nil {
263266
return nil, err

0 commit comments

Comments
 (0)