Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
fixing the table issue
  • Loading branch information
gnoeee committed Apr 5, 2024
1 parent fbfc654 commit c9dea5f
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@ <h1>Global Wiki Contributions</h1>
}

async function displayUserEditCounts(username, startDate, endDate) {
console.log('Displaying user edit counts for:', username, startDate, endDate);
const editCounts = await getUserEditCounts(username, startDate, endDate);
console.log('Edit counts:', editCounts);

const editCountsBody = document.getElementById('editCountsBody');
const noteContainer = document.getElementById('noteContainer');
Expand All @@ -251,7 +253,9 @@ <h1>Global Wiki Contributions</h1>

if (editCounts.length === 0) {
// No contributions found
console.log('No contributions found');
document.getElementById('noContributionsMessage').style.display = 'block';
document.getElementById('editCounts').style.display = 'none'; // Hide the table
return;
}

Expand Down Expand Up @@ -286,14 +290,32 @@ <h1>Global Wiki Contributions</h1>
row.appendChild(cellDeletedEditCount);

editCountsBody.appendChild(row);
document.getElementById('editCounts').style.display = 'table';
}

if (counts.warning) {
hasHighEditCount = true;
highEditCountProjects.push(counts.wiki);
}
});


// Add total row if there are any rows displayed
if (editCountsBody.children.length > 0) {
const totalRow = document.createElement('tr');
totalRow.innerHTML = `
<td><strong>Total</strong></td>
<td>${totalLiveEditCount}</td>
<td>${totalDeletedEditCount}</td>
`;
editCountsBody.appendChild(totalRow);

// Display the table
document.getElementById('editCounts').style.display = 'table';
} else {
// Hide the table if no rows are displayed
document.getElementById('editCounts').style.display = 'none';
}

// Display the note container if needed
if (hasHighEditCount || totalLiveEditCount === 0 && totalDeletedEditCount === 0) {
noteContainer.style.display = 'block';
Expand Down

0 comments on commit c9dea5f

Please sign in to comment.