ranking2(cached): Fixed rankcounting bug

This commit is contained in:
Torsten 2017-08-10 17:14:49 +02:00
parent 5b02895c86
commit d62b312eb0
3 changed files with 316 additions and 27 deletions

View file

@ -13,6 +13,32 @@ class Tipp extends Model
'id', 'user_id', 'game_id','score1','score2','joker'
];
public static function trendCol($score1, $score2, $tipp1, $tipp2, $joker) {
$tippTendenz = $tipp1 - $tipp2;
if ($tippTendenz > 0) {$tippTendenz=1;}
if ($tippTendenz < 0) {$tippTendenz=-1;}
$gameTendenz = $score1 - $score2;
if ($gameTendenz<0) {$gameTendenz=-1;}
if ($gameTendenz>0) {$gameTendenz=1;}
if ($tippTendenz!=$gameTendenz || $score1 ==-1 || $score2==-1 || $tipp1 == -1 || $tipp2==-1) {
return "";
}
$styling='background-color:grey;';
if ( ($tipp1 == $score1) && ($tipp2 == $score2) ) {
$styling='background-color:orange;';
if ($joker) {
$styling='background-color:red';
}
}
return $styling;
}
// get tendency Color
public static function getCol($user_id,$game_id) {
$tipp = Tipp::getTipp($user_id,$game_id);