Le fix again

This commit is contained in:
2024-11-14 18:43:41 +01:00
parent 1d9ab49f1b
commit c95737f366

View File

@@ -657,15 +657,24 @@ if (window.location.href.includes("index.html") || window.location.href === "htt
//alert("Bonjour Madame Daniau");
}
// Add event listeners for voting buttons
// Add event listeners for voting buttons
matchList.forEach(record => {
const voteTeam1Button = document.getElementById(`voteTeam1${record.id}`);
const voteTeam2Button = document.getElementById(`voteTeam2${record.id}`);
const progressTeam1 = document.getElementById(`progressTeam1${record.id}`);
const progressTeam2 = document.getElementById(`progressTeam2${record.id}`);
voteTeam1Button.addEventListener('click', () => handleVote(record.id, 'team1', progressTeam1, progressTeam2));
voteTeam2Button.addEventListener('click', () => handleVote(record.id, 'team2', progressTeam1, progressTeam2));
const handleVoteTeam1 = () => handleVote(record.id, 'team1', progressTeam1, progressTeam2);
const handleVoteTeam2 = () => handleVote(record.id, 'team2', progressTeam1, progressTeam2);
voteTeam1Button.addEventListener('click', handleVoteTeam1);
voteTeam1Button.addEventListener('touchstart', handleVoteTeam1);
voteTeam2Button.addEventListener('click', handleVoteTeam2);
voteTeam2Button.addEventListener('touchstart', handleVoteTeam2);
});
// Function to handle voting
async function handleVote(matchId, team, progressTeam1, progressTeam2) {
const match = await pb.collection('match').getOne(matchId);