Skip to content

Guard quick check-in against conflicting bookings#2077

Merged
DonKoko merged 3 commits intomainfrom
codex/fix-asset-status-update-bug
Oct 2, 2025
Merged

Guard quick check-in against conflicting bookings#2077
DonKoko merged 3 commits intomainfrom
codex/fix-asset-status-update-bug

Conversation

@DonKoko
Copy link
Copy Markdown
Contributor

@DonKoko DonKoko commented Oct 2, 2025

Summary

  • ensure quick check-in only resets assets that remain checked out for the current booking by loading linked booking statuses
  • prevent the check-in flow from marking assets available when another active booking still has them checked out
  • expand the regression coverage to include conflict scenarios while keeping the partial check-in history reset test

Testing

  • npm run test -- app/modules/booking/service.server.test.ts

https://chatgpt.com/codex/tasks/task_b_68dd468da6648320b46c4cb44ababb32

@vercel
Copy link
Copy Markdown

vercel bot commented Oct 2, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
shelf-docs Ignored Ignored Preview Oct 2, 2025 10:26am

@DonKoko DonKoko requested a review from Copilot October 2, 2025 09:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the booking check-in functionality to prevent conflicts when multiple bookings share the same assets. It ensures that when checking in a booking, only assets that are not actively used by other ongoing or overdue bookings are marked as available.

Key Changes:

  • Modified asset filtering logic to check for active booking conflicts before allowing asset status updates
  • Updated database query to include linked booking information for conflict detection
  • Added comprehensive test coverage for conflict scenarios and partial check-in history handling

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
app/modules/booking/service.server.ts Updated checkinBooking function to include booking status checks and prevent asset conflicts
app/modules/booking/service.server.test.ts Added test cases for partial check-in history and booking conflict scenarios

Comment thread app/modules/booking/service.server.ts
…r asset mix

- Scope booking relation query to only load ONGOING and OVERDUE bookings for performance
- Add test covering the exact bug scenario: booking with kit (3 assets) + singular asset where singular was in partial check-in history
- All 4 assets should be reset to AVAILABLE on full check-in
@DonKoko DonKoko merged commit fe85f36 into main Oct 2, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants