Radio Streaming - 50% Lifetime Discount with purchase of any Joomla Web Radio Addon. Discount Code: STR15-Z
See Radio Streaming Plans

Results 1 to 5 of 5

Thread: Championship points error

  1. #1

    Championship points error

    Hi,

    We ran the championship this weekend and when admin inserted the results we noticed that the points are wrong, how do you change the point system within the championship ? Admin would like to change the point system as in the League. Or have we missing something ?
    Also when you add up the points as it shows at the moment, they do not add up correctly as shown in the points column.
    Another issue is that 2 players that played are showing 0 points even though they have predicted results, either score or just the result. How can this be changed to show the correct points ?

    Please check on our site at http://www.tipstersleague.co.uk/index.php/super-cup-predictions-tables

    regards
    Last edited by Sjf0464; 12-11-2016 at 09:03 PM.

  2. #2
    Administrator
    Join Date
    Jul 2015
    Posts
    65
    Hello,

    the championship point reward system is not configurable from the administration panel in the current version. Currently it is set to (group phase, 5 for win, 3 for draw, -1 for lose, and for KO, 5 for win , 3 for draw and 0 for lose)
    you can change this in file
    <joomla directory>/admin/components/com_masterleaguepro/models/minileaguescore.php

    around line 132
    Code:
    " SELECT mu.group_id,md.id as matchday,u.username,t.user_id,((t.correct_score*2)+(t.correct_result*3)+(t.incorrect_result*-1)) as points,(t.correct_result+t.incorrect_result) as matches,t.correct_score as win,t.correct_result-t.correct_score as draw,t.incorrect_result as lose,((t.correct_score*10+t.correct_result)/(t.correct_result+t.incorrect_result)) as rating,  ".
    for example if you want to have a reward system 10 win , 5draw , 0 lose your code will look like this

    Code:
    " SELECT mu.group_id,md.id as matchday,u.username,t.user_id,((t.correct_score*5)+(t.correct_result*5)+(t.incorrect_result*0)) as points,(t.correct_result+t.incorrect_result) as matches,t.correct_score as win,t.correct_result-t.correct_score as draw,t.incorrect_result as lose,((t.correct_score*10+t.correct_result)/(t.correct_result+t.incorrect_result)) as rating,  ".
    the value next to the t.correct_score is the extra points you get if you predict the exact score (users that predict the exact score they predict the result too so they will get points from the t.correct_result too)
    the value next to the t.correct_result is the extra points you get if you predict the result
    the value next to the t.incorrect_result is the points you get if your prediction was not correct

    around line 183 is the code for the KO phase
    Code:
    " ((z.correct_score*3)+(z.correct_result*2)+(z.incorrect_result*0)) as points, ".
    the same logic is applied here


    if the rewards are not 5-3-0 (win,lose,draw) then you will have to change the code in the file

    <joomla directory>/components/com_masterleaguepro/views/playerprediction/tmpl/default.php

    around line 286

    Code:
    if($item->start_date<=date("Y-m-d H:i:s")){
        if(isset($item->home_score)&&isset($item->away_score)&&$item->home_score!=""&&$item->away_score!=""){
            if($item->home_score==$item->home_prediction&&$item->away_score==$item->away_prediction){
                echo "5";
                $totalPoints=$totalPoints+5;
            }else if(
                    ($item->home_score>$item->away_score&&$item->home_prediction>$item->away_prediction) || 
                    ($item->home_score<$item->away_score&&$item->home_prediction<$item->away_prediction) || 
                    ($item->home_score==$item->away_score&&$item->home_prediction==$item->away_prediction) 
                    ){
                echo "3";
                $totalPoints=$totalPoints+3;
            }else{
                echo "0";
            }
        }else{
            echo "0";
        }
    }else{
        echo "0";
    }

    to replace values that begin with REPLACE_ text with your desired values

    Code:
    if($item->start_date<=date("Y-m-d H:i:s")){
        if(isset($item->home_score)&&isset($item->away_score)&&$item->home_score!=""&&$item->away_score!=""){
            if($item->home_score==$item->home_prediction&&$item->away_score==$item->away_prediction){
                echo "REPLACE_WIN_POINTS";
                $totalPoints=$totalPoints+REPLACE_WIN_POINTS;
            }else if(
                    ($item->home_score>$item->away_score&&$item->home_prediction>$item->away_prediction) || 
                    ($item->home_score<$item->away_score&&$item->home_prediction<$item->away_prediction) || 
                    ($item->home_score==$item->away_score&&$item->home_prediction==$item->away_prediction) 
                    ){
                echo "REPLACE_DRAW_POINTS";
                $totalPoints=$totalPoints+REPLACE_DRAW_POINTS;
            }else{
                echo "REPLACE_LOSE_POINTS";
            }
        }else{
            echo "0";
        }
    }else{
        echo "0";
    }

  3. #3
    Hi,

    Thanks for the reply.
    I have made the changes and points are now correct when looking at player prediction results.
    This has not sorted out the problems with 2 players not showing points in the group tables and mismatch of points totals from viewed prediction points and group points ?
    Also not changed the points in the group tables, is there a way to get these corrected ?
    regards
    Last edited by Sjf0464; 14-11-2016 at 10:10 PM.

  4. #4
    Administrator
    Join Date
    Jul 2015
    Posts
    65
    Hello,

    After the changes in the code for the point system, to refresh the points please go to "edit championship matches" and set the match status of 1 match from each matchday to "still playing" and then go to add score and save the matches again, this will refresh the points, so now the 2 players should have the correct points (because the previous system gave -1 points for each lose , they had 15 loses, and 3 points for each draw and they had 5 draws = 15 pts ) .

    The "Update Score" option works only for normal season, we may add support for updating the championship scores too.

    Kind Regards.

  5. #5
    Hi,

    thanks for the info. Worked a charm, loving this Component
    Last edited by Sjf0464; 16-11-2016 at 01:44 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •