Skip to content

Commit

Permalink
fix setting HasBeenPublic in cleanup command
Browse files Browse the repository at this point in the history
  • Loading branch information
nics committed Jan 22, 2024
1 parent e2973fa commit 295808f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

## [v1.0.51] - 2024-01-22

### Added

### Fixed

- Fix bug in cleanup command

## [v1.0.50] - 2024-01-22

### Added
Expand Down Expand Up @@ -530,7 +538,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial release

[unreleased]: https://github.com/ugent-library/biblio-backoffice/compare/v1.0.50...HEAD
[unreleased]: https://github.com/ugent-library/biblio-backoffice/compare/v1.0.51...HEAD
[v1.0.51]: https://github.com/ugent-library/biblio-backoffice/compare/v1.0.50...v1.0.51
[v1.0.50]: https://github.com/ugent-library/biblio-backoffice/compare/v1.0.49...v1.0.50
[v1.0.49]: https://github.com/ugent-library/biblio-backoffice/compare/v1.0.48...v1.0.49
[v1.0.48]: https://github.com/ugent-library/biblio-backoffice/compare/v1.0.47...v1.0.48
Expand Down
2 changes: 1 addition & 1 deletion server/dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ func (s *server) CleanupDatasets(req *api.CleanupDatasetsRequest, stream api.Bib
fixed := false

// correctly set HasBeenPublic (only needs to run once)
if d.Status == "deleted" && !d.HasBeenPublic {
if !d.HasBeenPublic {
s.services.Repo.DatasetHistory(d.ID, func(dd *models.Dataset) bool {
if dd.Status == "public" {
d.HasBeenPublic = true
Expand Down
20 changes: 10 additions & 10 deletions server/publication.go
Original file line number Diff line number Diff line change
Expand Up @@ -920,16 +920,16 @@ func (s *server) CleanupPublications(req *api.CleanupPublicationsRequest, stream
}

// correctly set HasBeenPublic (only needs to run once)
// if p.Status == "deleted" && !p.HasBeenPublic {
// s.services.Repo.PublicationHistory(p.ID, func(pp *models.Publication) bool {
// if pp.Status == "public" {
// p.HasBeenPublic = true
// fixed = true
// return false
// }
// return true
// })
// }
if !p.HasBeenPublic {
s.services.Repo.PublicationHistory(p.ID, func(pp *models.Publication) bool {
if pp.Status == "public" {
p.HasBeenPublic = true
fixed = true
return false
}
return true
})
}

// remove empty links (only needs to run once)
// for _, l := range p.Link {
Expand Down

0 comments on commit 295808f

Please sign in to comment.