Skip to content

Commit

Permalink
Omit empty answers
Browse files Browse the repository at this point in the history
  • Loading branch information
tshemsedinov committed Jan 28, 2024
1 parent ab32a90 commit d4d1562
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/src/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,20 @@ const match = (expected, answered) => {
let above = 0;
let upgrade = 0;
const entries = Object.entries(needed);
const propose = [];
for (const [skill, level] of entries) {
if (level) count++;
const actual = answered.skills.get(skill) || '🤷 unknown';
const actualIndex = LEVEL_LABELS.indexOf(actual);
const levelIndex = LEVEL_LABELS.indexOf(level || '🤷 unknown');
if (actualIndex < levelIndex) {
upgrade++;
todo.push(` - ${skill}: ${actual}${level}`);
propose.push(` - ${skill}: ${actual}${level}`);
}
if (actualIndex > levelIndex) above++;
if (actualIndex >= levelIndex && levelIndex !== 0) have++;
}
if (have) todo.push(...propose);
const total = `you have \`${have}\` of \`${count}\` skills`;
const ext = `\`${upgrade}\` to be upgraded, and \`${above}\` above needed`;
todo.push(` - Total: ${total}, ${ext}`);
Expand Down Expand Up @@ -287,7 +289,7 @@ const getTotal = (answered) => {
const answered = skills[unit];
if (expected) {
const todo = match(expected, answered);
todos.push(`\n## ${unit}\n`);
todos.push(`\n## [${unit}](Skills/${unit}.md)\n`);
todos.push(...todo);
}
totals.push(`- ${unit}`);
Expand Down

0 comments on commit d4d1562

Please sign in to comment.