Модуль:Турнирная сетка: различия между версиями
Внешний вид
Andrew (обсуждение | вклад) Переписан модуль |
Andrew (обсуждение | вклад) Исправлена ошибка с рисованием правой части сетки |
||
| Строка 76: | Строка 76: | ||
local finalName = args["Final-name"] or "Финал" | local finalName = args["Final-name"] or "Финал" | ||
local thirdName = args["3rd-name"] or "Матч за 3-е место" | local thirdName = args["3rd-name"] or "Матч за 3-е место" | ||
local container = mw.html.create('div'):addClass('bracket-container') | local container = mw.html.create('div'):addClass('bracket-container') | ||
| Строка 97: | Строка 94: | ||
local matchesContainer = mw.html.create('div'):cssText('display: flex; flex-direction: column; justify-content: space-around; flex-grow: 1;') | local matchesContainer = mw.html.create('div'):cssText('display: flex; flex-direction: column; justify-content: space-around; flex-grow: 1;') | ||
-- Количество матчей на одной стороне в данном раунде | |||
local matchesInRound = 2^(rounds - r - 1) | local matchesInRound = 2^(rounds - r - 1) | ||
for m = 1, matchesInRound do | for m = 1, matchesInRound do | ||
| Строка 108: | Строка 106: | ||
-- ЦЕНТР (Финал и игра за 3-е место) | -- ЦЕНТР (Финал и игра за 3-е место) | ||
local center = mw.html.create('div'):addClass('bracket-center') | local center = mw.html.create('div'):addClass('bracket-center') | ||
center:cssText('display: flex; flex-direction: column; justify-content: | center:cssText('display: flex; flex-direction: column; justify-content: center; width: 190px; min-width: 170px; margin: 0 10px;') | ||
-- Финал | -- Финал | ||
| Строка 143: | Строка 141: | ||
local matchesInRound = 2^(rounds - r - 1) | local matchesInRound = 2^(rounds - r - 1) | ||
for m = 1, matchesInRound do | for m = 1, matchesInRound do | ||
local matchNum = | -- ИСПРАВЛЕНИЕ: Правая сторона нумеруется подряд после левой | ||
local matchNum = matchesInRound + m | |||
matchesContainer:node(buildMatch(args, "RD" .. r, matchNum)) | matchesContainer:node(buildMatch(args, "RD" .. r, matchNum)) | ||
end | end | ||