Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,
    to solve the initial problem (avoiding difference points with an exact draw prediction) you simply have to add a condidion in calc_score(..) that prevents adding an extra point in this situation: user prediction must be unequal to the game result.
    As it is clear that we handle only the draw games you must only compare one point (either home or guest) with the following condition:
    $score_vars['user_home'] != $score_vars['home']

    And all together the new method calc_score(..) will be:

    public static function calc_score( $score, $score_vars ) {
    		// check if score can be calculated
    		if ( $score_vars['do_calc'] ) {
    			// check if match result is draw and user also predicted a draw without having the exact tip
    			$is_full = ( $score_vars['home'] == $score_vars['user_home'] <strong>&& $score_vars['away'] == $score_vars['user_away'] </strong>);
    			if ( //! $is_full && 
    					$score_vars['home'] == $score_vars['away'] 
    					&& $score_vars['user_home'] == $score_vars['user_away']
    					&& $score_vars['user_home'] != $score_vars['home'] ) {
    				// first remove the mulfiplier if it was already added
    				$pool = new Football_Pool_Pool();
    				if ( $score_vars['joker'] == 1 && $pool->has_jokers && $score_vars['joker_multiplier'] > 0 ) {
    					$score['score'] = $score['score'] / $score_vars['joker_multiplier'];
    				}
    				
    				$score['score'] += $score_vars['diff'];
    				$score['goal_diff_bonus'] = 1;
    				
    				// and add the multiplier again
    				if ( $score_vars['joker'] == 1 && $pool->has_jokers ) {
    					$score['score'] = $score['score'] * $score_vars['joker_multiplier'];
    				}
    			}
    		}
    		return $score;
    	}

    Greetz,
    Johannes

    Thread Starter jojay99

    (@jojay99)

    OK, thank you!
    I added the HighCharts CSS to my CustomCSS and it worked.
    Greez!

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