Point Editing general ranking

Moderator: And_One

nicos442
Newbie
Posts: 2
Joined: Tue Apr 29, 2014 6:23 pm

Point Editing general ranking

Postby nicos442 » Tue May 13, 2014 8:32 pm

Hello,

I would add points overall, eg, the origin is [2,1,0] I want [3,2,1,0]

I saw that fallai change the 'collect' from 'ranking.class.php' function but I can not find this file in my version 2.9.
Can you help me, thanks

The function code change

Code: Select all

function _collect($ptids = null)
    {
        $mode         = $this->_mode;
        $from         = $this->_from;
        $to           = $this->_to;
        $division     = $this->_division;
        $project      = $this->_project->getProject();
        $data         = $this->_initData();
       
        foreach ((array)$data->_matches as $match)
        {
       
        if ( !isset( $data->_teams[$match->projectteam1_id]) || $data->_teams[$match->projectteam1_id]->_is_in_score === 0
            || !isset( $data->_teams[$match->projectteam2_id]) || $data->_teams[$match->projectteam2_id]->_is_in_score === 0  )
        {
            continue;
        }
       
            if (!$this->_countGame($match, $from, $to, $ptids)) {
                continue;
            }
            if($match->projectteam1_id==0 || $match->projectteam2_id==0) {
                continue;
            }
            $homeId = $match->projectteam1_id;
            $awayId = $match->projectteam2_id;
           
            if ($mode == 0 || $mode == 1)
            {
                $home = &$data->_teams[$homeId];
            }
            else
            {
                $home = new JLGRankingTeam(0); //in that case, $data wont be affected
            }
            if ($mode == 0 || $mode == 2)
            {
                $away = &$data->_teams[$awayId];
            }
            else
            {
                $away = new JLGRankingTeam(0); //in that case, $data wont be affected
            }
           
            $shownegpoints = 1;
 
            $decision = $match->decision;
            if ($decision == 0)
            {
                $home_score=$match->home_score;
                $away_score=$match->away_score;
                $leg1=$match->l1;
                $leg2=$match->l2;
            }
            else
            {
                $home_score=$match->home_score_decision;
                $away_score=$match->away_score_decision;
                $leg1=0;
                $leg2=0;
            }
 
            $home->cnt_matches++;
            $away->cnt_matches++;
 
            $resultType = ($project->allow_add_time) ? $match->match_result_type : 0;
            //$resultType=2;
 
            $arr[0] = 0;
            $arr[1] = 0;
            $arr[2] = 0;
            $arr[3] = 0;
            //switch($resultType)
            //{
                //case 1: $arr = explode(",",$project->points_after_add_time);break;
                //case 2: $arr = explode(",",$project->points_after_penalty);break;
    //            default: $arr = explode(",",$project->points_after_regular_time);break;
            //}
            $arr = explode(",",$project->points_after_regular_time);
           
                $win_3points = $arr[0];
    $win_2points = $arr[1];
    $draw_points = $arr[2];
    $loss_points = $arr[3];
            /*$win3_points  = (isset($arr[0])) ? $arr[0] : 3;
            $win2_points  = (isset($arr[1])) ? $arr[1] : 2;
            $draw_points = (isset($arr[2])) ? $arr[2] : 1;
            $loss_points = (isset($arr[3])) ? $arr[3] : 0;
*/
            $home_ot=$match->home_score_ot;
            $away_ot=$match->away_score_ot;           
            $home_so=$match->home_score_so;
            $away_so=$match->away_score_so;
 
                /*echo $win_3points;
    echo $win_2points;
    echo $draw_points;
    echo $loss_points;*/
   
           
            if ($decision!=1) {
                if( $home_score > $away_score )
                {
                    if ( $home_score == 13 )
                    {       $point = 6;
                    }
                    switch ($resultType)
                    {
                    case 0:
                        $home->cnt_won++;
                        $home->cnt_won_home++;
                       
                        $away->cnt_lost++;
                        $away->cnt_lost_away++;   
                        break;
                    }               
                   
                   
                    if( $away_score < $point ) {
                    $home->sum_points += $win_3points; //home_score can't be null...
                } else {
                    $home->sum_points += $win_2points; //home_score can't be null...
                }
                if( $away_score < $point ) {
                    $away->sum_points += ( $decision == 0 || isset($away_score) ? $loss_points : 0);
                } else {
                    $away->sum_points += ( $decision == 0 || isset($away_score) ? $draw_points : 0);
                }
                //    $home->sum_points += $win_points; //home_score can't be null...                       
                //    $away->sum_points += ( $decision == 0 || isset($away_score) ? $loss_points : 0);
 
            /*        if ( $shownegpoints == 1 )
                    {
                        $home->neg_points += $loss_points;
                        $away->neg_points += ( $decision == 0 || isset($away_score) ? $win_points : 0);
                    }*/       
                }
                else if ( $home_score < $away_score )
                {
               
               if ( $away_score == 13 )
                {       $point = 6;
                }
                switch ($resultType) {
                    case 0: 
                        $home->cnt_lost++;
                        $home->cnt_lost_home++;
                       
                        $away->cnt_won++;
                        $away->cnt_won_away++;
                        break;
                    }                   
                                   
                //    $home->sum_points += ( $decision == 0 || isset($home_score) ? $loss_points : 0);           
                //    $away->sum_points += $win_points;
                    if( $home_score < $point ) {
                        $home->sum_points += ( $decision == 0 || isset($home_score) ? $loss_points : 0);
                    } else {
                        $home->sum_points += ( $decision == 0 || isset($home_score) ? $draw_points : 0);
                    }
                   
                    if( $home_score < $point ) {
                        $away->sum_points += $win_3points;
                    } else {
                        $away->sum_points += $win_2points;
                    }
                   
                }
            }
            /*winpoints*/
            $home->winpoints=$win_points;
           
            /* bonus points */
            $home->sum_points += $match->home_bonus;
            $home->bonus_points += $match->home_bonus;
 
            $away->sum_points += $match->away_bonus;
            $away->bonus_points += $match->away_bonus;
 
            /* goals for/against/diff */
            $home->sum_team1_result += $home_score;
            $home->sum_team2_result += $away_score;
            $home->diff_team_results = $home->sum_team1_result - $home->sum_team2_result;
            $home->sum_team1_legs   += $leg1;
            $home->sum_team2_legs   += $leg2;
            $home->diff_team_legs    = $home->sum_team1_legs - $home->sum_team2_legs;
 
            $away->sum_team1_result += $away_score;
            $away->sum_team2_result += $home_score;
            $away->diff_team_results = $away->sum_team1_result - $away->sum_team2_result;
            $away->sum_team1_legs   += $leg2;
            $away->sum_team2_legs   += $leg1;
            $away->diff_team_legs    = $away->sum_team1_legs - $away->sum_team2_legs;
 
            $away->sum_away_for += $away_score;
        }
           
        return $data->_teams;
    }

Heart
Joomleague Core Developer
Joomleague Core Developer
Posts: 653
Joined: Fri Apr 23, 2010 10:27 am

Re: Point Editing general ranking

Postby Heart » Wed May 14, 2014 10:39 am

Sorry, what do you want exactly (to be shown where)?


Return to “ranking”

Who is online

Users browsing this forum: No registered users and 1 guest

cron