1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-28 09:24:24 +01:00

(bug) unable to sync projects with openprojects

This commit is contained in:
Du Peng 2024-10-02 18:35:37 +02:00
parent b448137392
commit 77496af54a
2 changed files with 6 additions and 4 deletions

View File

@ -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

View File

@ -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)