File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
packages/db/src/impl/static Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ export class StaticDataLayerProvider implements DataLayerProvider {
138138 }
139139
140140 getCoursesDB ( ) : CoursesDBInterface {
141- return new StaticCoursesDB ( this . manifests ) ;
141+ return new StaticCoursesDB ( this . manifests , this . dependencyNameToCourseId ) ;
142142 }
143143
144144 async getClassroomDB (
Original file line number Diff line number Diff line change @@ -6,10 +6,23 @@ import { StaticCourseManifest } from '../../util/packer/types';
66import { logger } from '../../util/logger' ;
77
88export class StaticCoursesDB implements CoursesDBInterface {
9- constructor ( private manifests : Record < string , StaticCourseManifest > ) { }
9+ constructor (
10+ private manifests : Record < string , StaticCourseManifest > ,
11+ private dependencyNameToCourseId ?: Map < string , string >
12+ ) { }
1013
1114 async getCourseConfig ( courseId : string ) : Promise < CourseConfig > {
12- const manifest = this . manifests [ courseId ] ;
15+ // Try direct lookup by courseId first
16+ let manifest = this . manifests [ courseId ] ;
17+
18+ // If not found, try lookup by dependency name (backwards compatibility)
19+ if ( ! manifest && this . dependencyNameToCourseId ) {
20+ const mappedCourseId = this . dependencyNameToCourseId . get ( courseId ) ;
21+ if ( mappedCourseId ) {
22+ manifest = this . manifests [ mappedCourseId ] ;
23+ }
24+ }
25+
1326 if ( ! manifest ) {
1427 logger . warn ( `Course manifest for ${ courseId } not found` ) ;
1528 throw new Error ( `Course ${ courseId } not found` ) ;
You can’t perform that action at this time.
0 commit comments