|
|
@@ -5,6 +5,15 @@ const TESTS_LIST = ['Charles', 'Baruch','Frédéric', 'John', 'Dan', |
|
|
|
|
|
|
|
const NOBODY = '***NOBODY'; |
|
|
|
|
|
|
|
let viewRounds; |
|
|
|
let viewParticipants; |
|
|
|
|
|
|
|
function outputChanged(val){ |
|
|
|
document.getElementById('rounds').innerHTML='' |
|
|
|
let v = val == 0 ? viewParticipants : viewRounds; |
|
|
|
document.getElementById('rounds').appendChild(v) |
|
|
|
} |
|
|
|
|
|
|
|
function groupSizeChanged(val){ |
|
|
|
let nbParticipants = document.getElementsByClassName('participant').length; |
|
|
|
let meetsPerRound = val - 1; |
|
|
@@ -157,8 +166,11 @@ function doIt(){ |
|
|
|
}) |
|
|
|
|
|
|
|
document.getElementById('rounds').innerHTML='' |
|
|
|
let view = renderRounds(rounds) |
|
|
|
document.getElementById('rounds').appendChild(view) |
|
|
|
viewParticipants = rendeParticipantTables(participants, rounds) |
|
|
|
document.getElementById('rounds').appendChild(viewParticipants) |
|
|
|
viewRounds = renderRounds(rounds) |
|
|
|
document.getElementById('participants-radio').disabled = false; |
|
|
|
document.getElementById('rounds-radio').disabled = false; |
|
|
|
} |
|
|
|
|
|
|
|
function renderRounds(rounds){ |
|
|
@@ -200,3 +212,40 @@ function renderRounds(rounds){ |
|
|
|
}) |
|
|
|
return roundsBlock |
|
|
|
} |
|
|
|
|
|
|
|
function rendeParticipantTables(participants, rounds){ |
|
|
|
let participantBlocks = document.createElement('div') |
|
|
|
participantBlocks.classList.add('participant-blocks') |
|
|
|
participants.forEach(function (p) { |
|
|
|
let participantBlock = document.createElement('div') |
|
|
|
participantBlocks.appendChild(participantBlock) |
|
|
|
let participantName= document.createElement('h2') |
|
|
|
participantName.appendChild(document.createTextNode(p)) |
|
|
|
let placesBlock = document.createElement('ul') |
|
|
|
participantBlock.append(participantName) |
|
|
|
participantBlock.classList.add('participant-block') |
|
|
|
participantBlock.append(placesBlock) |
|
|
|
let roundNum = 1 |
|
|
|
rounds.forEach(function (round) { |
|
|
|
let groupNum = 1 |
|
|
|
let roundBlock = document.createElement('li') |
|
|
|
placesBlock.append(roundBlock) |
|
|
|
round.forEach(function (group) { |
|
|
|
group.forEach(function (p2) { |
|
|
|
if(p2 === p){ |
|
|
|
let roundNumSpan = document.createElement('span') |
|
|
|
roundNumSpan.classList.add('round-num') |
|
|
|
roundBlock.appendChild(roundNumSpan) |
|
|
|
roundNumSpan.appendChild(document.createTextNode("Round " + roundNum +" : ")) |
|
|
|
roundBlock.appendChild(document.createTextNode("Table " + groupNum)) |
|
|
|
} |
|
|
|
}) |
|
|
|
groupNum ++ |
|
|
|
}) |
|
|
|
roundNum ++ |
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return participantBlocks |
|
|
|
} |