Support » Plugin: Football Pool » Prediction page problem

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author AntoineH

    (@antoineh)

    Depends on what the problem is. Do you have access to the error logs? Or do you see any errors in the server response (network tab in the browser’s dev tools)?

    Thread Starter kleb123

    (@kleb123)

    Which error logs exactly?
    In the network tab I don’t see any difference in the ‘admin-ajax.php’ for scores which are saved (the home score) and not saved (away).

    Plugin Author AntoineH

    (@antoineh)

    Which error logs exactly?

    You’ll need to (temporarily) enable debugging. More info here.

    Thread Starter kleb123

    (@kleb123)

    I hope this gives more information 😉

    [26-Sep-2022 11:01:28 UTC] WordPress databasefout Duplicate entry '209117162-43' for key 'PRIMARY' bij query INSERT INTO pool_wp_predictions ( user_id, match_id, home_score, away_score, has_joker ) 
    							VALUES ( 209117162, 43, 1, NULL, 0 ) gemaakt door do_action('wp_ajax_footballpool_update_team_prediction'), WP_Hook->do_action, WP_Hook->apply_filters, Football_Pool_Pool::update_prediction
    [26-Sep-2022 11:01:28 UTC] WordPress databasefout Duplicate entry '209117162-43' for key 'PRIMARY' bij query INSERT INTO pool_wp_predictions ( user_id, match_id, home_score, away_score, has_joker ) 
    							VALUES ( 209117162, 43, NULL, 1, 0 ) gemaakt door do_action('wp_ajax_footballpool_update_team_prediction'), WP_Hook->do_action, WP_Hook->apply_filters, Football_Pool_Pool::update_prediction
    Plugin Author AntoineH

    (@antoineh)

    Yes, it does. Somehow the plugin tries to insert the prediction for the away team as a separate row. Which is not allowed. It should update the existing row with the prediction for the home score.

    I will investigate tonight if I can fix this.

    Thread Starter kleb123

    (@kleb123)

    Thank you! 👍🏽 Hope it will be resolved.

    Plugin Author AntoineH

    (@antoineh)

    Question: do you have any caching plugins enabled? If so, which one?

    Thread Starter kleb123

    (@kleb123)

    Yes, WP Rocket 3.10.6

    Plugin Author AntoineH

    (@antoineh)

    Do you have the same problems when you disable this plugin?

    Thread Starter kleb123

    (@kleb123)

    Just tried, sadly enough the same problems.

    (It’s not just only the away team prediction, it also happens most of the times with the home prediction)

    Plugin Author AntoineH

    (@antoineh)

    Unfortunately, I can’t test with the WP Rocket plugin since it is a paid plugin. But I would recommend searching through its docs to try to exclude (parts of) the football pool plugin.

    The code that saves the predictions checks if there already is a prediction and in case there is, it will update the database. If not, it will insert a new row. Since my plugin uses WP’s own cache object to store this data, I assume that this conflicts with the caching plugin. The error message that you get in the log indicates that it does not know that there was a previous save for a same match.

    As a fallback, you can also disable the AJAX saves on the front-end by adding the following to the wp-config:

    define( 'FOOTBALLPOOL_FRONTEND_AJAX', false );

    Not ideal, but if it works, this will at least let you use the plugin.

    Thread Starter kleb123

    (@kleb123)

    I tried both https://docs.wp-rocket.me/article/1384-disable-page-cache-for-specific-pages-and-posts and https://docs.wp-rocket.me/article/1385-disable-page-caching-for-logged-in-users , but both without result.

    I can give you admin access to look if that helps to resolve the problem?

    Thread Starter kleb123

    (@kleb123)

    Now it says the prediction is saved (so no red error bar) but after refreshing the prediction is not saved. I don’t get any info in debug logs about it.

    Plugin Author AntoineH

    (@antoineh)

    I can give you admin access to look if that helps to resolve the problem?

    Admin access won’t help. If you want to get to the bottom of this, then the only option is debugging, setting some breakpoints and watching the state of some variables.

    but after refreshing the prediction is not saved

    Refreshing won’t tell you all. If there is still some page/object cache from your caching plugin, then your not seeing what is actually present in the database. If you have phpmyadmin or a similar tool, you can do a lookup in the database to see if the prediction was saved. If yes, then you’re still facing some caching issues.

    Thread Starter kleb123

    (@kleb123)

    OK, I meant if you could maybe take a look into it in my website since I’m not very experienced in this stuff 😅😂

    Disabling AJAX save helps to at least use the pool, so I think that will be the solution.

Viewing 15 replies - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.