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

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Points awarded Mk II

  1. #1
    Super Moderator
    Join Date
    Mar 2012
    Posts
    183

    Points awarded Mk II

    --------------------------------------------------
    Topic Transfered from old forum
    --------------------------------------------------

    Hello

    thank you for your kind words, we will consider your request in future release , but this change is possible to be made by changing the core code. The code responsible for the score system is located at <joomla directory>/components/com_multileague/models/standings.php

    in the function getStandings()

    if you decide to make the change by yourself we could help you in some parts.
    Thanks for the offer of help, I wonder if it a straightforward task to implement the following changes and provide me with the amended code?

    Points awarded for correct result and scores as set-up by admin in league configuration as normal but ...
    requested amendments;
    Where a player predicts the correct result which IS NOT a home win, plus 1 additional point.
    Where a player predicts the exact score which IS NOT a home win, plus 1 additional point.

    Therefore successful home win prediction, score and results points as normal
    Successful draw or away win prediction, additional rewards.

    My reasons, for anyone interested are these;
    The most favourable points system I found to use is, incorrect prediction 1 point, correct result/wrong score 2 points, exact score an additional 1 point.
    So a player gets 3pts for exact score, 2pts for an incorrect score but correct result, and 1 point for an incorrect result.

    One point for being wrong may look strange but I feel it encourages participation ~ points just for making your predictions, what's not to like?
    The low points spread I feel keeps the leagues competitive. Inasmuch the leaders never get too far in front as to demoralise those nearer the bottom of the table ~ one good week and I'll be back in contention.

    However, no matter how admin configure the points system, and this is true for the majority of correct score leagues, a player who wants to "play the percentages" can prosper.

    Different league results vary of course, but even then home wins still account for around 50% of all results.

    So ... the smart competitor just marks EVERY game to finish 1-0, in the knowledge they will be very close to the top of a league, if not number one, AND with an excellent GF, GA & GD record.
    (try it on any of your own leagues!)

    My proposal of extra points for away wins and drawn results should (I hope) combat the percentages tactic to a limited degree.

    I hope this all makes sense, and there are no flaws in my logic?
    Support Operator
    MultiHosting.com

  2. #2
    Super Moderator
    Join Date
    Mar 2012
    Posts
    183
    --------------------------------------------------
    Topic Transfered from old forum
    --------------------------------------------------

    Even after the above there is still one further vulnerability to the percentage players - the frequent 1-1 draw result. But would adding in that condition make the amendments too difficult?

    Rules for additional points criteria to cover 1-1 draws would need to change to;

    Where a player predicts the correct result and/or score which <> home win AND <> 1-1 draw
    Support Operator
    MultiHosting.com

  3. #3
    Super Moderator
    Join Date
    Mar 2012
    Posts
    183
    --------------------------------------------------
    Topic Transfered from old forum
    --------------------------------------------------
    Hello Stef and sorry for the delay

    we will guide you how to make those custom changes

    you will have to edit two files.

    1)<joomla directory>/administrator/components/com_masterleaguepro/models/addscore.php

    function updateUsersLog , line 339

    comment the previous Query

    and add this one instead

    $query="REPLACE INTO `#__masterleaguepro_user_log` (user_id,matchday_id,league_id,points,position,win ,draw,lose,matches_played,goal_for,goal_against,go al_difference)
    SELECT z.user_id,z.matchday,z.league_id,z.points,z.positi on,z.win,z.draw,z.lose,(z.win+z.draw+z.lose) as match_played,z.gu,z.gk,(z.gu+z.gk) as gtotal
    FROM(
    SELECT mu.league_id,md.id as matchday,u.username,t.user_id,
    ((t.correct_score*l.correct_score)+(t.correct_resu lt*l.correct_result)+(t.incorrect_result*l.incorre ct_result)+t.not_home_wins+t.not_draw_one_one) 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,
    @rownum := @rownum+1 AS position ,(t.gu_home+t.gu_away) as gu,(t.gk_home+t.gk_away) as gk
    FROM(
    SELECT
    us.id as user_id,
    SUM(IF(pp.home_prediction=m.home_score AND pp.away_prediction=m.away_score,1,0)) AS correct_score,
    SUM(IF(((pp.home_prediction<pp.away_prediction AND m.home_score<m.away_score)
    OR (pp.home_prediction>pp.away_prediction AND m.home_score>m.away_score)
    OR (pp.home_prediction=pp.away_prediction AND m.home_score=m.away_score)
    ),1,0))AS correct_result,
    SUM(IF(((pp.home_prediction<pp.away_prediction AND m.home_score>=m.away_score)
    OR (pp.home_prediction>pp.away_prediction AND m.home_score<=m.away_score)
    OR (pp.home_prediction=pp.away_prediction AND m.home_score!=m.away_score)
    ),1,0))AS incorrect_result,
    SUM(IF(pp.home_prediction<pp.away_prediction AND m.home_score<m.away_score,1,0)) AS not_home_wins,
    SUM(IF(pp.home_prediction=pp.away_prediction AND m.home_score=m.away_score AND pp.home_prediction!=1,1,0)) as not_draw_one_one,
    SUM(IF(pp.home_prediction=m.home_score,1,0))AS gu_home,
    SUM(IF(pp.away_prediction=m.away_score,1,0))AS gu_away,
    SUM(IF(pp.home_prediction!=m.home_score,-1,0))AS gk_home,
    SUM(IF(pp.away_prediction!=m.away_score,-1,0))AS gk_away
    FROM `#__users` us
    LEFT JOIN `#__masterleaguepro_player_prediction` pp ON pp.user_id=us.id
    LEFT JOIN `#__masterleaguepro_match` m ON m.id=pp.match_id AND m.matchday_id=$matchday_id
    GROUP BY us.id
    )t
    JOIN (SELECT @rownum := 0) r
    INNER JOIN `#__users` u ON t.user_id=u.id
    INNER JOIN `#__masterleaguepro_users` mu ON mu.user_id=u.id
    INNER JOIN `#__masterleaguepro_matchday` md ON md.id=$matchday_id
    INNER JOIN `#__masterleaguepro_seasons` s ON s.id=md.season_id
    INNER JOIN `#__masterleaguepro_leagues` l ON l.season_id=s.id AND mu.league_id=l.id
    ORDER BY points DESC,rating DESC
    ) z
    ORDER BY z.points DESC,z.gu DESC ,gtotal DESC";


    and do the same change into the file

    1)<joomla directory>/administrator/components/com_masterleaguepro/models/editmatches.php

    function updateUsersLog, line 237


    we tested the queries direct in database and they worked fine, if there would be any issue let us know.
    Support Operator
    MultiHosting.com

  4. #4
    Super Moderator
    Join Date
    Mar 2012
    Posts
    183
    --------------------------------------------------
    Topic Transfered from old forum
    --------------------------------------------------

    Many thanks Kostas, I'll give that a try.

    Couldn't help noticing though the Query in addscores.php had a few extra lines over the Query in editmatches.php, the first had 35 lines, the other 31 lines.

    So the queries were not identical before, but they will be after the edit?
    Support Operator
    MultiHosting.com

  5. #5
    Super Moderator
    Join Date
    Mar 2012
    Posts
    183
    --------------------------------------------------
    Topic Transfered from old forum
    --------------------------------------------------

    Yes there is no problem. normally there should be just one functions (we will merge them in future)
    Support Operator
    MultiHosting.com

  6. #6
    Super Moderator
    Join Date
    Mar 2012
    Posts
    183
    --------------------------------------------------
    Topic Transfered from old forum
    --------------------------------------------------
    Thanks for the amendments, having thoroughly tested no bugs found and all works well.

    I was hoping however that the additional points would be cumulative, for example a correct away score or draw (other than 1-1) would attract TWO bonus points.
    Perhaps there's an 'AND' where an 'OR' should be (or vice-versa)? I've studied the code but not being PHP or MySQL query proficient I'm in the dark.

    No matter though, it works well as it is, so changes necessary.

    However, if it were possible could you add one final amendement for me?
    The facility to award extra bonus points (in addition to all other points) where the correct predicted score has total goals scored greater than 3.

    So, the extra bonus points added would be;

    $total_goals = $home_score + $away_score

    If $total_goals > 3
    $bonus_points == $total_goals - 3
    Else
    $bonus_points == 0


    A correct 3-3 or 5-1 score would attract 3 bonus points.
    A correct 2-2 draw would attract just 1 bonus point.
    etc.

    Many thanks for your help,

    Buddy
    Support Operator
    MultiHosting.com

  7. #7
    Super Moderator
    Join Date
    Mar 2012
    Posts
    183
    --------------------------------------------------
    Topic Transfered from old forum
    --------------------------------------------------

    about the first issue , the query is counting the bonus points for matches that are not 1-1 and for the matches that the result is not a home win in different "variables" and it adds them to the total score , so normally it should accumulate this two points the case where the score is a correct away score or draw other than 1-1.


    this is the new query that handles the "huge scores" when a player has made the correct predictions and the total goals are greater than 3 then he gets extra points "total goals-3".

    Attachment: query.txt (2.75kb)
    The file has been downloaded 2 time
    Support Operator
    MultiHosting.com

  8. #8
    Junior Member
    Join Date
    Jul 2015
    Posts
    20
    Quote Originally Posted by 3hills View Post
    --------------------------------------------------
    Topic Transfered from old forum
    --------------------------------------------------

    Yes there is no problem. normally there should be just one functions (we will merge them in future)
    Have the functions been merged in upgrade version 1.0.6?

    If not, can I simply paste the query amendments you supplied before into the same two php files within v 1.0.6?

    Buddy

  9. #9
    Administrator
    Join Date
    Jul 2015
    Posts
    65
    Quote Originally Posted by Buddy View Post
    Have the functions been merged in upgrade version 1.0.6?

    If not, can I simply paste the query amendments you supplied before into the same two php files within v 1.0.6?

    Buddy
    in the version 1.0.6 we changed how the points are calculated so the previous query won't work , but we considered your feature request about a better point system so we applied all of your proposals.

    So now when you go to the Components -> Masterleague Pro , and go to the Options , there are some new options in the version 1.0.6
    you can set extra points for home win, draw, away win (can be negative too).

    the Big score limit is the one you suggested that player gets bonus points if the total points are greater than 3 , now you can select this limit .

    Also we added bonus points (and punishment) for exact score , e.g if you think that the 1-0 score is a common score you can add a punishment for example to decrease 1 point and for score like 0-3 and 0-4 to give reward 2 points you will add the following settings

    Special score that will increase points e.g (1-1,2-3,5-0) : 0-3,0-4
    Special score reward points : 2,2
    Special score that will decrease points e.g (0-0,1-0,0-1) : 1-0
    Special score punishment : 1

    All this points are additional to the points that users will get through league configuration

    after you change thos points the system won't update automatically the history so you can update it via the new Button from the control panel Update Score and select the season you want to update and hit the button Update Score.


    so let me show you the how you should configure the point system in order to work like your proposed before the 1.0.6 update


    Extra points (home win) : 0
    Extra points (draw) : 1
    Extra points (away win) : 1
    Big score limit : 3
    Special score that will increase points e.g (1-1,2-3,5-0) : (blank)
    Special score reward points : (blank)
    Special score that will decrease points e.g (0-0,1-0,0-1) : 1-1
    Special score punishment : 1



    so you give 1 extra point for draw and away win but you decrease 1 point if the draw score is 1-1
    if total goals are greater than 3 the player get extra point : extra point = total-goal - 3

    hope you understand the new sytem , we are here to help you understand it , you can type for example how you want the system to work and we will try to help you to understand how to set the configurations.
    Last edited by kostas; 18-07-2015 at 03:40 PM.

  10. #10
    Junior Member
    Join Date
    Jul 2015
    Posts
    20
    Quote Originally Posted by kostas View Post
    so let me show you the how you should configure the point system in order to work like your proposed before the 1.0.6 update

    Extra points (home win) : 0
    Extra points (draw) : 1
    Extra points (away win) : 1
    Big score limit : 3
    Special score that will increase points e.g (1-1,2-3,5-0) : (blank)
    Special score reward points : (blank)
    Special score that will decrease points e.g (0-0,1-0,0-1) : 1-1
    Special score punishment : 1
    Thanks for the explanation, much appreciated.

    I needed to satisfy myself that I understand how everything works though, so I set up a single game with various user predictions to check that the points awarded were as I would expect them to be.

    Under Masterleague Pro > Options I placed the settings exactly as your suggestion quoted above.
    My master points in the League set-up were ...
    Correct score = 1
    Correct result = 1
    Incorrect result = 0

    Testing final scores of 1-0, 1-1 and 0-0 gave the point values I expected to see from the various predictions ...

    But I then tested for a game with a final score of away win, 0-1
    A user who predicted 1-2 was awarded 1 point, whereas I'd expected it to be 2 points (1 for correct result, additional 1 for away win, no deductions)

    Have I missed something? (wouldn't be the first time) Or have I misinterpreted what's happening?

    Buddy

Page 1 of 2 12 LastLast

Posting Permissions

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