Move common stats item schema bits to a shared class

This commit is contained in:
Tomek Wytrębowicz 2023-05-01 23:31:05 +02:00
parent 6a027f8eb7
commit b0b80445ab
7 changed files with 220 additions and 497 deletions

View File

@ -112,12 +112,13 @@ class Controller extends GenericStatsController {
} }
/** /**
* Get the Report's schema, conforming to JSON Schema. * Get the Report's item properties schema.
* Will be used by `get_item_schema` as `totals` and `subtotals`.
* *
* @return array * @return array
*/ */
public function get_item_schema() { public function get_item_properties_schema() {
$data_values = array( return array(
'amount' => array( 'amount' => array(
'description' => __( 'Net discount amount.', 'woocommerce' ), 'description' => __( 'Net discount amount.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
@ -141,99 +142,16 @@ class Controller extends GenericStatsController {
'indicator' => true, 'indicator' => true,
), ),
); );
}
$segments = array( /**
'segments' => array( * Get the Report's schema, conforming to JSON Schema.
'description' => __( 'Reports data grouped by segment condition.', 'woocommerce' ), *
'type' => 'array', * @return array
'context' => array( 'view', 'edit' ), */
'readonly' => true, public function get_item_schema() {
'items' => array( $schema = parent::get_item_schema();
'type' => 'object', $schema['title'] = 'report_coupons_stats';
'properties' => array(
'segment_id' => array(
'description' => __( 'Segment identificator.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $data_values,
),
),
),
),
);
$totals = array_merge( $data_values, $segments );
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'report_coupons_stats',
'type' => 'object',
'properties' => array(
'totals' => array(
'description' => __( 'Totals data.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $totals,
),
'intervals' => array(
'description' => __( 'Reports data grouped by intervals.', 'woocommerce' ),
'type' => 'array',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'items' => array(
'type' => 'object',
'properties' => array(
'interval' => array(
'description' => __( 'Type of interval.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'enum' => array( 'day', 'week', 'month', 'year' ),
),
'date_start' => array(
'description' => __( "The date the report start, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_start_gmt' => array(
'description' => __( 'The date the report start, as GMT.', 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_end' => array(
'description' => __( "The date the report end, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_end_gmt' => array(
'description' => __( 'The date the report end, as GMT.', 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $totals,
),
),
),
),
),
);
return $this->add_additional_fields_schema( $schema ); return $this->add_additional_fields_schema( $schema );
} }

View File

@ -110,13 +110,15 @@ class Controller extends GenericStatsController {
return apply_filters( 'woocommerce_rest_prepare_report_downloads_stats', $response, $report, $request ); return apply_filters( 'woocommerce_rest_prepare_report_downloads_stats', $response, $report, $request );
} }
/** /**
* Get the Report's schema, conforming to JSON Schema. * Get the Report's item properties schema.
* Will be used by `get_item_schema` as `totals` and `subtotals`.
* *
* @return array * @return array
*/ */
public function get_item_schema() { public function get_item_properties_schema() {
$totals = array( return array(
'download_count' => array( 'download_count' => array(
'title' => __( 'Downloads', 'woocommerce' ), 'title' => __( 'Downloads', 'woocommerce' ),
'description' => __( 'Number of downloads.', 'woocommerce' ), 'description' => __( 'Number of downloads.', 'woocommerce' ),
@ -126,6 +128,15 @@ class Controller extends GenericStatsController {
'indicator' => true, 'indicator' => true,
), ),
); );
}
/**
* Get the Report's schema, conforming to JSON Schema.
* It does not have the segments as in GenericStatsController.
*
* @return array
*/
public function get_item_schema() {
$totals = $this->get_item_properties_schema();
$schema = array( $schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#', '$schema' => 'http://json-schema.org/draft-04/schema#',

View File

@ -38,4 +38,121 @@ abstract class GenericStatsController extends GenericController {
return $params; return $params;
} }
/**
* Get the Report's item properties schema.
* Will be used by `get_item_schema` as `totals` and `subtotals`.
*
* @return array
*/
abstract function get_item_properties_schema();
/**
* Get the Report's schema, conforming to JSON Schema.
*
* Please note, it does not call add_additional_fields_schema,
* as you may want to update the `title` first.
*
* @return array
*/
public function get_item_schema() {
$data_values = $this->get_item_properties_schema();
$segments = array(
'segments' => array(
'description' => __( 'Reports data grouped by segment condition.', 'woocommerce' ),
'type' => 'array',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'items' => array(
'type' => 'object',
'properties' => array(
'segment_id' => array(
'description' => __( 'Segment identificator.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $data_values,
),
),
),
),
);
$totals = array_merge( $data_values, $segments );
return array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'report_stats',
'type' => 'object',
'properties' => array(
'totals' => array(
'description' => __( 'Totals data.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $totals,
),
'intervals' => array(
'description' => __( 'Reports data grouped by intervals.', 'woocommerce' ),
'type' => 'array',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'items' => array(
'type' => 'object',
'properties' => array(
'interval' => array(
'description' => __( 'Type of interval.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'enum' => array( 'day', 'week', 'month', 'year' ),
),
'date_start' => array(
'description' => __( "The date the report start, in the site's timezone.", 'woocommerce' ),
'type' => 'string',
'format' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_start_gmt' => array(
'description' => __( 'The date the report start, as GMT.', 'woocommerce' ),
'type' => 'string',
'format' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_end' => array(
'description' => __( "The date the report end, in the site's timezone.", 'woocommerce' ),
'type' => 'string',
'format' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_end_gmt' => array(
'description' => __( 'The date the report end, as GMT.', 'woocommerce' ),
'type' => 'string',
'format' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $totals,
),
),
),
),
),
);
}
} }

View File

@ -124,12 +124,13 @@ class Controller extends GenericStatsController {
} }
/** /**
* Get the Report's schema, conforming to JSON Schema. * Get the Report's item properties schema.
* Will be used by `get_item_schema` as `totals` and `subtotals`.
* *
* @return array * @return array
*/ */
public function get_item_schema() { public function get_item_properties_schema() {
$data_values = array( return array(
'items_sold' => array( 'items_sold' => array(
'title' => __( 'Products sold', 'woocommerce' ), 'title' => __( 'Products sold', 'woocommerce' ),
'description' => __( 'Number of product items sold.', 'woocommerce' ), 'description' => __( 'Number of product items sold.', 'woocommerce' ),
@ -152,106 +153,27 @@ class Controller extends GenericStatsController {
'readonly' => true, 'readonly' => true,
), ),
); );
}
$segments = array( /**
'segments' => array( * Get the Report's schema, conforming to JSON Schema.
'description' => __( 'Reports data grouped by segment condition.', 'woocommerce' ), *
'type' => 'array', * @return array
'context' => array( 'view', 'edit' ), */
'readonly' => true, public function get_item_schema() {
'items' => array( $schema = parent::get_item_schema();
'type' => 'object', $schema['title'] = 'report_products_stats';
'properties' => array(
'segment_id' => array( $segment_label = array(
'description' => __( 'Segment identificator.', 'woocommerce' ), 'description' => __( 'Human readable segment label, either product or variation name.', 'woocommerce' ),
'type' => 'integer', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), 'enum' => array( 'day', 'week', 'month', 'year' ),
'segment_label' => array(
'description' => __( 'Human readable segment label, either product or variation name.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'enum' => array( 'day', 'week', 'month', 'year' ),
),
'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $data_values,
),
),
),
),
); );
$totals = array_merge( $data_values, $segments ); $schema['properties']['totals']['properties']['segments']['items']['properties']['segment_label'] = $segment_label;
$schema['properties']['intervals']['items']['properties']['subtotals']['properties'] = $segment_label;
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'report_products_stats',
'type' => 'object',
'properties' => array(
'totals' => array(
'description' => __( 'Totals data.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $totals,
),
'intervals' => array(
'description' => __( 'Reports data grouped by intervals.', 'woocommerce' ),
'type' => 'array',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'items' => array(
'type' => 'object',
'properties' => array(
'interval' => array(
'description' => __( 'Type of interval.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'enum' => array( 'day', 'week', 'month', 'year' ),
),
'date_start' => array(
'description' => __( "The date the report start, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_start_gmt' => array(
'description' => __( 'The date the report start, as GMT.', 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_end' => array(
'description' => __( "The date the report end, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_end_gmt' => array(
'description' => __( 'The date the report end, as GMT.', 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $totals,
),
),
),
),
),
);
return $this->add_additional_fields_schema( $schema ); return $this->add_additional_fields_schema( $schema );
} }

View File

@ -133,12 +133,13 @@ class Controller extends GenericStatsController implements ExportableInterface {
} }
/** /**
* Get the Report's schema, conforming to JSON Schema. * Get the Report's item properties schema.
* Will be used by `get_item_schema` as `totals` and `subtotals`.
* *
* @return array * @return array
*/ */
public function get_item_schema() { public function get_item_properties_schema() {
$data_values = array( return array(
'total_sales' => array( 'total_sales' => array(
'description' => __( 'Total sales.', 'woocommerce' ), 'description' => __( 'Total sales.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
@ -205,12 +206,6 @@ class Controller extends GenericStatsController implements ExportableInterface {
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'products' => array(
'description' => __( 'Products sold.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'gross_sales' => array( 'gross_sales' => array(
'description' => __( 'Gross sales.', 'woocommerce' ), 'description' => __( 'Gross sales.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
@ -220,103 +215,23 @@ class Controller extends GenericStatsController implements ExportableInterface {
'format' => 'currency', 'format' => 'currency',
), ),
); );
}
$segments = array( /**
'segments' => array( * Get the Report's schema, conforming to JSON Schema.
'description' => __( 'Reports data grouped by segment condition.', 'woocommerce' ), *
'type' => 'array', * @return array
'context' => array( 'view', 'edit' ), */
'readonly' => true, public function get_item_schema() {
'items' => array( $schema = parent::get_item_schema();
'type' => 'object', $schema['title'] = 'report_revenue_stats';
'properties' => array(
'segment_id' => array(
'description' => __( 'Segment identificator.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $data_values,
),
),
),
),
);
$totals = array_merge( $data_values, $segments ); // Products is not shown in intervals, only in totals.
$schema['properties']['totals']['properties']['products'] = array(
// Products is not shown in intervals. 'description' => __( 'Products sold.', 'woocommerce' ),
unset( $data_values['products'] ); 'type' => 'integer',
'context' => array( 'view', 'edit' ),
$intervals = array_merge( $data_values, $segments ); 'readonly' => true,
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'report_revenue_stats',
'type' => 'object',
'properties' => array(
'totals' => array(
'description' => __( 'Totals data.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $totals,
),
'intervals' => array(
'description' => __( 'Reports data grouped by intervals.', 'woocommerce' ),
'type' => 'array',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'items' => array(
'type' => 'object',
'properties' => array(
'interval' => array(
'description' => __( 'Type of interval.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'enum' => array( 'day', 'week', 'month', 'year' ),
),
'date_start' => array(
'description' => __( "The date the report start, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_start_gmt' => array(
'description' => __( 'The date the report start, as GMT.', 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_end' => array(
'description' => __( "The date the report end, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_end_gmt' => array(
'description' => __( 'The date the report end, as GMT.', 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $intervals,
),
),
),
),
),
); );
return $this->add_additional_fields_schema( $schema ); return $this->add_additional_fields_schema( $schema );

View File

@ -137,12 +137,13 @@ class Controller extends GenericStatsController {
} }
/** /**
* Get the Report's schema, conforming to JSON Schema. * Get the Report's item properties schema.
* Will be used by `get_item_schema` as `totals` and `subtotals`.
* *
* @return array * @return array
*/ */
public function get_item_schema() { public function get_item_properties_schema() {
$data_values = array( return array(
'total_tax' => array( 'total_tax' => array(
'description' => __( 'Total tax.', 'woocommerce' ), 'description' => __( 'Total tax.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
@ -180,99 +181,16 @@ class Controller extends GenericStatsController {
'readonly' => true, 'readonly' => true,
), ),
); );
}
$segments = array( /**
'segments' => array( * Get the Report's schema, conforming to JSON Schema.
'description' => __( 'Reports data grouped by segment condition.', 'woocommerce' ), *
'type' => 'array', * @return array
'context' => array( 'view', 'edit' ), */
'readonly' => true, public function get_item_schema() {
'items' => array( $schema = parent::get_item_schema();
'type' => 'object', $schema['title'] = 'report_taxes_stats';
'properties' => array(
'segment_id' => array(
'description' => __( 'Segment identificator.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $data_values,
),
),
),
),
);
$totals = array_merge( $data_values, $segments );
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'report_taxes_stats',
'type' => 'object',
'properties' => array(
'totals' => array(
'description' => __( 'Totals data.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $totals,
),
'intervals' => array(
'description' => __( 'Reports data grouped by intervals.', 'woocommerce' ),
'type' => 'array',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'items' => array(
'type' => 'object',
'properties' => array(
'interval' => array(
'description' => __( 'Type of interval.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'enum' => array( 'day', 'week', 'month', 'year' ),
),
'date_start' => array(
'description' => __( "The date the report start, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_start_gmt' => array(
'description' => __( 'The date the report start, as GMT.', 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_end' => array(
'description' => __( "The date the report end, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_end_gmt' => array(
'description' => __( 'The date the report end, as GMT.', 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $totals,
),
),
),
),
),
);
return $this->add_additional_fields_schema( $schema ); return $this->add_additional_fields_schema( $schema );
} }

View File

@ -128,12 +128,13 @@ class Controller extends GenericStatsController {
} }
/** /**
* Get the Report's schema, conforming to JSON Schema. * Get the Report's item properties schema.
* Will be used by `get_item_schema` as `totals` and `subtotals`.
* *
* @return array * @return array
*/ */
public function get_item_schema() { public function get_item_properties_schema() {
$data_values = array( return array(
'items_sold' => array( 'items_sold' => array(
'title' => __( 'Variations Sold', 'woocommerce' ), 'title' => __( 'Variations Sold', 'woocommerce' ),
'description' => __( 'Number of variation items sold.', 'woocommerce' ), 'description' => __( 'Number of variation items sold.', 'woocommerce' ),
@ -156,106 +157,27 @@ class Controller extends GenericStatsController {
'readonly' => true, 'readonly' => true,
), ),
); );
}
$segments = array( /**
'segments' => array( * Get the Report's schema, conforming to JSON Schema.
'description' => __( 'Reports data grouped by segment condition.', 'woocommerce' ), *
'type' => 'array', * @return array
'context' => array( 'view', 'edit' ), */
'readonly' => true, public function get_item_schema() {
'items' => array( $schema = parent::get_item_schema();
'type' => 'object', $schema['title'] = 'report_variations_stats';
'properties' => array(
'segment_id' => array( $segment_label = array(
'description' => __( 'Segment identificator.', 'woocommerce' ), 'description' => __( 'Human readable segment label, either product or variation name.', 'woocommerce' ),
'type' => 'integer', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), 'enum' => array( 'day', 'week', 'month', 'year' ),
'segment_label' => array(
'description' => __( 'Human readable segment label, either product or variation name.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'enum' => array( 'day', 'week', 'month', 'year' ),
),
'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $data_values,
),
),
),
),
); );
$totals = array_merge( $data_values, $segments ); $schema['properties']['totals']['properties']['segments']['items']['properties']['segment_label'] = $segment_label;
$schema['properties']['intervals']['items']['properties']['subtotals']['properties'] = $segment_label;
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'report_variations_stats',
'type' => 'object',
'properties' => array(
'totals' => array(
'description' => __( 'Totals data.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $totals,
),
'intervals' => array(
'description' => __( 'Reports data grouped by intervals.', 'woocommerce' ),
'type' => 'array',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'items' => array(
'type' => 'object',
'properties' => array(
'interval' => array(
'description' => __( 'Type of interval.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'enum' => array( 'day', 'week', 'month', 'year' ),
),
'date_start' => array(
'description' => __( "The date the report start, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_start_gmt' => array(
'description' => __( 'The date the report start, as GMT.', 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_end' => array(
'description' => __( "The date the report end, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_end_gmt' => array(
'description' => __( 'The date the report end, as GMT.', 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $totals,
),
),
),
),
),
);
return $this->add_additional_fields_schema( $schema ); return $this->add_additional_fields_schema( $schema );
} }