Skip to content

Commit 09efddb

Browse files
jjcapparelljjcapparellanthonydmays
authored
feat: combined credits with the media items by modifying the loadData method - James Capparell (#358)
* feat: added james_capparell_loader.ts and edited loaders.module.ts for lesson_10 Loading the Media Collection assignment. * feat: combined the credits with the media items by modifying the loadData method --------- Co-authored-by: jjcapparell <“[email protected]> Co-authored-by: Anthony D. Mays <[email protected]>
1 parent a15afbb commit 09efddb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lesson_10/libraries/src/loaders/james_capparell_loader.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@ export class JamesCapparellLoader implements Loader {
1515
console.log(
1616
`Loaded ${credits.length} credits and ${mediaItems.length} media items`,
1717
);
18+
credits.forEach((credit) => {
19+
const mediaItem = mediaItems.find(
20+
(media) => media.getId() === credit.getMediaItemId(),
21+
);
1822

23+
if (mediaItem) {
24+
mediaItem.addCredit(credit);
25+
}
26+
});
1927
return [...mediaItems.values()];
2028
}
2129

0 commit comments

Comments
 (0)