Advertisement
Guest User

Untitled

a guest
Jan 25th, 2015
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. var oddsDiff = 2;
  2.  
  3. // Constructor
  4. function Fixture(id,url,date,matchday,homeTeam,awayTeam,goalsHomeTeam,goalsAwayTeam) {
  5. this.matchID = id
  6. this.url = url;
  7. this.date = date.split("T")[0];
  8. this.matchday = matchday;
  9. this.homeTeamName = homeTeam;
  10. this.awayTeamName = awayTeam;
  11. this.goalsHomeTeam = goalsHomeTeam;
  12. this.goalsAwayTeam = goalsAwayTeam;
  13. var goalDiff = goalsHomeTeam - goalsAwayTeam;
  14. if (goalDiff == 0) {
  15. this.result = 'Draw'
  16. } else if (goalDiff > 0) {
  17. this.result = "HomeWin"
  18. } else {
  19. this.result = "AwayWin"
  20. };
  21. this.imp = false;
  22. this.homeOdds;
  23. this.awayOdds;
  24. this.drawOdds;
  25. }
  26.  
  27. // Change color when hit
  28. Fixture.prototype.addOdds = function(homeOdds,drawOdds,awayOdds) {
  29. this.homeOdds = homeOdds;
  30. this.awayOdds = awayOdds;
  31. this.drawOdds = drawOdds;
  32. if ((this.homeOdds < this.awayOdds - oddsDiff) && (this.result != "HomeWin")){
  33. this.imp = true;
  34. } else if ((this.awayOdds < this.homeOdds - oddsDiff) && (this.result != "AwayWin")){
  35. this.imp = true;
  36. } else {
  37. this.imp = false;
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement