-
-
Save shardiwal/d454e0c71333902bbd9a12d569da0c19 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
async findContentTypeVideos(ctx) { | |
let content = await this.findSingle(ctx); | |
let videoContentTypes = []; | |
let units = content.units; | |
if ( units ) { | |
units.forEach( async function(unit) { | |
let unit_content = unit.content; | |
if ( unit_content ) { | |
unit_content.forEach(function(uc) { | |
if ( uc.video_type ) { | |
console.log('unit_content_push'); | |
videoContentTypes.push( uc.video_type ); | |
} | |
}); | |
} | |
let unit_lessons = unit.lessons; | |
if ( unit_lessons ) { | |
unit_lessons.forEach(async function(ul) { | |
let lesson = await strapi.query('lesson').findOne({ id: ul }); | |
let lesson_scenario = lesson.scenario; | |
if ( lesson_scenario ) { | |
lesson_scenario.forEach(async function(uls) { | |
if ( uls.video_type ) { | |
console.log('lesson_scenario_push'); | |
videoContentTypes.push( uls.video_type ); | |
} | |
}); | |
} | |
let lesson_learning_element = lesson.learningElementSection; | |
if ( lesson_learning_element ) { | |
lesson_learning_element.forEach(async function(ulle) { | |
if ( ulle.video_type ) { | |
console.log('lesson_learning_element_push'); | |
videoContentTypes.push( ulle.video_type ); | |
} | |
}); | |
} | |
}); | |
} | |
let unit_keywords = unit.keywords; | |
if ( unit_keywords ) { | |
unit_keywords.forEach(async function(uk) { | |
let unit_tag = await strapi.query('tag-type').findOne({ id: uk }); | |
let tag_videos = unit_tag.videos; | |
if ( tag_videos ) { | |
tag_videos.forEach(async function(tagv) { | |
console.log('tag keyword push'); | |
videoContentTypes.push( tagv ); | |
}); | |
} | |
}); | |
} | |
}); | |
} | |
console.log( videoContentTypes ); | |
return videoContentTypes; | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
`
async findContentTypeVideos(ctx) {
let content = await this.findSingle(ctx);
let videoContentTypes = [];
let units = content.units;
if ( units ) {
units.forEach( async function(unit) {
let unit_content = unit.content;
if ( unit_content ) {
unit_content.forEach(function(uc) {
if ( uc.video_type ) {
console.log('unit_content_push');
videoContentTypes.push( uc.video_type );
}
});
}
let unit_lessons = unit.lessons;
if ( unit_lessons ) {
await Promise.all(unit_lessons.map(ul => {
let lesson = await strapi.query('lesson').findOne({ id: ul });
let lesson_scenario = lesson.scenario;
if ( lesson_scenario ) {
lesson_scenario.forEach(async function(uls) {
if ( uls.video_type ) {
console.log('lesson_scenario_push');
videoContentTypes.push( uls.video_type );
}
});
}
let lesson_learning_element = lesson.learningElementSection;
if ( lesson_learning_element ) {
lesson_learning_element.forEach(async function(ulle) {
if ( ulle.video_type ) {
console.log('lesson_learning_element_push');
videoContentTypes.push( ulle.video_type );
}
});
}
}));
}
let unit_keywords = unit.keywords;
if ( unit_keywords ) {
unit_keywords.forEach(async function(uk) {
let unit_tag = await strapi.query('tag-type').findOne({ id: uk });
let tag_videos = unit_tag.videos;
if ( tag_videos ) {
tag_videos.forEach(async function(tagv) {
console.log('tag keyword push');
videoContentTypes.push( tagv );
});
}
});
}
});
}
console.log( videoContentTypes );
return videoContentTypes;
},
`
What's wrong at unit_lessons ?