j0k3r / worldcup-slack-bot

WorldCupBot will notify a Slack channel/group for every match during a FIFA World Cup
MIT License
40 stars 29 forks source link

Straight red card type number #8

Closed oltodo closed 6 years ago

oltodo commented 6 years ago

According the previous Colombia/Japan match, it seems the type number for the straight red card is 3 but not 4 like the following defines.

https://github.com/j0k3r/worldcup-slack-bot/blob/c23aa06dc65ab3a8d3873326253c9ccf0d1774eb/worldCupNotifier.php#L88

Refer to the match's events :

https://api.fifa.com/api/v1/timelines/17/254645/275073/300331550?language=fr-FR&count=1

{
  "EventId": "-1011232931",
  "IdTeam": "43926",
  "IdPlayer": "280487",
  "IdSubPlayer": null,
  "Timestamp": "2018-06-19T12:03:58.871Z",
  "MatchMinute": "3'",
  "Period": 3,
  "HomeGoals": 0,
  "AwayGoals": 0,
  "Type": 3,
  "TypeLocalized": [],
  "PositionX": null,
  "PositionY": null,
  "GoalGatePositionX": null,
  "GoalGatePositionY": null,
  "GoalGatePositionZ": null,
  "VarDetail": null,
  "HomePenaltyGoals": 0,
  "AwayPenaltyGoals": 0
}
j0k3r commented 6 years ago

You mean we need to switch these values?

const EVENT_SECOND_YELLOW_CARD_RED = 3; // Maybe?
const EVENT_STRAIGHT_RED = 4; // Maybe?

No matters the value, we handle them in the same way: https://github.com/j0k3r/worldcup-slack-bot/blob/master/worldCupNotifier.php#L344-L349

oltodo commented 6 years ago

I still don't know what is the EVENT_SECOND_YELLOW_CARD_RED value but yes, you can switch the values for now. Indeed, it not changes anything in your case. So it was just for information. 😉

oltodo commented 6 years ago

And you could remove the // Maybe? for the EVENT_STRAIGHT_RED constant.