Created
October 20, 2024 22:12
-
-
Save jbmarflo/c54d225a8e3eff7c0920d8030dd331e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async getLearningCapsulesForPathway(pathwayUuid: string): Promise<LearningCapsuleStructure[]> { | |
const PATHWAY_BRANCHES = await this.getBranchesByPathway(pathwayUuid); | |
// Ejecutar getLearningCapsulesForBranch para todas las ramas en paralelo | |
const capsulesPromises = PATHWAY_BRANCHES.map(branch => | |
this.getLearningCapsulesForBranch(branch.branchUuid) | |
); | |
// Esperar a que todas las promesas se resuelvan | |
const capsulesArrays = await Promise.all(capsulesPromises); | |
// Aplanar el array de arrays en un solo array | |
return capsulesArrays.flat(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment