Skip to content

Commit

Permalink
Add total completion badge
Browse files Browse the repository at this point in the history
  • Loading branch information
prabhav5112 committed Sep 20, 2023
1 parent 7eeda17 commit 3832c86
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Binary file added badge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 18 additions & 4 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ document.addEventListener('DOMContentLoaded', function () {
row.innerHTML = `
<td>${index + 1}</td>
<td>${data.name}</td>
<td>${data.redemptionStatus}</td>
<td>${data.coursesCompleted}</td>
<td>${data.skillBadges}</td>
<td>${data.genAIGames}</td>
<td>${data.redemptionStatus}</td>
`;
tableBody.appendChild(row);
});
Expand All @@ -64,17 +65,30 @@ document.addEventListener('DOMContentLoaded', function () {
function renderTable(data) {
tableBody.innerHTML = '';
data.forEach((data, index) => {
if (data.coursesCompleted + data.skillBadges + data.genAIGames == 9){
const row = document.createElement('tr');
row.innerHTML = `
<td>${index + 1}</td>
<td><img src="badge.png" width=20px></td>
<td>${data.name}</td>
<td>${data.redemptionStatus}</td>
<td>${data.coursesCompleted}</td>
<td>${data.skillBadges}</td>
<td>${data.genAIGames}</td>
<td>${data.redemptionStatus}</td>
`;
tableBody.appendChild(row);
}
else {
const row = document.createElement('tr');
row.innerHTML = `
<td>${index + 1}</td>
<td>${data.name}</td>
<td>${data.coursesCompleted}</td>
<td>${data.skillBadges}</td>
<td>${data.genAIGames}</td>
<td>${data.redemptionStatus}</td>
`;
tableBody.appendChild(row);
}
});
}
})
Expand Down

0 comments on commit 3832c86

Please sign in to comment.