Closed acupoftee closed 5 years ago
Team Schedule is now displayed after wrapping the retrieval code with a promise. Promise now needs to be properly handled to remove the warning.
let promise = new Promise(function (resolve, reject) {
let currentTime = new Date().getTime();
let slug = null;
for (let i = 0; i < stageData.length; i++) {
stage = stageData[i];
if (currentTime > stage.startDate && currentTime < stage.endDate) {
slug = stage.slug;
}
}
// organize data by stage and week
body.data.stages.forEach(_stage => {
if (_stage.slug === slug) {
stage = _stage.name;
_stage.weeks.forEach(week => {
week.matches.forEach(_match => {
if (_match.competitors[0].id == competitor.id || _match.competitors[1].id == competitor.id) {
let home = CompetitorManager.competitors.get(CompetitorManager.locateTeam(_match.competitors[1].abbreviatedName));
let away = CompetitorManager.competitors.get(CompetitorManager.locateTeam(_match.competitors[0].abbreviatedName));
let match = new Match(_match.id, (_match.state === 'PENDING') ? true : false,
_match.state, _match.startDate, home, away, _match.scores[1].value, _match.scores[0].value);
matches.push(match);
}
});
});
}
});
resolve(1);
});
The API added the Stage Playoffs as a week
but the teams aren't included yet. The code now needs to accommodate Stage Playoffs
API has removed the extra week containing null data for the stage week playoffs. API will be followed closely for further updates
!team <team> schedule
now throws an error stating the following below. This however was tested the same day earlier with the code unchanged and was able to pass.