Allow Booker bookings BookerBy to be updated to TermTime activity requestor
Quite a chunk of changes to the code to do this can change a fundamental part of how the code was separating bookings from its own and 3rd party's. Hopefully, commit separation will help review.
Changes
- adds operation to get all staff from Booker and conveniently store keyed by 'Id' + tests
- adds operation to get all activities from TermTime and conveniently store keyed by 'code' (activity number) + tests
- makes matching TT events to Booker bookings by Description containing
[Activity-X:Y]
reference more flexible - no longer differentiate synced and 3rd party Booker bookings by using
BookedBy.Id == 'essm-sync'
- left with only option to look for bookings with Descriptions containing
[Activity-X:Y]
references
- left with only option to look for bookings with Descriptions containing
- update incorrect BookedBy when comparing events, if activity requestor (crsid) can be found and matched to a Booker staff member
Testing
- Do not sync with Booker Live - use Booker Staging instead
- Config with creds for Booker Staging and TT 2122Allocate instances can be found in 1password or sync-tasks repo's CI vars
- examples below call these
booker.yaml
andtermtime.yaml
- examples below call these
- You'll need to be a staff member in Booker Staging (ask @rjg21 if you need adding)
Firstly, find a matched event in list and note its activity number (e.g. Activity-19494):
essmsync -c termtime.yaml -c booker.yaml compare_events "dump(comparison.events.match)"
Dump TermTime's activities:
essmsync -c termtime.yaml -c booker.yaml termtime.get_activities_by_code "dump(termtime.activities_by_code)" > tt_acts.yaml
Edit tt_acts.yaml
:
- find the matching Activity
- set its 'user5' value to your CRSid
We can now include this yaml in the configuration to load and the tool will use this rather than requesting from API. So checking that comparison now wants to update bookings for this activity:
essmsync -c termtime.yaml -c booker.yaml -c tt_acts.yaml compare_events "dump(comparison.events.update)"
e.g.
...
BookedBy:
Id: rjg21
UserOptimeIndex: 874
UserType: Staff
...
And an update_events
operation will show the update:
essmsync -c termtime.yaml -c booker.yaml -c tt_acts.yaml update_events
e.g.
...
INFO:essmsync.booker:Updating event 'Activity-...'
...
INFO:essmsync.booker: Booked By : 'rjg21'
And finally, telling the tool to make changes (make sure using staging not live Booker):
essmsync -c termtime.yaml -c booker.yaml -c tt_acts.yaml update_events --really-do-this
Can be seen as changed in Booker Staging: https://booker-test.eventmapsolutions.com/
If you have notifications enabled in Booker (probably the case) you'll get an email of the change.
Part of investigation: #43 (closed)