Adds reservation cancellation path to resources#2550
Conversation
c5c6960 to
80c2aac
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Daverball
left a comment
There was a problem hiding this comment.
Currently this seems to be limited to cancelling all reservations in a ticket, which should cover individual reservations nicely, but does that cover 90+% of customer requests or is it more common, or almost as common that for large half year reservations, they want to cancel a single date?
If so, we probably need to allow customers to select which dates they want to cancel, which would also necessarily change the UI in the ticket.
|
Now cancellation requests can select single reservations to be cancelled and the manager sees the request cancellation dates, then approve it. |
Daverball
left a comment
There was a problem hiding this comment.
Looks good overall, although we should consider if and how we should notify a ticket's assignee and/or resource recipients.
There's also couple of minor improvement suggestions and a couple of questionable conditions, that make the feature less flexible.
Co-authored-by: David Salvisberg <david.salvisberg@seantis.ch>
Co-authored-by: David Salvisberg <david.salvisberg@seantis.ch>
999ca4a to
79501c1
Compare
|
Now, as I review the changes i think the |
Daverball
left a comment
There was a problem hiding this comment.
Looks good
There's still a couple of things we should consider. E.g. what happens if a customer requests a cancellation and by the time the ticket gets processed the reservation has already happened.
Technically it's harmless to cancel past reservations. But for billing purposes, if there's a mix of past reservations that were cancelled too late and future ones that can still be cancelled. You may want only the future ones to get cancelled, when cancellation gets approved. It might be fine to teach supporters to manually cancel reservations that can still be cancelled and reject the request, but it's definitely worth a discussion whether that's good enough, especially since the customer-facing notifications are going to be confusing, so they'd probably also want to mute the ticket and then send a manual message at the end.
| stmt = update(ResourceRecipient.__table__).where( # type: ignore[arg-type] | ||
| and_( | ||
| ResourceRecipient.content['customer_messages'].as_boolean() | ||
| .is_(True), | ||
| ResourceRecipient.type == 'resource', | ||
| ) | ||
| ).values( | ||
| content=func.jsonb_set( | ||
| ResourceRecipient.content, | ||
| array(['cancellation_requests']), | ||
| func.to_jsonb(true()), | ||
| ) |
There was a problem hiding this comment.
This is one of those cases where I would just write the update statement in raw SQL, it's far easier to get it right that way, we don't want any ambiguity about what the statement looks like at the end and whether or not it will have parameter bindings or is fully baked.
In this case the query should be fully baked, but I think this will probably result in a query with parameter bindings.
See e.g. the following upgrade task:
onegov-cloud/src/onegov/reservation/upgrade.py
Lines 153 to 167 in e94d5f1
Reservation: Adds reservation cancellation path to resources
TYPE: Feature
LINK: ogc-3064