Skip to content

Conversation

@RafaelKayumov
Copy link
Contributor

@RafaelKayumov RafaelKayumov commented Oct 24, 2025

WOOMOB-1532

Description

  • Implements attendance status remote update for a booking
  • Makes dateCreated and dateModified optional in Yosemite.Booking to ignore nil values returned in PUT method.
  • Runs BookingRemote.updateBooking method to update booking attendance status remotely.
  • Reverts old attendance status on update error.
  • Hides "Attendance" section if a booking is cancelled. Updates the section visibility dynamically.

Testing steps

  • Use CIAB site with existing bookings
  • Find a non-cancelled booking and open Booking details
  • Scroll down to "Attendance" section and tap on status row to open selector.
  • Select a new attendance status.
  • Make sure the new status is applied. Pull down to refresh the booking details and make sure the new attendance status remained.
  • Test the error rollback. Turn off the internet or simulate the response error for the /wc-bookings/v2/bookings/{booking-id}&_method=put in Proxyman. Make sure the status is rolled back shortly after switching.
  • Test the "Attendance" section hiding for a cancelled booking. Find an existing cancelled booking or cancel one with admin. Open that booking details and make sure the "attendance" section is not displayed.

Demo

Booking-status-update.mov

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@RafaelKayumov RafaelKayumov added this to the 23.6 milestone Oct 24, 2025
@RafaelKayumov RafaelKayumov added the type: task An internally driven task. label Oct 24, 2025
@RafaelKayumov RafaelKayumov changed the title Woomob 1553 update attendance status remotely [Bookings] Update attendance status remotely Oct 24, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 24, 2025

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr16280-1d26152
Version23.5
Bundle IDcom.automattic.alpha.woocommerce
Commit1d26152
Installation URL12ir28afq5g50
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@RafaelKayumov RafaelKayumov marked this pull request as ready for review October 27, 2025 12:05
@itsmeichigo itsmeichigo self-assigned this Oct 28, 2025
Copy link
Contributor

@itsmeichigo itsmeichigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the PR and confirmed that it works as described. I left some nit-picking in the comments but pre-approving.

Comment on lines +16 to +17
dateCreated = booking.dateCreated ?? dateCreated
dateModified = booking.dateModified ?? dateModified
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Are you sure we want to keep the old dates here? If so, please leave a comment in the code for why that's necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in b3991c7

return onCompletion(UpdateBookingStatusError.undefinedState)
}

Task {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Is it necessary to trigger the completion closure on the main thread with @MainActor here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in 78de80e

footerText: Localization.attendanceSectionFooterText,
content: .attendance(attendanceContent)
),
at: 3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Is it safe to use this index if the customer section is absent? Should we trigger setupSections upon changes of section visibility in updateDisplayProperties to avoid having to work with indices?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer keep the static sections without recreation there. I added section index calculation in 8ed229e

In case if design change and we get more dynamic sections - we can revisit this and start rebuilding sections for each booking update

) { error in
if let error {
DDLogError("⛔️ Error updating booking attendance status: \(error)")
// TODO: Show an error notice to the user
Copy link
Contributor

@itsmeichigo itsmeichigo Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we show a notice here to let the user know about the failure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll handle this in a separate PR

# Conflicts:
#	Modules/Tests/NetworkingTests/Remote/BookingsRemoteTests.swift
#	Modules/Tests/YosemiteTests/Mocks/MockBookingsRemote.swift
#	Modules/Tests/YosemiteTests/Stores/BookingStoreTests.swift
@RafaelKayumov RafaelKayumov merged commit 29fbd68 into trunk Oct 28, 2025
13 checks passed
@RafaelKayumov RafaelKayumov deleted the WOOMOB-1553-update-attendance-status-remotely branch October 28, 2025 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants