fix(2meet-data-optimizer-hivepress-addon): map bookings hot field to hp_quantity
- hivepress-bookings has no guests field; the places booked are stored as hp_quantity (only when "Allow multiple places" is enabled) - Verified against hivepress-bookings 1.5.5: start_time / end_time were already correct and stay unchanged Verify: vendor/bin/phpunit --filter test_on_register_fields_uses_real_booking_meta_keys; addon unit 155 OK, integration 57 OK PR: PR-009
This commit is contained in:
@@ -10,7 +10,8 @@
|
|||||||
*
|
*
|
||||||
* start_time / end_time → unix timestamp range queries (hot)
|
* start_time / end_time → unix timestamp range queries (hot)
|
||||||
* status → enum filter (hot)
|
* status → enum filter (hot)
|
||||||
* guests → numeric count (hot for slot-availability)
|
* quantity → places booked, hp_quantity (hot for slot-availability;
|
||||||
|
* only written when "Allow multiple places" is on)
|
||||||
* listing → post_parent (already a posts column)
|
* listing → post_parent (already a posts column)
|
||||||
*
|
*
|
||||||
* Hot-zone target: `wp_wpdo_hot_hp_booking` with covering indexes on
|
* Hot-zone target: `wp_wpdo_hot_hp_booking` with covering indexes on
|
||||||
@@ -91,10 +92,10 @@ if ( ! class_exists( 'TMDO_HivePress_Bookings_Adapter' ) ) {
|
|||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'post_type' => 'hp_booking',
|
'post_type' => 'hp_booking',
|
||||||
'meta_key' => 'hp_guests',
|
'meta_key' => 'hp_quantity',
|
||||||
'zone' => 'hot',
|
'zone' => 'hot',
|
||||||
'data_type' => 'int(11) NOT NULL DEFAULT 0',
|
'data_type' => 'int(11) NOT NULL DEFAULT 0',
|
||||||
'column' => 'hp_guests',
|
'column' => 'hp_quantity',
|
||||||
'indexed' => false,
|
'indexed' => false,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -46,6 +46,18 @@ class HivePressBookingsAdapterTest extends TestCase {
|
|||||||
$this->assertTrue( (bool) $end['indexed'] );
|
$this->assertTrue( (bool) $end['indexed'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_on_register_fields_uses_real_booking_meta_keys(): void {
|
||||||
|
$registry = WPDO_Schema_Registry::instance();
|
||||||
|
$this->adapter->on_register_fields( $registry );
|
||||||
|
|
||||||
|
// hivepress-bookings has no guests field; places are stored as hp_quantity.
|
||||||
|
$this->assertNull( $registry->get_field( 'hp_booking', 'hp_guests' ) );
|
||||||
|
|
||||||
|
$quantity = $registry->get_field( 'hp_booking', 'hp_quantity' );
|
||||||
|
$this->assertNotNull( $quantity );
|
||||||
|
$this->assertSame( 'hot', $quantity['zone'] );
|
||||||
|
}
|
||||||
|
|
||||||
public function test_score_reflects_unverified_perf_dimension(): void {
|
public function test_score_reflects_unverified_perf_dimension(): void {
|
||||||
$score = $this->adapter->suitability_score();
|
$score = $this->adapter->suitability_score();
|
||||||
// D8 reduced to 0.9 because schema is best-effort until addon installs.
|
// D8 reduced to 0.9 because schema is best-effort until addon installs.
|
||||||
|
|||||||
Reference in New Issue
Block a user