PDA

View Full Version : Championship predictions



Sjf0464
07-11-2016, 12:52 PM
Hi,

created the the groups for the championship and created the predictions. 2 players have put in their predictions and they are already showing some points without scores being inserted, why ?
regards

kostas
07-11-2016, 03:50 PM
Hello,

There was an issue when the player predicted a draw , in the application logic the match is draw even before it starts, you can change the code to handle this exception with the following code

file : <joomla installation>/components/com_masterleaguepro/views/playerprediction/tmpl/default.php

around line 285

FROM :


<td><?php
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";
}
?></td>



TO:


<td><?php
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";
}
?></td>



the fix will be included in the next update

Sjf0464
07-11-2016, 09:53 PM
Many thanks for the reply.

I have changed the code and now all showing 0 points as it should.

regards