Module:Sports series: Difference between revisions

Content deleted Content added
rmv unnecessary code
allow for coloring aggregate score yellow for single-leg draws
Line 82:
local manualBold = false
local manualColor = false
local isDraw = false
 
-- Handling for manual bolding
Line 138 ⟶ 139:
team1Winner = tonumber(score1) > tonumber(score2)
team2Winner = tonumber(score1) < tonumber(score2)
isDraw = tonumber(score1) == tonumber(score2)
end
end
 
return team1, team2, team1Winner, team2Winner, manualBold, manualColor, isDraw
end
 
Line 334 ⟶ 336:
local row = table:tag('tr')
local team1, aggregateScore, team2
local team1Winner, team2Winner, manualBold, manualColor, isDraw = false, false, false, false, false
local team1Asterick, team2Asterick = false, false
 
Line 359 ⟶ 361:
local cleanAggregate = cleanScore(aggregateScore)
-- Determine the winning team on aggregate
team1, team2, team1Winner, team2Winner, manualBold, manualColor, isDraw = determineWinner(cleanAggregate, matchType, team1, team2, boldWinner, colorWinner)
-- Add background-color for winning team if set by user
local team1Style = team1Winner and ((colorWinner or manualColor) and 'background-color: #CCFFCC;' or '') .. 'text-align: right;' or 'text-align: right;'
Line 380 ⟶ 382:
team2Text = '<span class="flagicon">[[File:Flag placeholder.svg|25x17px|link=]]</span> ' .. team2Text
end
end
-- Create aggregate score cell with conditional styling
local aggregateStyle = 'text-align: center;'
if legs == 0 and isDraw and colorWinner then
aggregateStyle = aggregateStyle .. '; background-color: #FFFFBB;'
end
-- Create rows for aggregate score and team names, bolded if set by user
row:tag('td'):cssText(team1Style):wikitext((team1Winner and (boldWinner or manualBold) and team1Text ~= '') and ('<strong>' .. team1Text .. '</strong>') or team1Text)
row:tag('td'):csscssText('text-align', 'center'aggregateStyle):wikitext(aggregateScore)
row:tag('td'):cssText(team2Style):wikitext((team2Winner and (boldWinner or manualBold) and team2Text ~= '') and ('<strong>' .. team2Text .. '</strong>') or team2Text)
else
Line 400 ⟶ 407:
local cleanAggregate = cleanScore(aggregateScore)
-- Determine the winning team on aggregate
team1, team2, team1Winner, team2Winner, manualBold, manualColor, isDraw = determineWinner(cleanAggregate, matchType, team1, team2, boldWinner, colorWinner)
-- Add background-color for winning team if set by user
local team1Style = team1Winner and ((colorWinner or manualColor) and 'background-color: #CCFFCC;' or '') .. 'text-align: right;' or 'text-align: right;'
Line 417 ⟶ 424:
end
end
end
-- Create aggregate score cell with conditional styling
local aggregateStyle = 'text-align: center;'
if legs == 0 and isDraw and colorWinner then
aggregateStyle = aggregateStyle .. '; background-color: #FFFFBB;'
end
-- Create rows for aggregate score and team names, bolded if set by user
row:tag('td'):cssText(team1Style):wikitext((team1Winner and (boldWinner or manualBold)) and '<strong>' .. team1Text .. '</strong>' or team1Text)
row:tag('td'):csscssText('text-align', 'center'aggregateStyle):wikitext(aggregateScore)
row:tag('td'):cssText(team2Style):wikitext((team2Winner and (boldWinner or manualBold)) and '<strong>' .. team2Text .. '</strong>' or team2Text)
end