You should be able to call the following to start a calculation:
Football_Pool_Admin::update_score_history( 'force' );
@antoineh
Thanks for the force refresh code, is there perhaps a same option for updating/adding scores from a certain match?
Thanks in advance man
-
This reply was modified 1 year, 3 months ago by
pixelhouse18.
-
This reply was modified 1 year, 3 months ago by
pixelhouse18.
I gave it another thought, and maybe it is better to copy some of the code in the two CLI classes for calculating the score and for importing results. Code can be found in the /cli folder
Calculation CLI uses this construct
$completed = 0;
$error = false;
$calc_args = array(
'force_calculation' => 'no',
'iteration' => 0,
);
while ( $completed !== 1 && $error === false ) {
$calc_args = Football_Pool_Admin_Score_Calculation::process( true, $calc_args );
extract( $calc_args, EXTR_OVERWRITE );
}
The results import just uses some SQL queries to update relevant tables.
If you want to automate stuff, you can also consider writing your own CLI function, schedule it via a cron, and kick off my CLI functions once you’re done.
Thanks Antoine you’re the best. I’ll check out your solution once i’m diving back in!