style: fix linting issues met Prettier
This commit is contained in:
parent
eae4ad3978
commit
97d3c5c480
2 changed files with 9 additions and 14 deletions
|
@ -16,14 +16,14 @@ const logger: Logger = getLogger();
|
||||||
*/
|
*/
|
||||||
async function addProgressToLearningPath(learningPath: LearningPath, personalizedFor: Group): Promise<LearningPath> {
|
async function addProgressToLearningPath(learningPath: LearningPath, personalizedFor: Group): Promise<LearningPath> {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
learningPath.nodes.map(async node => {
|
learningPath.nodes.map(async (node) => {
|
||||||
const lastSubmission = personalizedFor ? await getLastSubmissionForGroup(idFromLearningObjectNode(node), personalizedFor) : null
|
const lastSubmission = personalizedFor ? await getLastSubmissionForGroup(idFromLearningObjectNode(node), personalizedFor) : null;
|
||||||
node.done = Boolean(lastSubmission);
|
node.done = Boolean(lastSubmission);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
learningPath.num_nodes = learningPath.nodes.length;
|
learningPath.num_nodes = learningPath.nodes.length;
|
||||||
learningPath.num_nodes_left = learningPath.nodes.filter(it => !it.done).length;
|
learningPath.num_nodes_left = learningPath.nodes.filter((it) => !it.done).length;
|
||||||
|
|
||||||
return learningPath;
|
return learningPath;
|
||||||
}
|
}
|
||||||
|
@ -54,9 +54,7 @@ const dwengoApiLearningPathProvider: LearningPathProvider = {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(learningPaths?.map(async (it) => addProgressToLearningPath(it, personalizedFor)));
|
||||||
learningPaths?.map(async it => addProgressToLearningPath(it, personalizedFor))
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
|
@ -71,12 +69,9 @@ const dwengoApiLearningPathProvider: LearningPathProvider = {
|
||||||
const searchResults = await fetchWithLogging<LearningPath[]>(apiUrl, `Search learning paths with query "${query}"`, { params });
|
const searchResults = await fetchWithLogging<LearningPath[]>(apiUrl, `Search learning paths with query "${query}"`, { params });
|
||||||
|
|
||||||
if (searchResults) {
|
if (searchResults) {
|
||||||
await Promise.all(
|
await Promise.all(searchResults?.map(async (it) => addProgressToLearningPath(it, personalizedFor)));
|
||||||
searchResults?.map(async it => addProgressToLearningPath(it, personalizedFor))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return searchResults ?? [];
|
return searchResults ?? [];
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,8 +22,8 @@ export function idFromLearningObjectNode(node: LearningObjectNode): LearningObje
|
||||||
return {
|
return {
|
||||||
hruid: node.learningobject_hruid,
|
hruid: node.learningobject_hruid,
|
||||||
language: node.language,
|
language: node.language,
|
||||||
version: node.version
|
version: node.version,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,8 +33,8 @@ export function idFromLearningPathNode(node: LearningPathNode): LearningObjectId
|
||||||
return {
|
return {
|
||||||
hruid: node.learningObjectHruid,
|
hruid: node.learningObjectHruid,
|
||||||
language: node.language,
|
language: node.language,
|
||||||
version: node.version
|
version: node.version,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue