mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-26 20:54:21 +01:00
Merge branch 'dev' for release 6.3.41
This commit is contained in:
commit
6cc8f97e12
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
## Next release
|
## Next release
|
||||||
|
|
||||||
|
## v6.3.41 2025 February 26
|
||||||
|
|
||||||
|
- 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.40 2025 February 24
|
## v6.3.40 2025 February 24
|
||||||
|
|
||||||
- Fix a bug: machine reservation time in my reservations is incorrect
|
- Fix a bug: machine reservation time in my reservations is incorrect
|
||||||
|
@ -1,25 +1,29 @@
|
|||||||
# frozen_string_literal: false
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# module definition
|
# Module for synchronizing objects with OpenLab platform
|
||||||
module OpenlabSync
|
module OpenlabSync
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
after_save :openlab_create_or_update, if: :openlab_sync_active?
|
after_save :openlab_sync_after_save, if: :should_sync_with_openlab?
|
||||||
after_destroy :openlab_destroy, if: :openlab_sync_active?
|
after_destroy :openlab_destroy, if: :should_sync_with_openlab?
|
||||||
|
|
||||||
def openlab_create
|
def openlab_sync_after_save
|
||||||
OpenlabWorker.perform_in(2.seconds, :create, id) if published?
|
if saved_change_to_state? && published?
|
||||||
|
# New publication - create in OpenLab
|
||||||
|
openlab_create
|
||||||
|
elsif published?
|
||||||
|
# Update existing publication
|
||||||
|
openlab_update
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def openlab_create_or_update
|
def openlab_create
|
||||||
return unless published?
|
OpenlabWorker.perform_async(:create, id)
|
||||||
|
end
|
||||||
|
|
||||||
if state_was == 'draft' || state_was.nil?
|
def openlab_update
|
||||||
OpenlabWorker.perform_async(:create, id)
|
OpenlabWorker.perform_async(:update, id)
|
||||||
else
|
|
||||||
OpenlabWorker.perform_async(:update, id)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def openlab_destroy
|
def openlab_destroy
|
||||||
@ -30,6 +34,11 @@ module OpenlabSync
|
|||||||
OpenLabService.to_hash(self)
|
OpenLabService.to_hash(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Determines if the object should be synced with OpenLab
|
||||||
|
def should_sync_with_openlab?
|
||||||
|
openlab_sync_active? && published?
|
||||||
|
end
|
||||||
|
|
||||||
def openlab_sync_active?
|
def openlab_sync_active?
|
||||||
self.class.openlab_sync_active?
|
self.class.openlab_sync_active?
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "fab-manager",
|
"name": "fab-manager",
|
||||||
"version": "6.3.40",
|
"version": "6.3.41",
|
||||||
"description": "Fab-manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.",
|
"description": "Fab-manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"fablab",
|
"fablab",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user