Updated todo format to be in line with the rest of WooCommerce.
This commit is contained in:
parent
a3ae15d58e
commit
e56009cfdc
|
@ -17,7 +17,7 @@ defined( 'ABSPATH' ) || exit;
|
|||
*/
|
||||
class WC_Admin_REST_Customers_Controller extends WC_REST_Customers_Controller {
|
||||
|
||||
// TODO Add support for guests here. See https://wp.me/p7bje6-1dM.
|
||||
// @todo Add support for guests here. See https://wp.me/p7bje6-1dM.
|
||||
|
||||
/**
|
||||
* Endpoint namespace.
|
||||
|
|
|
@ -75,7 +75,7 @@ class WC_Admin_REST_Reports_Customers_Stats_Controller extends WC_REST_Reports_C
|
|||
$report_data = $customers_query->get_data();
|
||||
$out_data = array(
|
||||
'totals' => $report_data,
|
||||
// TODO: is this needed? the single element array tricks the isReportDataEmpty() selector.
|
||||
// @todo: is this needed? the single element array tricks the isReportDataEmpty() selector.
|
||||
'intervals' => array( (object) array() ),
|
||||
);
|
||||
|
||||
|
@ -117,7 +117,7 @@ class WC_Admin_REST_Reports_Customers_Stats_Controller extends WC_REST_Reports_C
|
|||
* @return array
|
||||
*/
|
||||
public function get_item_schema() {
|
||||
// TODO: should any of these be 'indicator's?
|
||||
// @todo: should any of these be 'indicator's?
|
||||
$totals = array(
|
||||
'customers_count' => array(
|
||||
'description' => __( 'Number of customers.', 'wc-admin' ),
|
||||
|
@ -159,7 +159,7 @@ class WC_Admin_REST_Reports_Customers_Stats_Controller extends WC_REST_Reports_C
|
|||
'readonly' => true,
|
||||
'properties' => $totals,
|
||||
),
|
||||
'intervals' => array( // TODO: remove this?
|
||||
'intervals' => array( // @todo: remove this?
|
||||
'description' => __( 'Reports data grouped by intervals.', 'wc-admin' ),
|
||||
'type' => 'array',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
|
|
|
@ -463,7 +463,7 @@ class WC_Admin_Api_Init {
|
|||
$order_ids = $order_query->get_orders();
|
||||
|
||||
foreach ( $order_ids as $order_id ) {
|
||||
// TODO: schedule single order update if this fails?
|
||||
// @todo: schedule single order update if this fails?
|
||||
WC_Admin_Reports_Orders_Stats_Data_Store::sync_order( $order_id );
|
||||
WC_Admin_Reports_Products_Data_Store::sync_order_products( $order_id );
|
||||
WC_Admin_Reports_Coupons_Data_Store::sync_order_coupons( $order_id );
|
||||
|
@ -614,7 +614,7 @@ class WC_Admin_Api_Init {
|
|||
$customer_ids = $customer_query->get_results();
|
||||
|
||||
foreach ( $customer_ids as $customer_id ) {
|
||||
// TODO: schedule single customer update if this fails?
|
||||
// @todo: schedule single customer update if this fails?
|
||||
WC_Admin_Reports_Customers_Data_Store::update_registered_customer( $customer_id );
|
||||
}
|
||||
}
|
||||
|
@ -661,7 +661,7 @@ class WC_Admin_Api_Init {
|
|||
return array_merge(
|
||||
$wc_tables,
|
||||
array(
|
||||
// TODO: will this work on multisite?
|
||||
// @todo: will this work on multisite?
|
||||
"{$wpdb->prefix}wc_order_stats",
|
||||
"{$wpdb->prefix}wc_order_product_lookup",
|
||||
"{$wpdb->prefix}wc_order_tax_lookup",
|
||||
|
|
|
@ -34,7 +34,7 @@ class WC_Admin_Reports_Customers_Stats_Query extends WC_Admin_Reports_Query {
|
|||
'page' => 1,
|
||||
'order' => 'DESC',
|
||||
'orderby' => 'date_registered',
|
||||
'fields' => '*', // TODO: needed?
|
||||
'fields' => '*', // @todo: needed?
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ class WC_Admin_Reports_Interval {
|
|||
|
||||
return (int) floor( ( (int) $diff_timestamp ) / DAY_IN_SECONDS ) + 1 + $addendum;
|
||||
case 'week':
|
||||
// TODO: optimize? approximately day count / 7, but year end is tricky, a week can have fewer days.
|
||||
// @todo: optimize? approximately day count / 7, but year end is tricky, a week can have fewer days.
|
||||
$week_count = 0;
|
||||
do {
|
||||
$start_datetime = self::next_week_start( $start_datetime );
|
||||
|
|
|
@ -27,7 +27,7 @@ class WC_Admin_Reports_Orders_Stats_Segmenting extends WC_Admin_Reports_Segmenti
|
|||
'refunds' => "SUM($products_table.refund_amount) AS refunds",
|
||||
'taxes' => "SUM($products_table.tax_amount) AS taxes",
|
||||
'shipping' => "SUM($products_table.shipping_amount) AS shipping",
|
||||
// TODO: product_net_revenue should already have refunds subtracted, so it should not be here. Pls check.
|
||||
// @todo: product_net_revenue should already have refunds subtracted, so it should not be here. Pls check.
|
||||
'net_revenue' => "SUM($products_table.product_net_revenue) AS net_revenue",
|
||||
);
|
||||
|
||||
|
@ -354,7 +354,7 @@ class WC_Admin_Reports_Orders_Stats_Segmenting extends WC_Admin_Reports_Segmenti
|
|||
// while coupon and customer are bound to order, so we don't need the extra JOIN for those.
|
||||
// This also means that segment selections need to be calculated differently.
|
||||
if ( 'product' === $this->query_args['segmentby'] ) {
|
||||
// TODO: how to handle shipping taxes when grouped by product?
|
||||
// @todo: how to handle shipping taxes when grouped by product?
|
||||
$segmenting_selections = array(
|
||||
'product_level' => $this->get_segment_selections_product_level( $product_segmenting_table ),
|
||||
'order_level' => $this->get_segment_selections_order_level( $unique_orders_table ),
|
||||
|
|
|
@ -292,7 +292,7 @@ class WC_Admin_Reports_Segmenting {
|
|||
)
|
||||
);
|
||||
} elseif ( 'variation' === $this->query_args['segmentby'] ) {
|
||||
// TODO: assuming that this will only be used for one product, check assumption.
|
||||
// @todo: assuming that this will only be used for one product, check assumption.
|
||||
if ( ! isset( $this->query_args['product_includes'] ) || count( $this->query_args['product_includes'] ) !== 1 ) {
|
||||
$this->all_segment_ids = array();
|
||||
return;
|
||||
|
@ -314,7 +314,7 @@ class WC_Admin_Reports_Segmenting {
|
|||
);
|
||||
$segments = wp_list_pluck( $categories, 'cat_ID' );
|
||||
} elseif ( 'coupon' === $this->query_args['segmentby'] ) {
|
||||
// TODO: switch to a non-direct-SQL way to get all coupons?
|
||||
// @todo: switch to a non-direct-SQL way to get all coupons?
|
||||
$coupon_ids = $wpdb->get_results( "SELECT ID FROM {$wpdb->prefix}posts WHERE post_type='shop_coupon' AND post_status='publish'", ARRAY_A ); // WPCS: cache ok, DB call ok, unprepared SQL ok.
|
||||
$segments = wp_list_pluck( $coupon_ids, 'ID' );
|
||||
} elseif ( 'customer_type' === $this->query_args['segmentby'] ) {
|
||||
|
|
|
@ -95,7 +95,7 @@ class WC_Admin_Reports_Categories_Data_Store extends WC_Admin_Reports_Data_Store
|
|||
$sql_query_params['where_clause'] .= " AND {$wpdb->prefix}term_taxonomy.term_id IN ({$included_categories})";
|
||||
}
|
||||
|
||||
// TODO: only products in the category C or orders with products from category C (and, possibly others?).
|
||||
// @todo: only products in the category C or orders with products from category C (and, possibly others?).
|
||||
$included_products = $this->get_included_products( $query_args );
|
||||
if ( $included_products ) {
|
||||
$sql_query_params['where_clause'] .= " AND {$order_product_lookup_table}.product_id IN ({$included_products})";
|
||||
|
|
|
@ -41,7 +41,7 @@ class WC_Admin_Reports_Customers_Data_Store extends WC_Admin_Reports_Data_Store
|
|||
'customer_id' => 'customer_id',
|
||||
'user_id' => 'user_id',
|
||||
'username' => 'username',
|
||||
'name' => "CONCAT_WS( ' ', first_name, last_name ) as name", // TODO: what does this mean for RTL?
|
||||
'name' => "CONCAT_WS( ' ', first_name, last_name ) as name", // @todo: what does this mean for RTL?
|
||||
'email' => 'email',
|
||||
'country' => 'country',
|
||||
'city' => 'city',
|
||||
|
|
|
@ -49,7 +49,7 @@ class WC_Admin_Reports_Data_Store {
|
|||
*/
|
||||
protected $report_columns = array();
|
||||
|
||||
// TODO: this does not really belong here, maybe factor out the comparison as separate class?
|
||||
// @todo: this does not really belong here, maybe factor out the comparison as separate class?
|
||||
/**
|
||||
* Order by property, used in the cmp function.
|
||||
*
|
||||
|
@ -73,7 +73,7 @@ class WC_Admin_Reports_Data_Store {
|
|||
private function interval_cmp( $a, $b ) {
|
||||
if ( '' === $this->order_by || '' === $this->order ) {
|
||||
return 0;
|
||||
// TODO: should return WP_Error here perhaps?
|
||||
// @todo: should return WP_Error here perhaps?
|
||||
}
|
||||
if ( $a[ $this->order_by ] === $b[ $this->order_by ] ) {
|
||||
return 0;
|
||||
|
@ -121,7 +121,7 @@ class WC_Admin_Reports_Data_Store {
|
|||
* @return stdClass
|
||||
*/
|
||||
protected function fill_in_missing_intervals( $db_intervals, $datetime_start, $datetime_end, $time_interval, &$data ) {
|
||||
// TODO: this is ugly and messy.
|
||||
// @todo: this is ugly and messy.
|
||||
// At this point, we don't know when we can stop iterating, as the ordering can be based on any value.
|
||||
$end_datetime = new DateTime( $datetime_end );
|
||||
$time_ids = array_flip( wp_list_pluck( $data->intervals, 'time_interval' ) );
|
||||
|
@ -132,7 +132,7 @@ class WC_Admin_Reports_Data_Store {
|
|||
foreach ( $totals_arr as $key => $val ) {
|
||||
$totals_arr[ $key ] = 0;
|
||||
}
|
||||
// TODO: should 'products' be in intervals?
|
||||
// @todo: should 'products' be in intervals?
|
||||
unset( $totals_arr['products'] );
|
||||
while ( $datetime <= $end_datetime ) {
|
||||
$next_start = WC_Admin_Reports_Interval::iterate( $datetime, $time_interval );
|
||||
|
@ -336,7 +336,7 @@ class WC_Admin_Reports_Data_Store {
|
|||
$start_iteration = 0;
|
||||
}
|
||||
if ( $start_iteration ) {
|
||||
// TODO: is this correct? should it only be added if iterate runs? other two iterate instances, too?
|
||||
// @todo: is this correct? should it only be added if iterate runs? other two iterate instances, too?
|
||||
$new_start_date_timestamp = (int) $new_start_date->format( 'U' ) + 1;
|
||||
$new_start_date->setTimestamp( $new_start_date_timestamp );
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ class WC_Admin_Reports_Data_Store {
|
|||
$datetime = new DateTime( $interval['datetime_anchor'] );
|
||||
|
||||
$prev_start = WC_Admin_Reports_Interval::iterate( $datetime, $time_interval, true );
|
||||
// TODO: not sure if the +1/-1 here are correct, especially as they are applied before the ?: below.
|
||||
// @todo: not sure if the +1/-1 here are correct, especially as they are applied before the ?: below.
|
||||
$prev_start_timestamp = (int) $prev_start->format( 'U' ) + 1;
|
||||
$prev_start->setTimestamp( $prev_start_timestamp );
|
||||
if ( $datetime_start ) {
|
||||
|
|
|
@ -74,7 +74,7 @@ class WC_Admin_Reports_Orders_Stats_Data_Store extends WC_Admin_Reports_Data_Sto
|
|||
*/
|
||||
public static function init() {
|
||||
add_action( 'save_post', array( __CLASS__, 'sync_order' ) );
|
||||
// TODO: this is required as order update skips save_post.
|
||||
// @todo: this is required as order update skips save_post.
|
||||
add_action( 'clean_post_cache', array( __CLASS__, 'sync_order' ) );
|
||||
add_action( 'woocommerce_order_refunded', array( __CLASS__, 'sync_order' ) );
|
||||
add_action( 'woocommerce_refund_deleted', array( __CLASS__, 'sync_on_refund_delete' ), 10, 2 );
|
||||
|
@ -89,7 +89,7 @@ class WC_Admin_Reports_Orders_Stats_Data_Store extends WC_Admin_Reports_Data_Sto
|
|||
* @param array $intervals_query Array of options for intervals db query.
|
||||
*/
|
||||
protected function orders_stats_sql_filter( $query_args, &$totals_query, &$intervals_query ) {
|
||||
// TODO: performance of all of this?
|
||||
// @todo: performance of all of this?
|
||||
global $wpdb;
|
||||
|
||||
$from_clause = '';
|
||||
|
@ -98,7 +98,7 @@ class WC_Admin_Reports_Orders_Stats_Data_Store extends WC_Admin_Reports_Data_Sto
|
|||
|
||||
$where_filters = array();
|
||||
|
||||
// TODO: maybe move the sql inside the get_included/excluded functions?
|
||||
// @todo: maybe move the sql inside the get_included/excluded functions?
|
||||
// Products filters.
|
||||
$included_products = $this->get_included_products( $query_args );
|
||||
$excluded_products = $this->get_excluded_products( $query_args );
|
||||
|
|
|
@ -353,7 +353,7 @@ class WC_Admin_Reports_Products_Data_Store extends WC_Admin_Reports_Data_Store i
|
|||
// Shipping amount tax based on woocommerce code in includes/admin/meta-boxes/views/html-order-item(s).php
|
||||
// distribute simply based on number of line items.
|
||||
$shipping_tax_amount = 0;
|
||||
// TODO: if WC is currently not tax enabled, but it was before (or vice versa), would this work correctly?
|
||||
// @todo: if WC is currently not tax enabled, but it was before (or vice versa), would this work correctly?
|
||||
$order_taxes = $order->get_taxes();
|
||||
$line_items_shipping = $order->get_items( 'shipping' );
|
||||
$total_shipping_tax_amount = 0;
|
||||
|
@ -375,7 +375,7 @@ class WC_Admin_Reports_Products_Data_Store extends WC_Admin_Reports_Data_Store i
|
|||
$shipping_tax_amount = $total_shipping_tax_amount / $order_items * $product_qty;
|
||||
|
||||
// Tax amount.
|
||||
// TODO: check if this calculates tax correctly with refunds.
|
||||
// @todo: check if this calculates tax correctly with refunds.
|
||||
$tax_amount = 0;
|
||||
|
||||
$order_taxes = $order->get_taxes();
|
||||
|
@ -385,7 +385,7 @@ class WC_Admin_Reports_Products_Data_Store extends WC_Admin_Reports_Data_Store i
|
|||
$tax_amount += isset( $tax_data['total'][ $tax_item_id ] ) ? $tax_data['total'][ $tax_item_id ] : 0;
|
||||
}
|
||||
|
||||
// TODO: should net revenue be affected by refunds, as refunds are tracked separately?
|
||||
// @todo: should net revenue be affected by refunds, as refunds are tracked separately?
|
||||
$net_revenue = $order_item->get_subtotal( 'edit' ) - $amount_refunded;
|
||||
|
||||
// Coupon calculation based on woocommerce code in includes/admin/meta-boxes/views/html-order-item.php.
|
||||
|
@ -413,7 +413,7 @@ class WC_Admin_Reports_Products_Data_Store extends WC_Admin_Reports_Data_Store i
|
|||
'tax_amount' => $tax_amount,
|
||||
'shipping_amount' => $shipping_amount,
|
||||
'shipping_tax_amount' => $shipping_tax_amount,
|
||||
// TODO: can this be incorrect if modified by filters?
|
||||
// @todo: can this be incorrect if modified by filters?
|
||||
'product_gross_revenue' => $net_revenue + $tax_amount + $shipping_amount + $shipping_tax_amount,
|
||||
'refund_amount' => $amount_refunded,
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue