Synchronizes GroupEx schedules to PEF.
Go to /admin/openy/integrations/groupex-pro/gxp
.
- Set up your GroupExPro client id.
- Provide parent activity ID. Should be Group Exercises under Fitness.
Run drush openy-pef-gxp-sync
command from your project docroot.
The syncer consists of the next steps:
- Fetcher - fetches data from GroupEx API.
- Wrapper - processes the data for saving (maps location ids, fixes title encoding problems, etc).
- Wrapper - groups all items by Class ID and Location ID, calculates hashes.
- Wrapper - prepares data to be removed (extra items in DB or changed hashes)
- Wrapper - prepares data to be created (new items + changed hashes)
- Cleaner - removes data to be removed.
- Saver - creates data to be created.
- If a location is removed in API it should be removed in DB.
- If a location is added in API it should be added (with classes) in DB.
- If a class is removed in API it should be removed in DB (with all class items);
- If a class is added in API it should be added in DB (with all class items);
- Each GroupEx class can have several class items (with the same class ID).
- We compare hashes for Location ID + Class ID + all class items inside (on unprocessed data!).
- If hash is changed we should remove all items belongs to this hash and create them again.
-
To emulate API data please use
FetcherDebuggerClass
. Just replace@openy_pef_gxp_sync.fetcher
with@openy_pef_gxp_sync.fetcher_debugger
to emulate API response. -
Use
DEBUG_MODE
constants inside classes to debug specific service.
- There is an issue if class in Groupex has category set to "General" - it will not be synced and displayed at PEF. This is a limitation of GroupEX PRO API.
By default Syncer creates unpublished Session nodes. In order for them to become visible in Schedules application you'd need to set config variables to allow unpublished entities to be displayed
- config
openy_repeat.settings
- variableallow_unpublished_references: 1
- this is for unpublished Session, Program, Program Subcategory session nodes. - config
openy_session_instance.settings
- variableallow_unpublished_references: 1
- this works only for unpublished Session nodes.
Run next commands if you want to switch to published mode
:
drush cset openy_repeat.settings allow_unpublished_references 1 -y
drush cset openy_session_instance.settings allow_unpublished_references 1 -y
Run next commands if you want to switch to unpublished mode
:
drush cset openy_repeat.settings allow_unpublished_references 0 -y
drush cset openy_session_instance.settings allow_unpublished_references 0 -y
You need to clear cache in order to get this settings working.
At this moment we have no UI for setting these variables, so using drush cset
or importing configs via Config Manager is recommended.
Use config openy_pef_gxp_sync.enabled_locations
for allow locations from GroupEx PRO to be synced.
Config contains array of location IDs from GroupEx.