• i’m trying to hook a live score api to your plugin, and would like to update the score automatically when a match is finished. And calculate the points?

    is there a way we can do that trough code?

    thanks in advance!

    • This topic was modified 1 year, 3 months ago by pixelhouse18.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author AntoineH

    (@antoineh)

    You should be able to call the following to start a calculation:

    Football_Pool_Admin::update_score_history( 'force' );
    Thread Starter pixelhouse18

    (@pixelhouse18)

    @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.
    Plugin Author AntoineH

    (@antoineh)

    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.

    Thread Starter pixelhouse18

    (@pixelhouse18)

    Thanks Antoine you’re the best. I’ll check out your solution once i’m diving back in!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Adding the score trough api or code?’ is closed to new replies.