Skip to content

Conversation

@SebastianWiz
Copy link
Contributor

Context

⛑️ Ticket(s): https://secure.helpscout.net/link/to/conversation

Summary

This snippet adds a new merge tag {gpb_bookings_today:service_id[123]} for displaying a service's bookings for the current day.

The output includes:

  • Date header (e.g., "Today's Bookings — February 2, 2026")
  • Time range for each booking
  • Customer name (if available)
  • Resource names (if applicable)

Example:
image

…all bookings for a service for the current day.
@coderabbitai
Copy link

coderabbitai bot commented Feb 2, 2026

Walkthrough

Introduces a new PHP class that registers a Gravity Forms merge tag replacement. The merge tag {gpb_bookings_today:service_id[]} displays today's bookings for a specified service, fetching booking data, filtering by datetime range, and formatting output in HTML or plain text format.

Changes

Cohort / File(s) Summary
New Merge Tag Feature
gp-bookings/gpb-bookings-today-merge-tag.php
Adds GPB_Bookings_Today_Merge_Tag class with merge tag parsing and booking output formatting. Includes methods to fetch bookings for a service within today's date range, filter datetime-range bookings, format individual booking lines with time/customer/resource details, and support both HTML and plain text output formats.

Sequence Diagram

sequenceDiagram
    participant GF as Gravity Forms
    participant MTR as Merge Tag<br/>Replacement
    participant BQ as Booking Query
    participant Output as Formatted Output

    GF->>MTR: gform_replace_merge_tags filter
    MTR->>MTR: Parse merge tag syntax<br/>{gpb_bookings_today:service_id[id]}
    MTR->>BQ: Fetch bookings for service<br/>within today's date range
    BQ-->>MTR: Return bookings
    MTR->>MTR: Filter to datetime-range<br/>bookings
    MTR->>MTR: Format each booking line<br/>(time, customer, resources)
    MTR->>MTR: Build title and output<br/>(HTML or plain text)
    MTR->>Output: Return formatted bookings
    Output-->>GF: Merge tag replaced
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • saifsultanc
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main change: adding a new PHP snippet file for displaying service bookings for the current day.
Description check ✅ Passed The description includes a Context section with a ticket reference and a comprehensive Summary explaining the new merge tag, its output format, and includes a visual example.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch SebastianWiz-patch-6

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant