Skip to content

Commit

Permalink
Camptix stats: move ticket viewing stat to separate option and avoid …
Browse files Browse the repository at this point in the history
…autoloading
  • Loading branch information
pkevan committed Oct 31, 2024
1 parent f83f4df commit b13877c
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion public_html/wp-content/plugins/camptix/camptix.php
Original file line number Diff line number Diff line change
Expand Up @@ -2392,6 +2392,23 @@ function update_stats( $key, $value ) {
return;
}

/**
*
* Increments the stat used on the ticket form.
*
* @param $key
* @return void
*/
function increment_ticket_form_stat( $key ) {
if ( $key !== 'tickets_form_unique_visitors' ) {
return;
}
$viewing_stat = get_option( 'camptix_ticket_form_stat', 0 );
$viewing_stat++;
update_option( 'camptix_ticket_form_stat', $viewing_stat, 'no' );
return;
}

/**
* Increments a stats value.
*/
Expand Down Expand Up @@ -2482,7 +2499,7 @@ public function process_client_stats() {

switch ( $_REQUEST['command'] ) {
case 'increment':
$this->increment_stats( $_REQUEST['stat'] );
$this->increment_ticket_form_stat( $_REQUEST['stat'] );
wp_send_json_success();
break;
}
Expand Down Expand Up @@ -2701,6 +2718,14 @@ function generate_revenue_report_data() {
$this->update_stats( 'discounted', $totals->discounted );
$this->update_stats( 'revenue', $totals->revenue );

$this->update_stats_multi( [
'sold' => $totals->sold,
'remaining' => $totals->remaining,
'subtotal' => $totals->sub_total,
'discounted' => $totals->discounted,
'revenue' => $totals->revenue,
] );

$results = array(
'totals' => $totals,
'actual_total' => $actual_total,
Expand Down

0 comments on commit b13877c

Please sign in to comment.