Skip to content

Commit

Permalink
WIP-feat(Project): Adds support for variant learning objectives
Browse files Browse the repository at this point in the history
  • Loading branch information
mfdebian committed Mar 27, 2024
1 parent acafb52 commit 78335a8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ program.command('project')
.option('--repo <string>', 'Repository')
.option('--version <string>', 'Project version')
.option('--lo <string>', 'Path to yml file with reference learning objectives')
.option('--variant <string>', 'Variant language')
.option('--debug', 'Show error stack traces')
.action(createHandler(parseProject));

Expand Down
20 changes: 19 additions & 1 deletion lib/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,25 @@ export const transformLearningObjectives = async (dir, opts, meta) => {
return undefined;
}

const { learningObjectives } = meta;
const { learningObjectives, variants } = meta;

const variant = opts.variant;

Check failure on line 110 in lib/project.js

View workflow job for this annotation

GitHub Actions / test (16)

Use object destructuring

Check failure on line 110 in lib/project.js

View workflow job for this annotation

GitHub Actions / test (18)

Use object destructuring

Check failure on line 110 in lib/project.js

View workflow job for this annotation

GitHub Actions / test (20)

Use object destructuring

variants?.forEach(variantInYml => {

Check failure on line 112 in lib/project.js

View workflow job for this annotation

GitHub Actions / test (16)

Expected parentheses around arrow function argument having a body with curly braces

Check failure on line 112 in lib/project.js

View workflow job for this annotation

GitHub Actions / test (18)

Expected parentheses around arrow function argument having a body with curly braces

Check failure on line 112 in lib/project.js

View workflow job for this annotation

GitHub Actions / test (20)

Expected parentheses around arrow function argument having a body with curly braces
if (variant === variantInYml.name) {
// console.log("variant", variantInYml.name);
// console.log("learningObjectives of this variantInYml", variantInYml.learningObjectives);
variantInYml.learningObjectives.forEach(learningObjective => {

Check failure on line 116 in lib/project.js

View workflow job for this annotation

GitHub Actions / test (16)

Expected parentheses around arrow function argument having a body with curly braces

Check failure on line 116 in lib/project.js

View workflow job for this annotation

GitHub Actions / test (18)

Expected parentheses around arrow function argument having a body with curly braces

Check failure on line 116 in lib/project.js

View workflow job for this annotation

GitHub Actions / test (20)

Expected parentheses around arrow function argument having a body with curly braces
if (typeof learningObjective === 'object') {
// TODO: agregar las variantes que sean true
console.log(learningObjective);

Check warning on line 119 in lib/project.js

View workflow job for this annotation

GitHub Actions / test (16)

Unexpected console statement

Check warning on line 119 in lib/project.js

View workflow job for this annotation

GitHub Actions / test (18)

Unexpected console statement

Check warning on line 119 in lib/project.js

View workflow job for this annotation

GitHub Actions / test (20)

Unexpected console statement
}
if (typeof learningObjective === 'string' && !learningObjectives.includes(learningObjective)) {
learningObjectives.push(learningObjective);
}
});
}
});

if (!opts.lo || !existsSync(`${opts.lo}/data.yml`)) {
return learningObjectives;
Expand Down

0 comments on commit 78335a8

Please sign in to comment.