{"id":17826561,"date":"2024-06-14T22:01:37","date_gmt":"2024-06-14T22:01:37","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/calculation-error-7\/"},"modified":"2024-06-14T22:13:21","modified_gmt":"2024-06-14T22:13:21","slug":"calculation-error-7","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/calculation-error-7\/","title":{"rendered":"Calculation Error"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hi,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I have problem with calculation and I get error message every time. I enabled debug and it&#8217;s giving me this error code:<br \/><br \/>PHP <strong>Fatal<\/strong> <strong>error:<\/strong> &nbsp;Football Pool =&gt; default ranking with ID 1 is missing in the <code>pool_wp_rankings<\/code> table in \/share\/CACHEDEV1_DATA\/Web\/MyBet\/wp-content\/plugins\/football-pool\/admin\/class-football-pool-admin-score-calculation.php on line 1089<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8230;so it&#8217;s pointing on this function<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>private static function get_rankings(): ?array\n{\n    $cache_key = 'fp_calc_rankings';\n    if ( ! self::cache_key_exists( $cache_key ) ) {\n        global $wpdb;\n        $prefix = FOOTBALLPOOL_DB_PREFIX;\n\n        $sql = \"SELECT id FROM {$prefix}rankings ORDER BY id ASC\";\n        $rankings = $wpdb-&gt;get_col( $sql );\n\n        \/\/ throw error if the default ranking is missing from the database\n        if ( count( $rankings ) === 0 || ! in_array( FOOTBALLPOOL_RANKING_DEFAULT, $rankings ) ) {\n            trigger_error( 'Football Pool =&gt; default ranking with ID ' . FOOTBALLPOOL_RANKING_DEFAULT .\n                ' is missing in the <code>' . FOOTBALLPOOL_DB_PREFIX . 'rankings<\/code> table', E_USER_ERROR );\n        }\n\n        $rankings = array_map( 'intval', $rankings );\n\n        self::set_value_in_cache(\n            $cache_key,\n            apply_filters( 'footballpool_score_calc_rankings', $rankings )\n        );\n    }\n\n    return self::get_value_from_cache( $cache_key );\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Can you point me the way where to find what is wrong, please ? \ud83d\ude42<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Great job with the plugin, I&#8217;m just messing my site, thanks! \ud83d\ude00<\/p>\n","protected":false},"template":"","class_list":["post-17826561","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17826561","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17826561\/revisions"}],"predecessor-version":[{"id":17826575,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17826561\/revisions\/17826575"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=17826561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}