File tree Expand file tree Collapse file tree 2 files changed +30
-5
lines changed Expand file tree Collapse file tree 2 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,32 @@ const vuetify = createVuetify({
106106 console . log ( ' ℹ️ No custom questions config available (default studio mode)' ) ;
107107 }
108108
109+ // Register custom question types in CourseConfig if available
110+ if ( customQuestions ) {
111+ console . log ( '🎨 Studio Mode: Registering custom question types in CourseConfig' ) ;
112+ try {
113+ const { getDataLayer } = await import ( '@vue-skuilder/db' ) ;
114+ const courseDB = getDataLayer ( ) . getCourseDB ( studioConfig . database . name ) ;
115+ const courseConfig = await courseDB . getCourseConfig ( ) ;
116+
117+ const { registerCustomQuestionTypes } = await import ( './utils/courseConfigRegistration' ) ;
118+ const registrationResult = await registerCustomQuestionTypes (
119+ customQuestions ,
120+ courseConfig ,
121+ courseDB
122+ ) ;
123+
124+ if ( registrationResult . success ) {
125+ console . log ( ` ✅ Custom question types registered successfully: ${ registrationResult . registeredCount } items` ) ;
126+ } else {
127+ console . warn ( ` ⚠️ Custom question type registration failed: ${ registrationResult . errorMessage } ` ) ;
128+ }
129+ } catch ( registrationError ) {
130+ console . warn ( ` ⚠️ Failed to register custom question types: ${ registrationError instanceof Error ? registrationError . message : String ( registrationError ) } ` ) ;
131+ }
132+ }
109133
134+
110135 console . log ( '🎨 Studio Mode: Collecting view components' ) ;
111136 const viewComponents = Courses . allViewsRaw ( ) ;
112137 console . log ( ` ✅ Collected ${ Object . keys ( viewComponents ) . length } base view components` ) ;
Original file line number Diff line number Diff line change @@ -89,9 +89,9 @@ export function processCustomQuestionsData(customQuestions: CustomQuestionsData)
8989 // Determine the course name (use first course or default to meta.packageName)
9090 const courseName = courseNames . length > 0 ? courseNames [ 0 ] : customQuestions . meta . packageName ;
9191
92- // Process data shapes from this question class
92+ // Process data shapes from this question class (static property)
9393 if ( questionClass . dataShapes && Array . isArray ( questionClass . dataShapes ) ) {
94- questionClass . dataShapes ( ) . forEach ( ( dataShape ) => {
94+ questionClass . dataShapes . forEach ( ( dataShape ) => {
9595 processedDataShapes . push ( {
9696 name : dataShape . name ,
9797 course : courseName ,
@@ -102,11 +102,11 @@ export function processCustomQuestionsData(customQuestions: CustomQuestionsData)
102102
103103 // Process the question itself
104104 processedQuestions . push ( {
105- name : questionClass . constructor . name ,
105+ name : questionClass . name ,
106106 course : courseName ,
107107 questionClass : questionClass ,
108- dataShapes : questionClass . dataShapes ( ) || [ ] ,
109- views : questionClass . views ( ) || [ ] ,
108+ dataShapes : questionClass . dataShapes || [ ] ,
109+ views : questionClass . views || [ ] ,
110110 } ) ;
111111 } ) ;
112112
You can’t perform that action at this time.
0 commit comments