Question Set Editor
IEditorConfig is not generalised and it contains BMGS fields
File - editor.ts
board, medium, grade Level, subject, topic present in editor.ts file as:
Which defines the IEditorConfig interface
Code Block export interface IEditorConfig { context: Context; config: any; metadata?: any; data?: any; } export interface Context { ... ... board?: any; medium?: any; gradeLevel?: any; subject?: any; topic?: any; ... ... }
This interface defines the editorConfig.
These value of board, medium, grade Level, subject, topic are getting attached as default value to question if question set does not have BMGS fields.
If question set contains BMGS fields and then BMGS present in editor config get replaced with selected BMGS in question set.
Solution to Generalise interface
Code Block export interface IEditorConfig { context: Context; config: any; metadata?: any; data?: any; } export interface Context { ... ... frameworkDefaultValues?: any ... ... }
This frameworkDefaultValues
can store board, medium, grade Level, subject, topic, etc as:
Code Block |
---|
frameworkDefaultValues: {
board: 'CBSE',
medium: 'English',
gradeLevel: 'Class 6'
subject: 'Mathematics',
...
} |
or it can also contains any values such as hospital, department, etc
Code Block |
---|
frameworkDefaultValues: {
hospital: 'Apollo',
department: 'Cardiology',
...
...
} |
Place where above passed BMGS is currently getting fetched and getting added to question metadata
File - question.component.ts
Code Block |
---|
_.pick(_.get(this.editorService.editorConfig, 'context'), ['board', 'medium',
'gradeLevel', 'subject', 'topic']) |
If we pass this values in context.frameworkDefaultValues
then this line can also be generalised to
Code Block |
---|
_.get(this.editorService.editorConfig, 'context.frameworkDefaultValues') |
BMGS and other fields hard coding in ConfigService
File - config.service.ts
sessionContext contains hard coded fields name as
Code Block |
---|
public sessionContext: Array<string> = ['board', 'medium', 'gradeLevel', 'subject',
'topic', 'author', 'channel', 'framework', 'copyright', 'attributions', 'audience', 'license'] |
To remove these hardcoded fields name we can pass it as a config to editor as sessionContextFields
Code Block |
---|
editorConfig: {
config: {
sessionContextFields: ['board', 'medium', 'gradeLevel', 'subject',
'topic', 'author', 'channel', 'framework', 'copyright', 'attributions', 'audience', 'license']
}
} |
Another File which contains BMGS hard coded is File - SessionContext.ts
This file is not getting used anywhere we can remove this file.
Other files which contains BMGS are mock data for test cases in these files:
Code Block |
---|
components/assign-page-number/assign-page-number.component.spec.data.ts
components/editor/editor.component.spec.data.ts
components/fancy-tree/fancy-tree.component.spec.data.ts
components/meta-form/meta-form.component.spec.data.ts
components/question/question.component.spec.data.ts
components/quml-player/quml-player.component.spec.data.ts
components/qumlplayer-page/qumlplayer-page.component.spec.data.ts
services/editor/editor.service.spec.data.ts
services/tree/tree.service.spec.data.ts |
We can remove BMGS fields from these files.
Resource Library
BMGS and various other fields are shown in this page and it’s not configurable
...
Introduction:
This document helps to understand various BMGS hard-codings present in the Question Set Editor and how it can be removed.
Background:
As part of BMGS hard-coding removal changes in Question Set Editor, the editor should be able to configure and work with any framework (agriculture framework or k-12 framework).
Problem Statement:
The QuestionSet Editor does have major hard coding specific to BMGS, only a few code related changes to be made to make it further configurable [Design] BMGS hardcoding in Questionset Editor
But in “Add From Library” feature of editor, the editor is using an npm package known as resource-library have some hard codings in the UI which is to made configurable.
Key design problems(In Resource Library):
Background:
Resource Library enables the feature of Question Bank where creator can select a question from the list of questions and add it to the Question set.
Problem Statement 1:
The Question in Question bank shows BMGS and various other fields which it’s not configurable, how to make it configurable?
...
Solution 1
we can use the form config which is being used while question creation to the .
...
If the question creation form is having Title, Learning level, Board, Medium, Grade, Subject and Marks fields.
The same field code and label and display in this same above format without bringing any new UI change.
...
Solution 2-can be used to display the various metadatas in the questions of the question bank.
Pros:
No Additional form config is to be the added.
If each channel have different form for question creation, the meta data displayed in the question bank will be consistent with the form configuration of that channel.
Cons
The Question may have some additional metadata but it will not be shown in the UI of Question Bank.
Solution 2 (Not Recommended)
We can define a new form config in which these fields can be set as config.
Pros:
For each channel we can define different form config
...
to display the metadata and show some additional information which might not be present in create question form.
Cons
It will add additional form config to the editor .just to display metadata
...
Problem Statement 2:
Board value is getting displayed to the
...
questions in the question bank, how to make it generic?
...
Solution:Suggestion1 -
We can remove showing “By CBSE”
Suggestion2 - we can make it configurable if showing a field is needed
BMGS is present in SessionContext.ts file
This file is not getting used anywhere so can be removed.
BMGS is present in config.service.ts
It defines sessionContext but it is not getting used so can be removed.
So we can remove sessionContext from this file.
Other files which contains BMGS are mock data for test cases in these files:
Code Block |
---|
library/library.component.spec.data.ts
library-filter/library-filter.component.spec.data.ts
library-filter/library-filter.component.spec.ts
quml-player/quml-player.component.spec.data.ts |
We can remove BMGS fields from these filesmake this field configurable by passing a config to resource-library
Code Block |
---|
editorConfig = {
config: {
...
...
libraryConfig: {
createdByField: 'board' // board, hospital, school, etc..
}
}
} |
Using this libraryConfig we can display whichever value we want to show in above page.