Skip to content

Instantly share code, notes, and snippets.

@jbmarflo
Created October 20, 2024 22:12
Show Gist options
  • Save jbmarflo/c54d225a8e3eff7c0920d8030dd331e7 to your computer and use it in GitHub Desktop.
Save jbmarflo/c54d225a8e3eff7c0920d8030dd331e7 to your computer and use it in GitHub Desktop.
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