Parse overtime goals
This commit is contained in:
@@ -30,6 +30,7 @@ public class APIFootballMatch extends BaseMatch {
|
||||
throw new Exception("Did not find matchday for league '" + this.leagueId + "': '" + json.get("round").toString() + "'");
|
||||
}
|
||||
this.matchDatetime = (String) json.get("event_date");
|
||||
this.parseResult(json);
|
||||
}
|
||||
|
||||
public int getAPIFootBallMatchID() {
|
||||
@@ -74,4 +75,16 @@ public class APIFootballMatch extends BaseMatch {
|
||||
public Boolean getShowTable() {
|
||||
return this.showTable;
|
||||
}
|
||||
|
||||
private void parseResult(JSONObject json) {
|
||||
String resultFulltime = ((JSONObject) json.get("score")).get("fulltime").toString();
|
||||
this.goalsHome = Integer.parseInt(resultFulltime.substring(0, 1));
|
||||
this.goalsGuest = Integer.parseInt(resultFulltime.substring(2, 3));
|
||||
|
||||
Object resultExtratime = ((JSONObject) json.get("score")).get("extratime");
|
||||
if(resultExtratime != null) {
|
||||
this.goalsOvertimeHome = this.goalsHome + Integer.parseInt(resultExtratime.toString().substring(0, 1));
|
||||
this.goalsOvertimeGuest = this.goalsGuest + Integer.parseInt(resultExtratime.toString().substring(2, 3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user