Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions plugins/WorldCup2026/v1/dataStreams/scripts/knockout.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ var stageMap = {
result = matches.filter(function(m) { return !m.group; }).map(function(m) {
var score = '-';
var status = 'Upcoming';
if (m.score && m.score.ft) {
score = m.score.ft[0] + '-' + m.score.ft[1];
if (m.score && (m.score.et || m.score.ft)) {
// Prefer the score after extra time; fall back to the 90-minute (ft) score.
var base = m.score.et || m.score.ft;
score = base[0] + '-' + base[1];
if (m.score.p) {
score += ' (' + m.score.p[0] + '-' + m.score.p[1] + ' pens)';
}
status = 'Finished';
}

Expand Down
20 changes: 16 additions & 4 deletions plugins/WorldCup2026/v1/dataStreams/scripts/last-match.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,27 @@ if (played.length === 0) {
var last = played[0];
var isHome = last.team1 === teamName;
var opponent = isHome ? last.team2 : last.team1;
var myScore = isHome ? last.score.ft[0] : last.score.ft[1];
var oppScore = isHome ? last.score.ft[1] : last.score.ft[0];
var matchResult = myScore > oppScore ? 'Win' : myScore < oppScore ? 'Loss' : 'Draw';
// Prefer the score after extra time; fall back to the 90-minute (ft) score.
var base = last.score.et || last.score.ft;
var myScore = isHome ? base[0] : base[1];
var oppScore = isHome ? base[1] : base[0];
var score = myScore + '-' + oppScore;
var matchResult;
if (last.score.p) {
// Match went to a penalty shootout β€” the winner is decided on penalties.
var myPens = isHome ? last.score.p[0] : last.score.p[1];
var oppPens = isHome ? last.score.p[1] : last.score.p[0];
score += ' (' + myPens + '-' + oppPens + ' pens)';
matchResult = myPens > oppPens ? 'Win' : 'Loss';
} else {
matchResult = myScore > oppScore ? 'Win' : myScore < oppScore ? 'Loss' : 'Draw';
}

result = [{
date: last.date,
home_away: isHome ? 'Home' : 'Away',
opponent: opponent,
score: myScore + '-' + oppScore,
score: score,
result: matchResult,
stage: last.group ? 'Group Stage' : (knockoutStageMap[last.round] || last.round),
sourceId: sourceId
Expand Down
9 changes: 7 additions & 2 deletions plugins/WorldCup2026/v1/dataStreams/scripts/matches.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ filtered.sort(function(a, b) {
result = filtered.map(function(m) {
var score = '-';
var status = 'Upcoming';
if (m.score && m.score.ft) {
score = m.score.ft[0] + '-' + m.score.ft[1];
if (m.score && (m.score.et || m.score.ft)) {
// Prefer the score after extra time; fall back to the 90-minute (ft) score.
var base = m.score.et || m.score.ft;
score = base[0] + '-' + base[1];
if (m.score.p) {
score += ' (' + m.score.p[0] + '-' + m.score.p[1] + ' pens)';
}
status = 'Finished';
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/WorldCup2026/v1/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "worldcup2026",
"displayName": "FIFA World Cup 2026",
"version": "1.2.1",
"version": "1.2.2",
"author": {
"name": "@TimWheeler-SQUP",
"type": "community"
Expand Down
Loading