Web project to create and manage bet leagues for any competition.
The bet types define the way that the points will be calculated
The bet will assign points depending on the team that pass to the next round, regardless the match itself.
The bet will assign points depending on the exact score of the match.
The bet will assign points depending on the teams that wins the game.
- Group stage
Score matters and result matters.
Specification:
if(game.scoreA && game.scoreB) {
if(bet.scoreA==game.scoreA && bet.scoreB==game.scoreB) {
result.winLevel=2;
result.points = 5;
} else {
if(bet.scoreA>bet.scoreB && game.scoreA>game.scoreB) {
result.winLevel=1;
result.points = 2;
} else {
if(bet.scoreA<bet.scoreB && game.scoreA<game.scoreB) {
result.winLevel=1;
result.points = 2;
} else {
if(bet.scoreA==bet.scoreB && game.scoreA==game.scoreB) {
result.winLevel=1;
result.points = 2;
} else {
result.winLevel=0;
result.points = 0;
}
}
}
}
}
- round of 16, quarter finals and semi finals
Side matters (we only want to know if a team success in that round)
Specification:
var totalPoints=0;
var foundA = false;
var foundB = false;
var existsGamesInRound = false;
for (var i=0;i<allGameSidesInRound.size();i++) {
var gameSide = allGameSidesInRound.get(i);
if (gameSide) {
existsGamesInRound = true;
if (bet.gameSideA != null && bet.gameSideA.name == gameSide.name) {
foundA=true;
totalPoints += 5; //5 in round of 16, 15 in quarter finals and 25 in semi finals
}
if (bet.gameSideB != null && bet.gameSideB.name == gameSide.name) {
foundB = true;
totalPoints += 5; //5 in round of 16, 15 in quarter finals and 25 in semi finals
}
}
}
if (existsGamesInRound) {
result.points = totalPoints;
if(foundA) {
result.sideAWinLevel = 2;
} else {
result.sideAWinLevel = 0;
}
if(foundB) {
result.sideBWinLevel = 2;
} else {
result.sideBWinLevel = 0;
}
}
- Final Side matters and result matters (we want to give points if the user guess the teams that reach the final, and more points when the user guess the winner.
Specification:
var totalPoints=0;
var foundA = false;
var foundB = false;
var existsGamesInRound = false;
for (var i=0;i<allGameSidesInRound.size();i++) {
var gameSide = allGameSidesInRound.get(i);
if (gameSide) {
existsGamesInRound = true;
if (bet.gameSideA != null && bet.gameSideA.name == gameSide.name) {
foundA=true;
totalPoints += 35;
}
if (bet.gameSideB != null && bet.gameSideB.name == gameSide.name) {
foundB = true;
totalPoints += 35;
}
}
}
if ((game.scoreA > game.scoreB) && (result.betWinner != null) && (game.gameSideA.name == result.betWinner.name)) {
totalPoints += 50;
}
if ((game.scoreB > game.scoreA) && (result.betWinner != null) && (game.gameSideB.name == result.betWinner.name)) {
totalPoints += 50;
}
if (existsGamesInRound) {
result.points = totalPoints;
if(foundA) {
result.sideAWinLevel = 2;
} else {
result.sideAWinLevel = 0;
}
if(foundB) {
result.sideBWinLevel = 2;
} else {
result.sideBWinLevel = 0;
}
}
The group games are known before the competition starts. The playoff games will be updated with the teams as the competition goes on, but the games must be created before to be able to ask the bets to the users.
Once the competition is ready, multiple leagues can be created to that competition. Each league can define the bet type for each game in the league. This is usefull when you want to create different leagues with different rules.
Once the league is created, the people will be able to send their bets before the league deadline. As the games finish, the administrators must update the game results and playoff teams to recalculate the scoreboards.