Skip to content

Commit

Permalink
Fix failing test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewgdewar committed Oct 19, 2023
1 parent 11ef10b commit 1da5d1b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkg/dao/snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,9 @@ func (sDao snapshotDaoImpl) List(orgID string, repoConfigUuid string, pagination
var snaps []models.Snapshot
var totalSnaps int64
var repoConfig models.RepositoryConfiguration
filteredDB := sDao.db.
Model(&models.Snapshot{}).
Joins("JOIN repository_configurations ON repository_configuration_uuid = repository_configurations.uuid").
Where("repository_configurations.org_id = ?", orgID).
Where("repository_configuration_uuid = ?", UuidifyString(repoConfigUuid))

// First check if repo config exists
result := filteredDB.First(&repoConfig)
result := sDao.db.Where("uuid = ?", UuidifyString(repoConfigUuid)).First(&repoConfig)
if result.Error != nil {
if result.Error == gorm.ErrRecordNotFound {
return api.SnapshotCollectionResponse{}, totalSnaps, &ce.DaoError{
Expand All @@ -75,6 +70,12 @@ func (sDao snapshotDaoImpl) List(orgID string, repoConfigUuid string, pagination

order := convertSortByToSQL(paginationData.SortBy, sortMap, "created_at asc")

filteredDB := sDao.db.
Model(&models.Snapshot{}).
Joins("JOIN repository_configurations ON repository_configuration_uuid = repository_configurations.uuid").
Where("repository_configurations.org_id = ?", orgID).
Where("repository_configuration_uuid = ?", UuidifyString(repoConfigUuid))

// Get count
filteredDB.Count(&totalSnaps)

Expand Down

0 comments on commit 1da5d1b

Please sign in to comment.