Repository navigation
feat(listing): show status for every listing in toolbox - #387
Merged
Merged
Conversation
One query on lenderUid, which the rules already allow, so the Toolbox can show each listing's status without a query per listing.
Every Toolbox row shows Paused, Booked today or Available, derived from the listing and its bookings. Lenders cannot approve requests yet, so a request that is not cancelled and covers today counts as booked.
adrimikh
requested changes
Nov 19, 2026
adrimikh
left a comment
Contributor
There was a problem hiding this comment.
The derived status logic is straightforward, and the parallel listing/bookings load avoids making users wait for a second network round trip. The rules test also gives good coverage for querying bookings across a lender’s listings.
I just requested a few changes and then everything will be good.
A failed reload kept the bookings of the last load, so a listing could still show Available or Booked today after a booking changed, with no error to say it was out of date. The bookings are now dropped on failure, and the failure is logged.
…ng-status # Conflicts: # app/src/sharedTest/java/com/android/polybazaar/booking/model/FakeBookingRepository.kt
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Closes #196. Every listing in the Toolbox now shows its status: Paused, Booked today or Available.
What
BookingRepository.getBookingsForLender(): one query onlenderUidfor the bookings of all the lender's listings, instead of one query per listing. The rules already allow it; a new rules test checks that a lender can list their own bookings and no one else's.toolboxListingStatus(new,toolbox/model): the status is worked out from the listing and its bookings, nothing new is stored.ToolboxViewModelloads the bookings at the same time as the listings, and reloads both whenever the profile is shown again, so a new booking appears when you come back.ToolboxCard: one badge per row, the same pill shape as the existing PAUSED badge (new tagToolboxCardTags.STATUS_BADGE), and every row stays the same height.Why
#20 asks for "my listings with status". #355 only showed paused listings, so owners still couldn't tell which of their listings are booked today.
#196 suggested adding a status field to the model, writes and rules. Lenders can't approve or reject a request yet, so for now the status is derived from the data that already exists, and a request that covers today counts as booked. That avoids a stored field that would need migrating once approval exists.
Validation
./gradlew ktfmtCheck checkpasses locally: 1615 unit tests, 0 failures.rules-tests, emulators): 214 pass, including the new lender query test.ToolboxListingStatusTest: paused wins over a booking today, booked today, a booking whose separate days skip today, only later bookings, a confirmed booking, cancelled and past bookings, and other listings' bookings.ToolboxViewModelTest: statuses after loading, loading until the bookings arrive, a failure of the bookings alone, keeping the statuses on a failed reload, and reloading the bookings.ToolboxCardTest: one badge per row, no badges but Paused before the bookings load, the same row height for every status, and the card with its ViewModel.FirebaseBookingRepositoryTest: the lender query, and a signed-out user being refused.connectedCheck(instrumented tests), and not checked on a device.Follow-ups
AI use
Claude Code (Claude Opus 5.5) wrote the lender bookings query, the status logic, the badges and the tests, and ran the checks. I reviewed the diff.