Fix matches results updater
This commit is contained in:
@@ -79,14 +79,23 @@ public class APIFootballMatch extends BaseMatch {
|
||||
private void parseResult(JSONObject json) {
|
||||
Object resultFulltime = ((JSONObject) json.get("score")).get("fulltime");
|
||||
if(resultFulltime != null) {
|
||||
this.goalsHome = Integer.parseInt(resultFulltime.toString().substring(0, 1));
|
||||
this.goalsGuest = Integer.parseInt(resultFulltime.toString().substring(2, 3));
|
||||
String[] result = resultFulltime.toString().split("-");
|
||||
this.goalsHome = Integer.parseInt(result[0]);
|
||||
this.goalsGuest = Integer.parseInt(result[1]);
|
||||
}
|
||||
|
||||
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));
|
||||
String[] result = resultExtratime.toString().split("-");
|
||||
this.goalsOvertimeHome = this.goalsHome + Integer.parseInt(result[0]);
|
||||
this.goalsOvertimeGuest = this.goalsGuest + Integer.parseInt(result[1]);
|
||||
}
|
||||
|
||||
Object resultPenalty = ((JSONObject) json.get("score")).get("penalty");
|
||||
if(resultPenalty != null) {
|
||||
String[] result = resultPenalty.toString().split("-");
|
||||
this.goalsPenaltyHome = this.goalsOvertimeHome + Integer.parseInt(result[0]);
|
||||
this.goalsPenaltyGuest = this.goalsOvertimeGuest + Integer.parseInt(result[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user