Closed keang closed 7 years ago
Missing from this PR is the UI for lawrence to populate the table, but I wanted to do a sanity check with you guys first before carrying forward.. any comments @kkolotyuk @sharipov-ru @rmascarenhas ?
So I didn't get. We want to override host's fields or each property's fields?
As I understood, @keang wants to be able to easily update cancellation policies, without modifying every supplier.
Yes, but he wants to update it per host or per property?
This PR will allow both =D per host: just set host_id, leave property_identifier to be nil per property: set both host_id and property_identifier. (because identifier alone doesn't guarantee uniqueness)
Ok I see. The idea looks fine to me.
@kkolotyuk @sharipov-ru please :eyes:
Arggghhh
On Wed, Nov 30, 2016 at 7:44 PM, Konstantin Kolotyuk < notifications@github.com> wrote:
@kkolotyuk commented on this pull request.
In apps/web/controllers/overwrites/new.rb https://github.com/roomorama/concierge/pull/574#pullrequestreview-10738080 :
@@ -5,7 +5,7 @@ class New expose :overwrite
def call(params)
- @overwrite = Overwrite.new
- @overwrite = Overwrite.new
still 2 spaces 💅
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/roomorama/concierge/pull/574#pullrequestreview-10738080, or mute the thread https://github.com/notifications/unsubscribe-auth/AB01GioqJL7luSD6NOsxZZtqL7xWc99Iks5rDWGQgaJpZM4K8K6K .
Looks good!
Context
We have a request for a feature to allow admin to overwrite certain host's (all his cancellation policy) cancellation_policy. Effort started with https://github.com/roomorama/concierge/pull/565/files, to add a new column to host and inject the host's cancellation policy into supplier mappers.
The issue
Then next week there'll be a request to overwrite the cancellation_policy per property. I want to prepare for more of such adhoc custom field overwrites (some host want to default available? some host want to have overwrite currencies? because of the Chinese distribution maybe?)
So what might be better than creating new column on the properties, then injecting into Mapper implementations? (11 classes to modify for 11 suppliers)
Solution (this PR)
We can have a "overwrites" table which has: host_id: int, property_identifier: string, data: text(json)
As Lawrence receive a spreadsheet from host detailing the custom
cancellation_policy
, he just populate the above table, preempting property identifiers before the synchronisation process created a row on the properties table.PropertySynchronisation#start applies these overwrites before sending to properties to Roomorama. If an update is removed from the database, the supplier defaults will be kicked in and sent to Roomorama instead.
With this we can halt #565