Skip to content

Commit

Permalink
(bug) unable to sync projects with openprojects
Browse files Browse the repository at this point in the history
  • Loading branch information
gnepud committed Oct 2, 2024
1 parent b448137 commit 77496af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## Next release

- Fix a bug: unable to reset OpenApi token
- Fix a bug: unable to sync projects with openprojects
- [TODO DEPLOY] `rails fablab:openlab:bulk_export`
- [TODO DEPLOY] `rails fablab:openlab:bulk_update`

## v6.3.32 2024 July 22

Expand Down
7 changes: 3 additions & 4 deletions app/models/concerns/openlab_sync.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@ module OpenlabSync
extend ActiveSupport::Concern

included do
after_create :openlab_create, if: :openlab_sync_active?
after_update :openlab_update, if: :openlab_sync_active?
after_save :openlab_create_or_update, if: :openlab_sync_active?
after_destroy :openlab_destroy, if: :openlab_sync_active?

def openlab_create
OpenlabWorker.perform_in(2.seconds, :create, id) if published?
end

def openlab_update
def openlab_create_or_update
return unless published?

if state_was == 'draft'
if state_was == 'draft' || state_was.nil?
OpenlabWorker.perform_async(:create, id)
else
OpenlabWorker.perform_async(:update, id)
Expand Down

0 comments on commit 77496af

Please sign in to comment.