diff --git a/projects/collection-editor-library-wc/src/app/app.module.ts b/projects/collection-editor-library-wc/src/app/app.module.ts
index 71bd6d554..f4ae5a3c7 100644
--- a/projects/collection-editor-library-wc/src/app/app.module.ts
+++ b/projects/collection-editor-library-wc/src/app/app.module.ts
@@ -19,14 +19,9 @@ import { LibraryComponent } from '../../../collection-editor-library/src/lib/com
import { LibraryFilterComponent } from '../../../collection-editor-library/src/lib/components/library-filter/library-filter.component';
import { LibraryListComponent } from '../../../collection-editor-library/src/lib/components/library-list/library-list.component';
import { LibraryPlayerComponent } from '../../../collection-editor-library/src/lib/components/library-player/library-player.component';
-import { TemplateComponent } from '../../../collection-editor-library/src/lib/components/template/template.component';
import { ResourceReorderComponent } from '../../../collection-editor-library/src/lib/components/resource-reorder/resource-reorder.component';
import { SkeletonLoaderComponent } from '../../../collection-editor-library/src/lib/components/skeleton-loader/skeleton-loader.component';
import { QumlplayerPageComponent } from '../../../collection-editor-library/src/lib/components/qumlplayer-page/qumlplayer-page.component';
-import { OptionsComponent } from '../../../collection-editor-library/src/lib/components/options/options.component';
-import { AnswerComponent } from '../../../collection-editor-library/src/lib/components/answer/answer.component';
-import { CkeditorToolComponent } from '../../../collection-editor-library/src/lib/components/ckeditor-tool/ckeditor-tool.component';
-import { QuestionComponent } from '../../../collection-editor-library/src/lib/components/question/question.component';
import { QumlLibraryModule } from '@project-sunbird/sunbird-quml-player';
import { CarouselModule } from 'ngx-bootstrap/carousel';
import { TelemetryInteractDirective } from '../../../collection-editor-library/src/lib/directives/telemetry-interact/telemetry-interact.directive';
@@ -36,23 +31,13 @@ import { CollectionIconComponent } from '../../../collection-editor-library/src/
import { QumlPlayerComponent } from '../../../collection-editor-library/src/lib/components/quml-player/quml-player.component';
import { DialcodeComponent } from '../../../collection-editor-library/src/lib/components/dialcode/dialcode.component';
import { DialcodeService } from '../../../collection-editor-library/src/lib/services/dialcode/dialcode.service';
-import { QuestionOptionSubMenuComponent } from '../../../collection-editor-library/src/lib/components/question-option-sub-menu/question-option-sub-menu.component';
import { CsvUploadComponent } from '../../../collection-editor-library/src/lib/components/csv-upload/csv-upload.component';
import { ManageCollaboratorComponent } from '../../../collection-editor-library/src/lib/components/manage-collaborator/manage-collaborator.component';
-import { SliderComponent } from '../../../collection-editor-library/src/lib/components/slider/slider.component';
-import { TranslationsComponent } from '../../../collection-editor-library/src/lib/components/translations/translations.component';
import { PublishChecklistComponent } from '../../../collection-editor-library/src/lib/components/publish-checklist/publish-checklist.component';
-import { BulkUploadComponent } from '../../../collection-editor-library/src/lib/components/bulk-upload/bulk-upload.component';
import { RelationalMetadataComponent } from '../../../collection-editor-library/src/lib/components/relational-metadata/relational-metadata.component';
import { ResourceLibraryModule } from '@project-sunbird/sunbird-resource-library';
import { AppLoaderComponent } from '../../../collection-editor-library/src/lib/components/app-loader/app-loader.component';
-import { AssignPageNumberComponent } from '../../../collection-editor-library/src/lib/components/assign-page-number/assign-page-number.component';
-import { PlainTreeComponent } from '../../../collection-editor-library/src/lib/components/plain-tree/plain-tree.component';
import { A11yModule } from '@angular/cdk/a11y';
-import { ProgressStatusComponent } from '../../../collection-editor-library/src/lib/components/progress-status/progress-status.component';
-import { TermAndConditionComponent } from '../../../collection-editor-library/src/lib/components/term-and-condition/term-and-condition.component';
-
-import { QualityParamsModalComponent } from '../../../collection-editor-library/src/lib/components/quality-params-modal/quality-params-modal.component';
import { BrowserModule } from '@angular/platform-browser';
@@ -70,34 +55,20 @@ import { BrowserModule } from '@angular/platform-browser';
LibraryComponent,
LibraryFilterComponent,
LibraryListComponent,
- QuestionComponent,
- OptionsComponent,
- AnswerComponent,
- CkeditorToolComponent,
LibraryPlayerComponent,
ResourceReorderComponent,
SkeletonLoaderComponent,
- TemplateComponent,
DateFormatPipe,
TelemetryInteractDirective,
AssetBrowserComponent,
CollectionIconComponent,
QumlPlayerComponent,
DialcodeComponent,
- BulkUploadComponent,
CsvUploadComponent,
ManageCollaboratorComponent,
- PublishChecklistComponent,
- QuestionOptionSubMenuComponent,
- SliderComponent,
- TranslationsComponent,
+ PublishChecklistComponent
AppLoaderComponent,
- RelationalMetadataComponent,
- AssignPageNumberComponent,
- PlainTreeComponent,
- ProgressStatusComponent,
- TermAndConditionComponent,
- QualityParamsModalComponent
+ RelationalMetadataComponent
],
imports: [
CommonModule, BrowserModule, FormsModule, ReactiveFormsModule, RouterModule.forRoot([]), SuiModule,
diff --git a/projects/collection-editor-library/src/lib/collection-editor-library.module.ts b/projects/collection-editor-library/src/lib/collection-editor-library.module.ts
index 4484d3a4f..92c3c4f82 100644
--- a/projects/collection-editor-library/src/lib/collection-editor-library.module.ts
+++ b/projects/collection-editor-library/src/lib/collection-editor-library.module.ts
@@ -18,14 +18,9 @@ import { LibraryComponent } from './components/library/library.component';
import { LibraryFilterComponent } from './components/library-filter/library-filter.component';
import { LibraryListComponent } from './components/library-list/library-list.component';
import { LibraryPlayerComponent } from './components/library-player/library-player.component';
-import { TemplateComponent } from './components/template/template.component';
import { ResourceReorderComponent } from './components/resource-reorder/resource-reorder.component';
import { SkeletonLoaderComponent } from './components/skeleton-loader/skeleton-loader.component';
import { QumlplayerPageComponent } from './components/qumlplayer-page/qumlplayer-page.component';
-import { OptionsComponent } from './components/options/options.component';
-import { AnswerComponent } from './components/answer/answer.component';
-import { CkeditorToolComponent } from './components/ckeditor-tool/ckeditor-tool.component';
-import { QuestionComponent } from './components/question/question.component';
import { QumlLibraryModule } from '@project-sunbird/sunbird-quml-player';
import {CarouselModule} from 'ngx-bootstrap/carousel';
import { TelemetryInteractDirective } from './directives/telemetry-interact/telemetry-interact.directive';
@@ -35,23 +30,14 @@ import { CollectionIconComponent } from './components/collection-icon/collection
import { QumlPlayerComponent } from './components/quml-player/quml-player.component';
import { DialcodeComponent } from './components/dialcode/dialcode.component';
import { DialcodeService } from './services/dialcode/dialcode.service';
-import { QuestionOptionSubMenuComponent } from './components/question-option-sub-menu/question-option-sub-menu.component';
import { CsvUploadComponent } from './components/csv-upload/csv-upload.component';
import { ManageCollaboratorComponent } from './components/manage-collaborator/manage-collaborator.component';
-import { SliderComponent } from './components/slider/slider.component';
-import { TranslationsComponent } from './components/translations/translations.component';
import { PublishChecklistComponent } from './components/publish-checklist/publish-checklist.component';
-import { BulkUploadComponent } from './components/bulk-upload/bulk-upload.component';
import { RelationalMetadataComponent } from './components/relational-metadata/relational-metadata.component';
import { ResourceLibraryModule } from '@project-sunbird/sunbird-resource-library';
import { AppLoaderComponent } from './components/app-loader/app-loader.component';
-import { AssignPageNumberComponent } from './components/assign-page-number/assign-page-number.component';
-import { PlainTreeComponent } from './components/plain-tree/plain-tree.component';
import { A11yModule } from '@angular/cdk/a11y';
-import { ProgressStatusComponent } from './components/progress-status/progress-status.component';
-import {TermAndConditionComponent} from './components/term-and-condition/term-and-condition.component';
-import { QualityParamsModalComponent } from './components/quality-params-modal/quality-params-modal.component';
@NgModule({
declarations: [
CollectionEditorLibraryComponent,
@@ -66,34 +52,20 @@ import { QualityParamsModalComponent } from './components/quality-params-modal/q
LibraryComponent,
LibraryFilterComponent,
LibraryListComponent,
- QuestionComponent,
- OptionsComponent,
- AnswerComponent,
- CkeditorToolComponent,
LibraryPlayerComponent,
ResourceReorderComponent,
SkeletonLoaderComponent,
- TemplateComponent,
DateFormatPipe,
TelemetryInteractDirective,
AssetBrowserComponent,
CollectionIconComponent,
QumlPlayerComponent,
DialcodeComponent,
- BulkUploadComponent,
CsvUploadComponent,
ManageCollaboratorComponent,
PublishChecklistComponent,
- QuestionOptionSubMenuComponent,
- SliderComponent,
- TranslationsComponent,
AppLoaderComponent,
- RelationalMetadataComponent,
- AssignPageNumberComponent,
- PlainTreeComponent,
- ProgressStatusComponent,
- TermAndConditionComponent,
- QualityParamsModalComponent
+ RelationalMetadataComponent
],
imports: [CommonModule, FormsModule, ReactiveFormsModule, RouterModule.forChild([]), SuiModule,
CommonFormElementsModule, InfiniteScrollModule, HttpClientModule,
diff --git a/projects/collection-editor-library/src/lib/components/answer/answer.component.html b/projects/collection-editor-library/src/lib/components/answer/answer.component.html
deleted file mode 100644
index dc764cfbf..000000000
--- a/projects/collection-editor-library/src/lib/components/answer/answer.component.html
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/answer/answer.component.scss b/projects/collection-editor-library/src/lib/components/answer/answer.component.scss
deleted file mode 100644
index e69de29bb..000000000
diff --git a/projects/collection-editor-library/src/lib/components/answer/answer.component.spec.ts b/projects/collection-editor-library/src/lib/components/answer/answer.component.spec.ts
deleted file mode 100644
index 78fa180f5..000000000
--- a/projects/collection-editor-library/src/lib/components/answer/answer.component.spec.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
-
-import { AnswerComponent } from './answer.component';
-import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
-import { ConfigService } from '../../services/config/config.service';
-import { SuiModule } from 'ng2-semantic-ui-v9';
-
-describe('AnswerComponent', () => {
- let component: AnswerComponent;
- let fixture: ComponentFixture;
- let eventData = {
- question: 'This is the multiple choice question',
- answer: "Yes
",
- };
- beforeEach(waitForAsync(() => {
- TestBed.configureTestingModule({
- declarations: [AnswerComponent],
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
- imports: [SuiModule],
- providers: [ConfigService]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(AnswerComponent);
- component = fixture.componentInstance;
- // fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
- it('#ngOnInit() should call editorDataHandler on ngOnInit', () => {
- component.editorState = eventData;
- spyOn(component, 'editorDataHandler');
- component.ngOnInit();
- expect(component.editorDataHandler).toHaveBeenCalled();
- });
- it('#editorDataHandler() should call editorDataHandler and emit propfer question metadata', () => {
- spyOn(component.editorDataOutput, 'emit');
- const data = {
- answer: "Yes
",
- editorState: { answer: "Yes
" },
- name: "Subjective Question",
- primaryCategory: "Subjective Question",
- qType: "SA",
- };
- const metaData = component.prepareAnwserData(data);
- component.editorDataHandler(data);
- expect(component.editorDataOutput.emit).toHaveBeenCalledWith({ body: metaData, mediaobj: undefined });
- });
- it('#prepareAnwserData() should call prepareAnwserData and prepare profer answer data', () => {
- const questionBody = {
- answer: "Yes
",
- editorState: { answer: "Yes
" },
- name: "Subjective Question",
- primaryCategory: "Subjective Question",
- qType: "SA",
- };
- const data = component.prepareAnwserData({body: eventData.answer});
- expect(data).toEqual(questionBody);
- });
-});
diff --git a/projects/collection-editor-library/src/lib/components/answer/answer.component.ts b/projects/collection-editor-library/src/lib/components/answer/answer.component.ts
deleted file mode 100644
index 057d7d4c6..000000000
--- a/projects/collection-editor-library/src/lib/components/answer/answer.component.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core';
-import { ConfigService } from '../../services/config/config.service';
-@Component({
- selector: 'lib-answer',
- templateUrl: './answer.component.html',
- styleUrls: ['./answer.component.scss']
-})
-export class AnswerComponent implements OnInit {
- @Input() editorState;
- @Input() showFormError;
- @Input() isReadOnlyMode;
- @Output() editorDataOutput: EventEmitter = new EventEmitter();
- constructor(public configService: ConfigService) { }
-
- ngOnInit() {
- this.editorDataHandler({body: this.editorState.answer});
- }
-
- editorDataHandler(event) {
- const body = this.prepareAnwserData(event);
- this.editorDataOutput.emit({body, mediaobj: event.mediaobj});
- }
-
- prepareAnwserData(event) {
- return {
- answer: event.body,
- editorState: {
- answer: event.body
- },
- name: 'Subjective Question',
- qType: 'SA',
- primaryCategory: 'Subjective Question'
- };
- }
-}
diff --git a/projects/collection-editor-library/src/lib/components/assign-page-number/assign-page-number.component.html b/projects/collection-editor-library/src/lib/components/assign-page-number/assign-page-number.component.html
deleted file mode 100644
index 72fce6ddd..000000000
--- a/projects/collection-editor-library/src/lib/components/assign-page-number/assign-page-number.component.html
+++ /dev/null
@@ -1,36 +0,0 @@
-
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/assign-page-number/assign-page-number.component.scss b/projects/collection-editor-library/src/lib/components/assign-page-number/assign-page-number.component.scss
deleted file mode 100644
index 1727755fe..000000000
--- a/projects/collection-editor-library/src/lib/components/assign-page-number/assign-page-number.component.scss
+++ /dev/null
@@ -1,68 +0,0 @@
-table {
- font-family: arial, sans-serif;
- border-collapse: collapse;
- width: 97%;
- border: 1px solid #cccccc;
- margin: 15px 25px 15px 15px;
- thead {
- tr {
- background-color: rgb(237, 237, 237);
-
- th {
- margin-right: 86px;
- }
- }
- }
-}
-
-td,
-th {
- text-align: left;
- padding: 15px;
-}
-
-tr:nth-child(even) {
- background-color: #f3f7fa;
-}
-
-tr {
- border: 2px solid #cccccc;
-
- td {
- input {
- float: right;
- width: 14%;
- border-radius: 6px;
- border-width: 1px;
- height: 42px;
- text-align: center;
- margin-right: 10px;
- }
- }
-
- .right {
- float: right;
- }
-}
-
-h2 {
- margin-left: 15px;
-}
-
-.close-button {
- opacity: 0;
- float: right;
- margin-top: 5px;
- margin-right: 15px;
- color: #8b8080;
- font-size: 20px;
-}
-
-.close-button-dynamic {
- opacity: 1;
- color: #8b8080;
- float: right;
- margin-top: 5px;
- margin-right: 15px;
- font-size: 20px;
-}
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/assign-page-number/assign-page-number.component.spec.data.ts b/projects/collection-editor-library/src/lib/components/assign-page-number/assign-page-number.component.spec.data.ts
deleted file mode 100644
index 1a2fc1b90..000000000
--- a/projects/collection-editor-library/src/lib/components/assign-page-number/assign-page-number.component.spec.data.ts
+++ /dev/null
@@ -1,1582 +0,0 @@
-export const mockTreeData = [
- {
- "id": "do_1134460323603906561218",
- "title": "Science1",
- "tooltip": "Science1",
- "primaryCategory": "Observation With Rubrics",
- "objectType": "QuestionSet",
- "metadata": {
- "parent": "do_1134357224765685761203",
- "code": "a51c0d9f-4696-3354-062f-b2078048656c",
- "allowScoring": "Yes",
- "allowSkip": "Yes",
- "containsUserData": "No",
- "channel": "01309282781705830427",
- "language": [
- "English"
- ],
- "mimeType": "application/vnd.sunbird.questionset",
- "showHints": "No",
- "matrix": [
- [
- "Good",
- "1",
- "1"
- ],
- [
- "Average",
- "11",
- "1"
- ],
- [
- "Bad",
- "0",
- "1"
- ]
- ],
- "createdOn": "2022-01-05T05:42:52.118+0000",
- "ecm": [],
- "objectType": "QuestionSet",
- "primaryCategory": "Observation With Rubrics",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-10-17T10:32:55.087+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_1134460323603906561218",
- "lastStatusChangedOn": "2022-01-05T05:42:52.118+0000",
- "requiresSubmit": "No",
- "visibility": "Parent",
- "showTimer": "No",
-
- "index": 1,
- "setType": "materialised",
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1641361372118",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "depth": 1,
- "minPossibleScore": "32",
- "compatibilityLevel": 5,
- "name": "Science1",
- "navigationMode": "non-linear",
- "allowBranching": "Yes",
- "maxPossibleScore": "32",
- "shuffle": true,
- "attributions": [],
- "status": "Draft"
- },
- "folder": true,
- "children": [
- {
- "id": "do_1134460323602841601200",
- "title": "Chemistry",
- "tooltip": "Chemistry",
- "primaryCategory": "Observation With Rubrics",
- "objectType": "QuestionSet",
- "metadata": {
- "parent": "do_1134460323603906561218",
- "code": "b4c3e613-5c3f-9c8b-d61f-417f4c5d8df2",
- "allowScoring": "Yes",
- "allowSkip": "Yes",
- "containsUserData": "No",
- "channel": "01309282781705830427",
- "branchingLogic": {
- "do_11357626234228736013446": {
- "target": [],
- "source": [
- "do_113449672558780416163"
- ],
- "preCondition": {
- "and": [
- {
- "eq": [
- {
- "var": "do_113449672558780416163.response1.value",
- "type": "responseDeclaration"
- },
- [
- 0
- ]
- ]
- }
- ]
- }
- },
- "do_113583409935081472146": {
- "target": [],
- "source": [
- "do_11358056771369369615004"
- ],
- "preCondition": {
- "and": [
- {
- "eq": [
- {
- "var": "do_11358056771369369615004.response1.value",
- "type": "responseDeclaration"
- },
- [
- 0
- ]
- ]
- }
- ]
- }
- },
- "do_11357624960711065613442": {
- "target": [],
- "source": [
- "do_113449672558780416163"
- ],
- "preCondition": {
- "and": [
- {
- "eq": [
- {
- "var": "do_113449672558780416163.response1.value",
- "type": "responseDeclaration"
- },
- [
- 0
- ]
- ]
- }
- ]
- }
- },
- "do_11357638131503104013481": {
- "target": [],
- "source": [
- "do_113449672558780416163"
- ],
- "preCondition": {
- "and": [
- {
- "ne": [
- {
- "var": "do_113449672558780416163.response1.value",
- "type": "responseDeclaration"
- },
- [
- 0
- ]
- ]
- }
- ]
- }
- },
- "do_11358056771369369615004": {
- "target": [
- "do_113583409935081472146"
- ],
- "preCondition": {},
- "source": []
- },
- "do_113449672558780416163": {
- "target": [
- "do_11357623678335385613440",
- "do_11357624960711065613442",
- "do_11357626234228736013446",
- "do_11357638131503104013481"
- ],
- "preCondition": {},
- "source": []
- },
- "do_11357623678335385613440": {
- "target": [],
- "source": [
- "do_113449672558780416163"
- ],
- "preCondition": {
- "and": [
- {
- "eq": [
- {
- "var": "do_113449672558780416163.response1.value",
- "type": "responseDeclaration"
- },
- [
- 0
- ]
- ]
- }
- ]
- }
- }
- },
- "description": "test",
- "language": [
- "English"
- ],
- "mimeType": "application/vnd.sunbird.questionset",
- "showHints": "No",
- "matrix": "",
- "createdOn": "2022-01-05T05:42:52.106+0000",
- "ecm": [],
- "objectType": "QuestionSet",
- "primaryCategory": "Observation With Rubrics",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-10-17T10:11:48.683+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_1134460323602841601200",
- "lastStatusChangedOn": "2022-01-05T05:42:52.106+0000",
- "requiresSubmit": "No",
- "visibility": "Parent",
- "showTimer": "No",
-
- "index": 1,
- "setType": "materialised",
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1641361372106",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "depth": 2,
- "minPossibleScore": "204",
- "compatibilityLevel": 5,
- "name": "Chemistry",
- "navigationMode": "non-linear",
- "allowBranching": "Yes",
- "maxPossibleScore": "23",
- "shuffle": true,
- "attributions": [],
- "status": "Draft"
- },
- "folder": true,
- "children": [
- {
- "id": "do_113449672558780416163",
- "title": "Parent Question MCQ",
- "tooltip": "Parent Question MCQ",
- "primaryCategory": "Multiselect Multiple Choice Question",
- "objectType": "Question",
- "metadata": {
- "parent": "do_1134460323602841601200",
- "code": "d0ab14ae-9f67-41cf-dcfa-80c8432bf424",
- "evidence": {
- "required": "No",
- "mimeType": [
- "audio"
- ],
- "minCount": 1,
- "maxCount": 1,
- "sizeLimit": "20480"
- },
- "subject": [
- "English"
- ],
- "showRemarks": "No",
- "channel": "01309282781705830427",
- "language": [
- "English"
- ],
- "medium": [
- "English"
- ],
- "mimeType": "application/vnd.sunbird.question",
- "templateId": "mcq-vertical",
- "createdOn": "2022-01-10T09:08:52.273+0000",
- "objectType": "Question",
- "gradeLevel": [
- "Grade 1"
- ],
- "primaryCategory": "Multiselect Multiple Choice Question",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-10-10T10:01:37.428+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_113449672558780416163",
- "lastStatusChangedOn": "2022-01-10T09:08:52.273+0000",
- "visibility": "Parent",
- "showTimer": "No",
- "author": "check1@yopmail.com",
- "index": 1,
- "qType": "MCQ",
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1665396097434",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "interactionTypes": [
- "choice"
- ],
- "framework": "tpd",
- "depth": 3,
- "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64",
- "compatibilityLevel": 4,
- "name": "Parent Question MCQ",
- "topic": [
- "Forest"
- ],
- "board": "CBSE",
- "status": "Draft",
- "showEvidence": "Yes"
- },
- "folder": false,
- "children": [],
- "root": false,
- "extraClasses": "parent",
- "icon": "fa fa-file-o"
- },
- {
- "id": "do_11357638131503104013481",
- "title": " asd",
- "tooltip": " asd",
- "primaryCategory": "Text",
- "objectType": "Question",
- "metadata": {
- "parent": "do_1134460323602841601200",
- "code": "cbc33c95-3431-4568-101b-752e1ed51836",
- "subject": [
- "English"
- ],
- "showRemarks": "No",
- "channel": "01309282781705830427",
- "language": [
- "English"
- ],
- "medium": [
- "English"
- ],
- "mimeType": "application/vnd.sunbird.question",
- "createdOn": "2022-07-08T09:38:29.745+0000",
- "objectType": "Question",
- "gradeLevel": [
- "Grade 1"
- ],
- "primaryCategory": "Text",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-07-18T12:06:51.740+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_11357638131503104013481",
- "lastStatusChangedOn": "2022-07-08T09:38:29.745+0000",
- "creator": "Vaibahv Bhuva",
- "visibility": "Parent",
- "showTimer": "No",
- "author": "check1@yopmail.com",
- "index": 2,
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1658146011745",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "interactionTypes": [
- "text"
- ],
- "framework": "tpd",
- "depth": 3,
- "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64",
- "compatibilityLevel": 4,
- "name": " asd",
- "topic": [
- "Forest"
- ],
- "board": "CBSE",
- "status": "Draft",
- "showEvidence": "No"
- },
- "folder": false,
- "children": [],
- "root": false,
- "extraClasses": "dependent",
- "icon": "fa fa-file-o"
- },
- {
- "id": "do_11357626234228736013446",
- "title": "cc",
- "tooltip": "cc",
- "primaryCategory": "Text",
- "objectType": "Question",
- "metadata": {
- "parent": "do_1134460323602841601200",
- "code": "a9d7df75-cb28-60ca-1585-fd1d4c1f3158",
- "subject": [
- "English"
- ],
- "showRemarks": "No",
- "channel": "01309282781705830427",
- "language": [
- "English"
- ],
- "medium": [
- "English"
- ],
- "mimeType": "application/vnd.sunbird.question",
- "createdOn": "2022-07-08T05:36:26.705+0000",
- "objectType": "Question",
- "gradeLevel": [
- "Grade 1"
- ],
- "primaryCategory": "Text",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-07-18T12:07:46.775+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_11357626234228736013446",
- "lastStatusChangedOn": "2022-07-08T05:36:26.705+0000",
- "creator": "Vaibahv Bhuva",
- "visibility": "Parent",
- "showTimer": "No",
- "author": "check1@yopmail.com",
- "index": 3,
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1658146066784",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "interactionTypes": [
- "text"
- ],
- "framework": "tpd",
- "depth": 3,
- "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64",
- "compatibilityLevel": 4,
- "name": "cc",
- "topic": [
- "Forest"
- ],
- "board": "CBSE",
- "status": "Draft",
- "showEvidence": "No"
- },
- "folder": false,
- "children": [],
- "root": false,
- "extraClasses": "dependent",
- "icon": "fa fa-file-o"
- },
- {
- "id": "do_11357624960711065613442",
- "title": "child date",
- "tooltip": "child date",
- "primaryCategory": "Date",
- "objectType": "Question",
- "metadata": {
- "parent": "do_1134460323602841601200",
- "code": "d5590147-17f3-65a4-2c12-1af7cf28f058",
- "subject": [
- "English"
- ],
- "channel": "01309282781705830427",
- "language": [
- "English"
- ],
- "medium": [
- "English"
- ],
- "mimeType": "application/vnd.sunbird.question",
- "createdOn": "2022-07-08T05:10:32.118+0000",
- "objectType": "Question",
- "gradeLevel": [
- "Grade 1"
- ],
- "primaryCategory": "Date",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-07-18T12:08:30.500+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_11357624960711065613442",
- "lastStatusChangedOn": "2022-07-08T05:10:32.118+0000",
- "creator": "Vaibahv Bhuva",
- "visibility": "Parent",
- "showTimer": "No",
- "author": "check1@yopmail.com",
- "index": 4,
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1658146110507",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "interactionTypes": [
- "date"
- ],
- "framework": "tpd",
- "depth": 3,
- "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64",
- "compatibilityLevel": 4,
- "name": "child date",
- "topic": [
- "Forest"
- ],
- "board": "CBSE",
- "status": "Draft"
- },
- "folder": false,
- "children": [],
- "root": false,
- "extraClasses": "dependent",
- "icon": "fa fa-file-o"
- },
- {
- "id": "do_11357623678335385613440",
- "title": "bb s",
- "tooltip": "bb s",
- "primaryCategory": "Date",
- "objectType": "Question",
- "metadata": {
- "parent": "do_1134460323602841601200",
- "code": "b22ac67b-6381-3f9a-5d6b-5421149b6dab",
- "subject": [
- "English"
- ],
- "channel": "01309282781705830427",
- "language": [
- "English"
- ],
- "medium": [
- "English"
- ],
- "mimeType": "application/vnd.sunbird.question",
- "createdOn": "2022-07-08T04:44:26.718+0000",
- "objectType": "Question",
- "gradeLevel": [
- "Grade 1"
- ],
- "primaryCategory": "Date",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-07-18T09:48:39.257+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_11357623678335385613440",
- "lastStatusChangedOn": "2022-07-08T04:44:26.718+0000",
- "creator": "Vaibahv Bhuva",
- "visibility": "Parent",
- "showTimer": "No",
- "author": "check1@yopmail.com",
- "index": 5,
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1658137719265",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "interactionTypes": [
- "date"
- ],
- "framework": "tpd",
- "depth": 3,
- "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64",
- "compatibilityLevel": 4,
- "name": "bb s",
- "topic": [
- "Forest"
- ],
- "board": "CBSE",
- "status": "Draft"
- },
- "folder": false,
- "children": [],
- "root": false,
- "extraClasses": "dependent",
- "icon": "fa fa-file-o"
- },
- {
- "id": "do_11358056771369369615004",
- "title": "mcq 2",
- "tooltip": "mcq 2",
- "primaryCategory": "Multiselect Multiple Choice Question",
- "objectType": "Question",
- "metadata": {
- "parent": "do_1134460323602841601200",
- "code": "3d5ac972-c983-c0cd-5d7b-78881da02d99",
- "subject": [
- "English"
- ],
- "showRemarks": "No",
- "channel": "01309282781705830427",
- "language": [
- "English"
- ],
- "medium": [
- "English"
- ],
- "mimeType": "application/vnd.sunbird.question",
- "templateId": "mcq-vertical",
- "createdOn": "2022-07-14T07:35:44.738+0000",
- "objectType": "Question",
- "gradeLevel": [
- "Grade 1"
- ],
- "primaryCategory": "Multiselect Multiple Choice Question",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-10-11T08:07:07.671+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_11358056771369369615004",
- "lastStatusChangedOn": "2022-07-14T07:35:44.738+0000",
- "visibility": "Parent",
- "showTimer": "No",
- "author": "check1@yopmail.com",
- "index": 6,
- "qType": "MCQ",
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1665475627678",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "interactionTypes": [
- "choice"
- ],
- "framework": "tpd",
- "depth": 3,
- "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64",
- "compatibilityLevel": 4,
- "name": "mcq 2",
- "topic": [
- "Forest"
- ],
- "board": "CBSE",
- "status": "Draft",
- "showEvidence": "No"
- },
- "folder": false,
- "children": [],
- "root": false,
- "extraClasses": "parent",
- "icon": "fa fa-file-o"
- },
- {
- "id": "do_113583409935081472146",
- "title": "abcd",
- "tooltip": "abcd",
- "primaryCategory": "Multiselect Multiple Choice Question",
- "objectType": "Question",
- "metadata": {
- "parent": "do_1134460323602841601200",
- "code": "266153c7-e63e-9c5c-f984-ca36b5676812",
- "subject": [
- "English"
- ],
- "showRemarks": "No",
- "channel": "01309282781705830427",
- "language": [
- "English"
- ],
- "medium": [
- "English"
- ],
- "mimeType": "application/vnd.sunbird.question",
- "templateId": "mcq-vertical",
- "createdOn": "2022-07-18T07:58:15.591+0000",
- "objectType": "Question",
- "gradeLevel": [
- "Grade 1"
- ],
- "primaryCategory": "Multiselect Multiple Choice Question",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-10-04T06:46:46.698+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_113583409935081472146",
- "lastStatusChangedOn": "2022-07-18T07:58:15.591+0000",
- "creator": "Vaibahv Bhuva",
- "visibility": "Parent",
- "showTimer": "No",
- "author": "check1@yopmail.com",
- "index": 7,
- "qType": "MCQ",
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1664866006706",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "interactionTypes": [
- "choice"
- ],
- "framework": "tpd",
- "depth": 3,
- "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64",
- "compatibilityLevel": 4,
- "name": "abcd",
- "topic": [
- "Forest"
- ],
- "board": "CBSE",
- "status": "Draft",
- "showEvidence": "No"
- },
- "folder": false,
- "children": [],
- "root": false,
- "extraClasses": "dependent",
- "icon": "fa fa-file-o"
- },
- {
- "id": "do_1136011660822200321804",
- "title": "test Date",
- "tooltip": "test Date",
- "primaryCategory": "Date",
- "objectType": "Question",
- "metadata": {
- "parent": "do_1134460323602841601200",
- "code": "88244472-ade7-96b0-3c6c-ebe4f01944a9",
- "subject": [
- "English"
- ],
- "channel": "01309282781705830427",
- "language": [
- "English"
- ],
- "medium": [
- "English"
- ],
- "isCollaborationEnabled": false,
- "mimeType": "application/vnd.sunbird.question",
- "createdOn": "2022-08-12T10:03:14.021+0000",
- "objectType": "Question",
- "gradeLevel": [
- "Grade 1"
- ],
- "primaryCategory": "Date",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-10-11T08:17:31.886+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_1136011660822200321804",
- "lastStatusChangedOn": "2022-08-12T10:03:14.021+0000",
- "visibility": "Parent",
- "showTimer": "No",
- "author": "check1@yopmail.com",
- "index": 8,
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1665476251895",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "interactionTypes": [
- "date"
- ],
- "framework": "tpd",
- "depth": 3,
- "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64",
- "compatibilityLevel": 4,
- "name": "test Date",
- "topic": [
- "Forest"
- ],
- "board": "CBSE",
- "status": "Draft"
- },
- "folder": false,
- "children": [],
- "root": false,
- "extraClasses": "",
- "icon": "fa fa-file-o"
- },
- {
- "id": "do_1136011666813255681808",
- "title": "Test Date 2",
- "tooltip": "Test Date 2",
- "primaryCategory": "Date",
- "objectType": "Question",
- "metadata": {
- "parent": "do_1134460323602841601200",
- "code": "b6861b66-d634-6b92-c8e3-d5337e9338ed",
- "subject": [
- "English"
- ],
- "channel": "01309282781705830427",
- "language": [
- "English"
- ],
- "medium": [
- "English"
- ],
- "isCollaborationEnabled": false,
- "mimeType": "application/vnd.sunbird.question",
- "createdOn": "2022-08-12T10:04:27.154+0000",
- "objectType": "Question",
- "gradeLevel": [
- "Grade 1"
- ],
- "primaryCategory": "Date",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-10-11T08:18:06.321+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_1136011666813255681808",
- "lastStatusChangedOn": "2022-08-12T10:04:27.154+0000",
- "visibility": "Parent",
- "showTimer": "No",
- "author": "check1@yopmail.com",
- "index": 9,
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1665476286330",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "interactionTypes": [
- "date"
- ],
- "framework": "tpd",
- "depth": 3,
- "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64",
- "compatibilityLevel": 4,
- "name": "Test Date 2",
- "topic": [
- "Forest"
- ],
- "board": "CBSE",
- "status": "Draft"
- },
- "folder": false,
- "children": [],
- "root": false,
- "extraClasses": "",
- "icon": "fa fa-file-o"
- },
- {
- "id": "do_11364293879332864011476",
- "title": "Parent Date",
- "tooltip": "Parent Date",
- "primaryCategory": "Text",
- "objectType": "Question",
- "metadata": {
- "parent": "do_1134460323602841601200",
- "code": "bfffa660-e482-ee2f-566e-9297c2c16da9",
- "subject": [
- "English"
- ],
- "showRemarks": "No",
- "channel": "01309282781705830427",
- "isReviewModificationAllowed": false,
- "language": [
- "English"
- ],
- "medium": [
- "English"
- ],
- "mimeType": "application/vnd.sunbird.question",
- "createdOn": "2022-10-10T10:30:01.920+0000",
- "objectType": "Question",
- "gradeLevel": [
- "Grade 1"
- ],
- "primaryCategory": "Text",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-10-10T10:30:01.920+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_11364293879332864011476",
- "lastStatusChangedOn": "2022-10-10T10:30:01.920+0000",
- "visibility": "Parent",
- "showTimer": "No",
- "author": "check1@yopmail.com",
- "index": 10,
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1665397801921",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "interactionTypes": [
- "text"
- ],
- "framework": "tpd",
- "depth": 3,
- "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64",
- "compatibilityLevel": 4,
- "name": "Parent Date",
- "topic": [
- "Forest"
- ],
- "board": "CBSE",
- "status": "Draft",
- "showEvidence": "No"
- },
- "folder": false,
- "children": [],
- "root": false,
- "extraClasses": "",
- "icon": "fa fa-file-o"
- },
- {
- "id": "do_11364297206960128011480",
- "title": "Parent Text2",
- "tooltip": "Parent Text2",
- "primaryCategory": "Text",
- "objectType": "Question",
- "metadata": {
- "parent": "do_1134460323602841601200",
- "code": "4fc18a9b-73da-0360-aa0c-c952ed6e6c3b",
- "subject": [
- "English"
- ],
- "showRemarks": "No",
- "channel": "01309282781705830427",
- "isReviewModificationAllowed": false,
- "language": [
- "English"
- ],
- "medium": [
- "English"
- ],
- "mimeType": "application/vnd.sunbird.question",
- "createdOn": "2022-10-10T11:37:43.965+0000",
- "objectType": "Question",
- "gradeLevel": [
- "Grade 1"
- ],
- "primaryCategory": "Text",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-10-11T08:18:16.341+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_11364297206960128011480",
- "lastStatusChangedOn": "2022-10-10T11:37:43.965+0000",
- "visibility": "Parent",
- "showTimer": "No",
- "author": "check1@yopmail.com",
- "index": 11,
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1665476296349",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "interactionTypes": [
- "text"
- ],
- "framework": "tpd",
- "depth": 3,
- "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64",
- "compatibilityLevel": 4,
- "name": "Parent Text2",
- "topic": [
- "Forest"
- ],
- "board": "CBSE",
- "status": "Draft",
- "showEvidence": "No"
- },
- "folder": false,
- "children": [],
- "root": false,
- "extraClasses": "",
- "icon": "fa fa-file-o"
- }
- ],
- "root": false,
- "extraClasses": "",
- "icon": "fa fa-folder-o"
- },
- {
- "id": "do_1134460323604971521236",
- "title": "Biology",
- "tooltip": "Biology",
- "primaryCategory": "Observation With Rubrics",
- "objectType": "QuestionSet",
- "metadata": {
- "parent": "do_1134460323603906561218",
- "code": "bfdac63e-4cd1-c9fe-00a0-be98f73e13d8",
- "allowScoring": "Yes",
- "allowSkip": "Yes",
- "containsUserData": "No",
- "channel": "01309282781705830427",
- "branchingLogic": {},
- "language": [
- "English"
- ],
- "mimeType": "application/vnd.sunbird.questionset",
- "showHints": "No",
- "matrix": [
- [
- null,
- "",
- null
- ],
- [
- null,
- null,
- null
- ],
- [
- null,
- null,
- null
- ]
- ],
- "createdOn": "2022-01-05T05:42:52.131+0000",
- "objectType": "QuestionSet",
- "primaryCategory": "Observation With Rubrics",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-10-13T08:26:03.971+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_1134460323604971521236",
- "lastStatusChangedOn": "2022-01-05T05:42:52.131+0000",
- "requiresSubmit": "No",
- "visibility": "Parent",
- "showTimer": "No",
-
- "index": 2,
- "setType": "materialised",
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1641361372131",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "depth": 2,
- "minPossibleScore": "15",
- "compatibilityLevel": 5,
- "name": "Biology",
- "navigationMode": "non-linear",
- "allowBranching": "Yes",
- "maxPossibleScore": "34",
- "shuffle": true,
- "attributions": [],
- "status": "Draft"
- },
- "folder": true,
- "children": [
- {
- "id": "do_11357919243396710414900",
- "title": "question 1",
- "tooltip": "question 1",
- "primaryCategory": "Text",
- "objectType": "Question",
- "metadata": {
- "parent": "do_1134460323604971521236",
- "code": "dafce1db-23cc-01e5-73eb-b55928030481",
- "subject": [
- "English"
- ],
- "showRemarks": "No",
- "channel": "01309282781705830427",
- "language": [
- "English"
- ],
- "medium": [
- "English"
- ],
- "mimeType": "application/vnd.sunbird.question",
- "createdOn": "2022-07-12T08:57:43.912+0000",
- "objectType": "Question",
- "gradeLevel": [
- "Grade 1"
- ],
- "primaryCategory": "Text",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-10-11T08:23:51.049+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_11357919243396710414900",
- "lastStatusChangedOn": "2022-07-12T08:57:43.912+0000",
- "visibility": "Parent",
- "showTimer": "No",
- "author": "check1@yopmail.com",
- "index": 1,
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1665476631058",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "interactionTypes": [
- "text"
- ],
- "framework": "tpd",
- "depth": 3,
- "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64",
- "compatibilityLevel": 4,
- "name": "question 1",
- "topic": [
- "Forest"
- ],
- "board": "CBSE",
- "status": "Draft",
- "showEvidence": "No"
- },
- "folder": false,
- "children": [],
- "root": false,
- "extraClasses": "",
- "icon": "fa fa-file-o"
- },
- {
- "id": "do_11357919785679257614902",
- "title": "mcq ss",
- "tooltip": "mcq ss",
- "primaryCategory": "Multiselect Multiple Choice Question",
- "objectType": "Question",
- "metadata": {
- "parent": "do_1134460323604971521236",
- "code": "f1657fe2-67f9-1931-4729-466751eab866",
- "evidence": {
- "required": "No",
- "mimeType": [
- "image"
- ],
- "minCount": 1,
- "maxCount": 1,
- "sizeLimit": "20480"
- },
- "subject": [
- "English"
- ],
- "showRemarks": "No",
- "channel": "01309282781705830427",
- "language": [
- "English"
- ],
- "medium": [
- "English"
- ],
- "mimeType": "application/vnd.sunbird.question",
- "templateId": "mcq-vertical",
- "createdOn": "2022-07-12T09:08:45.878+0000",
- "objectType": "Question",
- "gradeLevel": [
- "Grade 1"
- ],
- "primaryCategory": "Multiselect Multiple Choice Question",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-07-18T12:32:50.978+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_11357919785679257614902",
- "lastStatusChangedOn": "2022-07-12T09:08:45.878+0000",
- "visibility": "Parent",
- "showTimer": "No",
- "author": "check1@yopmail.com",
- "index": 2,
- "qType": "MCQ",
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1658147570984",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "interactionTypes": [
- "choice"
- ],
- "framework": "tpd",
- "depth": 3,
- "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64",
- "compatibilityLevel": 4,
- "name": "mcq ss",
- "topic": [
- "Forest"
- ],
- "board": "CBSE",
- "status": "Draft",
- "showEvidence": "Yes"
- },
- "folder": false,
- "children": [],
- "root": false,
- "extraClasses": "",
- "icon": "fa fa-file-o"
- }
- ],
- "root": false,
- "extraClasses": "",
- "icon": "fa fa-folder-o"
- },
- {
- "id": "do_1134460323603578881212",
- "title": "General Science",
- "tooltip": "General Science",
- "primaryCategory": "Observation With Rubrics",
- "objectType": "QuestionSet",
- "metadata": {
- "parent": "do_1134460323603906561218",
- "code": "9916f5fc-4f37-3f8e-5151-b32ce65217da",
- "allowScoring": "Yes",
- "allowSkip": "Yes",
- "containsUserData": "No",
- "channel": "01309282781705830427",
- "branchingLogic": {
- "do_113583348668153856123": {
- "target": [
- "do_1135998448873226241592"
- ],
- "preCondition": {},
- "source": []
- },
- "do_1135998448873226241592": {
- "target": [],
- "source": [
- "do_113583348668153856123"
- ],
- "preCondition": {
- "and": [
- {
- "eq": [
- {
- "var": "do_113583348668153856123.response1.value",
- "type": "responseDeclaration"
- },
- [
- 0
- ]
- ]
- }
- ]
- }
- }
- },
- "language": [
- "English"
- ],
- "mimeType": "application/vnd.sunbird.questionset",
- "showHints": "No",
- "matrix": [
- [
- null,
- "",
- null
- ],
- [
- null,
- null,
- null
- ],
- [
- null,
- null,
- null
- ]
- ],
- "createdOn": "2022-01-05T05:42:52.114+0000",
- "objectType": "QuestionSet",
- "primaryCategory": "Observation With Rubrics",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-10-12T12:09:54.073+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_1134460323603578881212",
- "lastStatusChangedOn": "2022-01-05T05:42:52.114+0000",
- "requiresSubmit": "No",
- "visibility": "Parent",
- "showTimer": "No",
- "index": 3,
- "setType": "materialised",
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1641361372114",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "depth": 2,
- "compatibilityLevel": 5,
- "name": "General Science",
- "navigationMode": "non-linear",
- "allowBranching": "Yes",
- "shuffle": true,
- "attributions": [],
- "status": "Draft"
- },
- "folder": true,
- "children": [
- {
- "id": "do_113583348668153856123",
- "title": "test mcq",
- "tooltip": "test mcq",
- "primaryCategory": "Multiselect Multiple Choice Question",
- "objectType": "Question",
- "metadata": {
- "parent": "do_1134460323603578881212",
- "code": "ca3c9960-0d46-0469-8232-bea8dd1e430d",
- "subject": [
- "English"
- ],
- "showRemarks": "No",
- "channel": "01309282781705830427",
- "language": [
- "English"
- ],
- "medium": [
- "English"
- ],
- "mimeType": "application/vnd.sunbird.question",
- "templateId": "mcq-vertical",
- "createdOn": "2022-07-18T05:53:36.718+0000",
- "objectType": "Question",
- "gradeLevel": [
- "Grade 1"
- ],
- "primaryCategory": "Multiselect Multiple Choice Question",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-10-11T08:26:37.482+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_113583348668153856123",
- "lastStatusChangedOn": "2022-07-18T05:53:36.718+0000",
- "visibility": "Parent",
- "showTimer": "No",
- "author": "check1@yopmail.com",
- "index": 1,
- "qType": "MCQ",
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1665476797489",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "interactionTypes": [
- "choice"
- ],
- "framework": "tpd",
- "depth": 3,
- "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64",
- "compatibilityLevel": 4,
- "name": "test mcq",
- "topic": [
- "Forest"
- ],
- "board": "CBSE",
- "status": "Draft",
- "showEvidence": "No"
- },
- "folder": false,
- "children": [],
- "root": false,
- "extraClasses": "parent",
- "icon": "fa fa-file-o"
- },
- {
- "id": "do_1135998448873226241592",
- "title": "child text",
- "tooltip": "child text",
- "primaryCategory": "Text",
- "objectType": "Question",
- "metadata": {
- "parent": "do_1134460323603578881212",
- "code": "7266be54-df91-5fbd-dfb1-6f594273d914",
- "subject": [
- "English"
- ],
- "showRemarks": "No",
- "channel": "01309282781705830427",
- "language": [
- "English"
- ],
- "medium": [
- "English"
- ],
- "isCollaborationEnabled": false,
- "mimeType": "application/vnd.sunbird.question",
- "createdOn": "2022-08-10T13:15:15.347+0000",
- "objectType": "Question",
- "gradeLevel": [
- "Grade 1"
- ],
- "primaryCategory": "Text",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-08-10T13:15:15.347+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_1135998448873226241592",
- "lastStatusChangedOn": "2022-08-10T13:15:15.347+0000",
- "creator": "Vaibahv Bhuva",
- "visibility": "Parent",
- "showTimer": "No",
- "author": "check1@yopmail.com",
- "index": 2,
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1660137315379",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "interactionTypes": [
- "text"
- ],
- "framework": "tpd",
- "depth": 3,
- "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64",
- "compatibilityLevel": 4,
- "name": "child text",
- "topic": [
- "Forest"
- ],
- "board": "CBSE",
- "status": "Draft",
- "showEvidence": "No"
- },
- "folder": false,
- "children": [],
- "root": false,
- "extraClasses": "dependent",
- "icon": "fa fa-file-o"
- },
- {
- "id": "do_1135990324344504321511",
- "title": "Date Question",
- "tooltip": "Date Question",
- "primaryCategory": "Date",
- "objectType": "Question",
- "metadata": {
- "parent": "do_1134460323603578881212",
- "code": "8604e609-4a27-61c7-adc1-cd5d506eb96d",
- "subject": [
- "English"
- ],
- "channel": "01309282781705830427",
- "language": [
- "English"
- ],
- "medium": [
- "English"
- ],
- "isCollaborationEnabled": false,
- "mimeType": "application/vnd.sunbird.question",
- "createdOn": "2022-08-09T09:42:18.971+0000",
- "objectType": "Question",
- "gradeLevel": [
- "Grade 1"
- ],
- "primaryCategory": "Date",
- "contentDisposition": "inline",
- "lastUpdatedOn": "2022-08-09T09:42:18.971+0000",
- "contentEncoding": "gzip",
- "showSolutions": "No",
- "allowAnonymousAccess": "Yes",
- "identifier": "do_1135990324344504321511",
- "lastStatusChangedOn": "2022-08-09T09:42:18.971+0000",
- "visibility": "Parent",
- "showTimer": "No",
- "author": "check1@yopmail.com",
- "index": 3,
- "languageCode": [
- "en"
- ],
- "version": 1,
- "versionKey": "1660038139036",
- "showFeedback": "No",
- "license": "CC BY 4.0",
- "interactionTypes": [
- "date"
- ],
- "framework": "tpd",
- "depth": 3,
- "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64",
- "compatibilityLevel": 4,
- "name": "Date Question",
- "topic": [
- "Forest"
- ],
- "board": "CBSE",
- "status": "Draft"
- },
- "folder": false,
- "children": [],
- "root": false,
- "extraClasses": "",
- "icon": "fa fa-file-o"
- }
- ],
- "root": false,
- "extraClasses": "",
- "icon": "fa fa-folder-o"
- }
- ],
- "root": false,
- "extraClasses": "",
- "icon": "fa fa-folder-o"
- }
-]
-
-export const mockQuestionData = [
- {
- "question": "cc ii
",
- "identifier": "do_11357626234228736013446",
- "page_no": null
- },
- {
- "question": "dd io tt at ??
",
- "identifier": "do_11357638131503104013481",
- "page_no": null
- }
-];
-
-export const mockRenderingSequence = {
- name: "Ecm",
- sequence: [
- {
- value: "do_1134460323602841601200",
- name: "Chemistry",
- pages: [
- [
- "do_11357626234228736013446"
- ],
- [
- "do_11357638131503104013481"
- ]
- ],
- index: 0,
- },
- {
- value: "do_1134460323604971521236",
- name: "Biology",
- pages: [],
- index: 1,
- },
- ],
-};
-
-export const mockCreateArray = [
- [],
- [
- "do_11357638131503104013481"
- ]
-];
-
-export const mockPageNumberArray= [
- [
- "do_11357626234228736013446"
- ]
-]
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/assign-page-number/assign-page-number.component.spec.ts b/projects/collection-editor-library/src/lib/components/assign-page-number/assign-page-number.component.spec.ts
deleted file mode 100644
index 1457f8722..000000000
--- a/projects/collection-editor-library/src/lib/components/assign-page-number/assign-page-number.component.spec.ts
+++ /dev/null
@@ -1,217 +0,0 @@
-import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
-import { AssignPageNumberComponent } from './assign-page-number.component';
-import { HttpClientTestingModule } from '@angular/common/http/testing';
-import { TreeService } from '../../services/tree/tree.service';
-import { mockTreeService } from '../fancy-tree/fancy-tree.component.spec.data';
-import { EditorService } from '../../services/editor/editor.service';
-import { of, throwError } from 'rxjs';
-import { QuestionService } from '../../services/question/question.service';
-import { mockCreateArray, mockPageNumberArray, mockQuestionData, mockRenderingSequence, mockTreeData } from './assign-page-number.component.spec.data';
-
-const mockEditorService = {
- getToolbarConfig: () => { },
- getHierarchyObj: () => { },
- treeData: {}
-};
-
-describe('AssignPageNumberComponent', () => {
- let component: AssignPageNumberComponent;
- let fixture: ComponentFixture;
- // tslint:disable-next-line:one-variable-per-declaration
- let treeService, editorService, questionService;
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [HttpClientTestingModule],
- declarations: [AssignPageNumberComponent],
- providers: [
- QuestionService,
- { provide: TreeService, useValue: mockTreeService },
- { provide: EditorService, useValue: mockEditorService },
- ]
- })
- .compileComponents();
- });
-
- beforeEach(() => {
- fixture = TestBed.createComponent(AssignPageNumberComponent);
- treeService = TestBed.inject(TreeService);
- editorService = TestBed.inject(EditorService);
- questionService = TestBed.inject(QuestionService);
- component = fixture.componentInstance;
- // fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-
- it('#ngOnInit should called', () => {
- spyOn(editorService, 'getToolbarConfig').and.returnValue({
- title: 'Observation Form'
- });
- editorService.treeData = mockTreeData;
- spyOn(component, 'ngOnInit').and.callThrough();
- spyOn(component, 'createSequence').and.callFake(() => { });
- spyOn(component, 'treeEventListener').and.callFake(() => { });
- component.ngOnInit();
- expect(component.toolbarConfig).toBeDefined();
- expect(component.toolbarConfig.title).toEqual('Observation Form');
- expect(component.treeData).toBe(editorService.treeData);
- expect(component.treeEventListener).toHaveBeenCalled();
- expect(component.createSequence).toHaveBeenCalled();
- });
-
- it('#toolbarEventListener() should call #handleRedirectToQuestionSet() if event is backContent', () => {
- spyOn(component, 'toolbarEventListener').and.callThrough();
- spyOn(component, 'redirectToQuestionSet').and.callThrough();
- const event = {
- button: 'backContent'
- };
- component.toolbarEventListener(event);
- expect(component.redirectToQuestionSet).toHaveBeenCalled();
- });
-
- it('#redirectToQuestionSet() should emit #assignPageEmitter event', () => {
- spyOn(component, 'redirectToQuestionSet').and.callThrough();
- spyOn(component.assignPageEmitter, 'emit').and.callThrough();
- component.redirectToQuestionSet();
- expect(component.assignPageEmitter.emit).toHaveBeenCalledWith({ status: false });
- });
-
- it('#treeEventListener should call api call success', () => {
- spyOn(component, 'treeEventListener').and.callThrough();
- spyOn(editorService, 'getHierarchyObj').and.callFake(() => {
- return {
- '1234': {
- children: []
- }
- };
- });
- spyOn(treeService, 'getFirstChild').and.callFake(() => {
- return { data: { metadata: { identifier: '0123', allowScoring: 'Yes' } } };
- });
- spyOn(treeService, 'getHierarchyObj').and.callFake(() => {
- return { 1234: { children: ['1234567'] } };
- });
- spyOn(questionService, 'getQuestionList').and.returnValue(of({
- result: {
- questions: [
- {
- editorState: {
- options: [
- {
- answer: false,
- value: {
- body: 'Yes
',
- value: 0
- }
- },
- ],
- question: 'Yes or No?
'
- },
- identifier: 'do_1234',
- languageCode: [
- 'en'
- ]
- }
- ],
- count: 1
- }
- }));
- });
-
- it('#treeEventListener should call api call fail', () => {
- spyOn(component, 'treeEventListener').and.callThrough();
- spyOn(editorService, 'getHierarchyObj').and.callFake(() => {
- return {
- '1234': {
- children: []
- }
- };
- });
- spyOn(treeService, 'getFirstChild').and.callFake(() => {
- return { data: { metadata: { identifier: '0123', allowScoring: 'Yes' } } };
- });
- spyOn(treeService, 'getHierarchyObj').and.callFake(() => {
- return { 1234: { children: ['1234567'] } };
- });
- spyOn(questionService, 'getQuestionList').and.returnValue(throwError({}));
- component.treeEventListener({ event: { identifier: '1234' } });
- });
-
- it(`#treeEventListener should call setPageNumber()`, () => {
- spyOn(component, 'setPageNumber').and.callThrough();
- component.criteriaId = 'do_1134460323602841601200';
- component.rendering_sequence = mockRenderingSequence;
- component.pageNumArray = mockPageNumberArray;
- component.questions = mockQuestionData;
- component.setPageNumber({ event: { identifier: '1234' } });
- expect(component.setPageNumber).toHaveBeenCalledWith({event: { identifier: '1234' }});
- });
-
- it('#onValueChange should call to assign the page numbers', () => {
- spyOn(component, 'onValueChange').and.callThrough();
- component.questions = mockQuestionData;
- component.criteriaId = 'do_1134460323602841601200';
- component.rendering_sequence = mockRenderingSequence;
- component.pageNumArray = mockPageNumberArray;
- const question = mockQuestionData[0];
- component.onValueChange(1, question, 1);
- expect(component.onValueChange).toHaveBeenCalledWith(1, question, 1);
- expect(question.page_no).toBe(1);
- });
-
- it('#createSequence should call to create the sequence for pagination', () => {
- spyOn(component, 'createSequence').and.callThrough();
- component.treeData = mockTreeData;
- component.createSequence(component.treeData);
- expect(component.createSequence).toHaveBeenCalledWith(component.treeData);
- });
-
- it('#findSequenceCriteria should call to check the rendering sequence', () => {
- spyOn(component, 'findSequenceCriteria').and.callThrough();
- component.criteriaId = 'do_1134460323602841601200';
- component.rendering_sequence = mockRenderingSequence;
- component.findSequenceCriteria();
- expect(component.criteriaId).toBe('do_1134460323602841601200');
- });
-
- it('#clearInput should call to check the rendering sequence', () => {
- spyOn(component, 'clearInput').and.callThrough();
- component.questions = mockQuestionData;
- component.criteriaId = 'do_1134460323602841601200';
- component.rendering_sequence = mockRenderingSequence;
- component.pageNumArray = mockPageNumberArray;
- const question = mockQuestionData[0];
- component.clearInput(1, question, 1);
- expect(component.clearInput).toHaveBeenCalledWith(1, question, 1);
- expect(question.page_no).toBe(1);
- });
-
- it('#updateRenderingSequence should call to update the rendering sequence', () => {
- spyOn(component, 'updateRenderingSequence').and.callThrough();
- component.createArray = mockCreateArray;
- component.pageNumArray = mockPageNumberArray;
- component.updateRenderingSequence();
- expect(component.createArray.length).toEqual(2);
- });
-
- it('#setNewArrayToCreateArray should call to create the new array', () => {
- spyOn(component, 'setNewArrayToCreateArray').and.callThrough();
- component.numArray = [1, 2, 3];
- component.setNewArrayToCreateArray();
- expect(component.createArray.length).toEqual(3);
- })
-
- it(`updateRenderingSequence() should be called`, () => {
- spyOn(component, 'updateRenderingSequence').and.callThrough();
- component.createArray = mockCreateArray;
- component.pageNumArray = mockPageNumberArray;
- component.updateRenderingSequence();
- expect(component.updateRenderingSequence).toHaveBeenCalled();
- expect(component.createArray.length).toEqual(2);
- });
-
-});
-
-
diff --git a/projects/collection-editor-library/src/lib/components/assign-page-number/assign-page-number.component.ts b/projects/collection-editor-library/src/lib/components/assign-page-number/assign-page-number.component.ts
deleted file mode 100644
index 7fd5f9d21..000000000
--- a/projects/collection-editor-library/src/lib/components/assign-page-number/assign-page-number.component.ts
+++ /dev/null
@@ -1,204 +0,0 @@
-import { Component, EventEmitter, OnInit, Output } from '@angular/core';
-import { EditorService } from '../../services/editor/editor.service';
-import { QuestionService } from '../../services/question/question.service';
-import { TreeService } from '../../services/tree/tree.service';
-import * as _ from 'lodash-es';
-
-@Component({
- selector: 'lib-assign-page-number',
- templateUrl: './assign-page-number.component.html',
- styleUrls: ['./assign-page-number.component.scss']
-})
-export class AssignPageNumberComponent implements OnInit {
-
- toolbarConfig: any = {};
- pageId = 'pagination';
- treeData: any;
- questions = [];
- // tslint:disable-next-line:variable-name
- rendering_sequence: any;
- @Output() assignPageEmitter = new EventEmitter();
- recordedBy: any;
- criteriaId: any;
- createArray = [];
- pageNumArray = [];
- numArray = [];
-​
- constructor(private editorService: EditorService, private treeService: TreeService,
- private questionService: QuestionService) { }
-
- ngOnInit() {
- this.toolbarConfig = this.editorService.getToolbarConfig();
- this.toolbarConfig.title = 'Observation Form';
- this.treeData = this.editorService.treeData;
- this.createSequence(this.treeData);
- this.treeEventListener({
- identifier: _.get(this.treeData[0], 'children[0].id'),
- criteriaName: _.get(this.treeData[0], 'children[0].title')
- });
- }
-
- toolbarEventListener(event) {
- switch (event.button) {
- case 'backContent':
- this.redirectToQuestionSet();
- break;
- }
- }
-
- redirectToQuestionSet() {
- this.assignPageEmitter.emit({ status: false });
- }
-
- treeEventListener(event) {
- this.createArray = [];
- this.criteriaId = event?.identifier;
- const data = this.treeService.getFirstChild();
- const hierarchy = this.editorService.getHierarchyObj(data, '', event?.identifier);
- this.questionService.getQuestionList(_.get(hierarchy[event?.identifier], 'children'), 'editorState')
- .subscribe((response: any) => {
- this.questions = [];
- const questionsArray = _.get(response, 'result.questions');
- questionsArray.forEach(element => {
- this.questions.push({
- question: element?.editorState?.question,
- identifier: element?.identifier,
- page_no: null,
- });
- });
- this.setPageNumber(event);
- }, (error: any) => {
- console.log(error);
- });
- }
-​
- setPageNumber(event) {
- this.pageNumArray = this.findSequenceCriteria().pages;
- this.pageNumArray.forEach((entry, index) => {
- if (!_.isEmpty(entry)) {
- entry.forEach((identifier) => {
- const getQuestion = this.questions.find((el) => el.identifier === identifier);
- getQuestion.page_no = index + 1;
- });
- }
- });
- }
-​
-updateRenderingSequence() {
- let newArray;
- if (this.createArray.length === this.pageNumArray.length) {
- this.createArray = this.pageNumArray;
- } else if (this.pageNumArray.length > this.createArray.length) {
- const result = this.pageNumArray.slice(0);
- newArray = result.splice.apply(result, [0, this.createArray.length].concat(this.createArray));
- } else {
- newArray = [...this.pageNumArray, ...this.createArray.slice(this.pageNumArray.length)];
- }
- this.createArray = newArray ? newArray : this.pageNumArray;
- }
-​
- onValueChange(event, question, index) {
- if (+event === 0) {
- this.createArrayBySubjects(index, question);
- this.setNewArrayToCreateArray();
- this.pageNumArray = this.findSequenceCriteria().pages;
- this.updateRenderingSequence();
- return true;
- }
-​
- question.page_no = +event;
- this.addArrayToPage();
- this.pageNumArray = this.findSequenceCriteria().pages;
-​
- if (this.pageNumArray.length !== 0) {
- this.setNewArrayToCreateArray();
- this.updateRenderingSequence();
- this.pageNumArray = [];
- } else {
- this.setNewArrayToCreateArray();
- }
-​
- _.forEach(this.rendering_sequence?.sequence, (data) => {
- if (data.value === this.criteriaId) {
- this.createArray.filter((arr, index1) => arr.some((e, index2) => {
- if (e === question.identifier) {
- this.createArray[index1].splice(index2, 1);
- }
- }));
- this.createArray[Number(event) - 1].push(question.identifier);
- data.pages = this.createArray;
- }
- });
- }
-
- setNewArrayToCreateArray() {
- for (let i = 0; i < Math.max(...this.numArray); i++) {
- if (!this.createArray[i]) {
- this.createArray[i] = new Array();
- }
- }
- }
-
- createArrayBySubjects(index, question) {
- const subjectObject = this.findSequenceCriteria();
- ​
- if (subjectObject) {
- const questionsIdArray = subjectObject.pages[question.page_no - 1];
- const questionIndex = questionsIdArray.indexOf(question.identifier);
- questionsIdArray.splice(questionIndex, 1);
- }
- this.questions[index].page_no = null;
- this.addArrayToPage();
- this.createArray = [];
-
- }
-
- addArrayToPage() {
- this.numArray = [];
- // tslint:disable-nevxt-line:no-shadowed-variable
- _.forEach(this.questions, (data) => {
- this.numArray.push(data.page_no);
- });
-​
- this.createArray = [];
- }
-
- clearInput(event, question, index) {
- this.createArrayBySubjects(index, question);
- this.setNewArrayToCreateArray();
- this.pageNumArray = this.findSequenceCriteria().pages;
- this.updateRenderingSequence();
- }
-
- findSequenceCriteria() {
- return _.find(this.rendering_sequence?.sequence, (data) => {
- return data.value === this.criteriaId;
- });
- }
-​
- createSequence(data) {
- this.recordedBy = _.get(this.treeService.getFirstChild(), 'data.metadata.recordedBy');
- // tslint:disable-next-line:variable-name
- const dataArray = [];
- // tslint:disable-next-line:variable-name
- this.rendering_sequence = {
- name: this.recordedBy === 'Self' ? 'Criteria' : 'Ecm',
- sequence: []
- };
- _.forEach(data, (child: any) => {
- if (child.children) {
- _.forEach(child.children, (seq) => {
- dataArray.push(seq);
- });
- }
- });
- _.forEach(dataArray, (seq, i) => {
- this.rendering_sequence.sequence.push({
- value: seq?.id,
- name: seq?.title,
- pages: [],
- index: i
- });
- });
- }
-}
diff --git a/projects/collection-editor-library/src/lib/components/bulk-upload/bulk-upload.component.html b/projects/collection-editor-library/src/lib/components/bulk-upload/bulk-upload.component.html
deleted file mode 100644
index b1c36f8a9..000000000
--- a/projects/collection-editor-library/src/lib/components/bulk-upload/bulk-upload.component.html
+++ /dev/null
@@ -1,210 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-

-
-
-
-
-
-
-
-
-
-
-
-
{{configService.labelConfig?.lbl?.downloadSampleMetadataCsvFileAndCreate}}
-
{{configService.labelConfig?.lbl?.makeSureYourFile}} :
-
- - {{configService.labelConfig?.lbl?.allColumnsAreAvailableShownFormat}}
- - {{configService.labelConfig?.lbl?.hasAllMandatoryColumnsFilledAsMarkedInFormat}}
- - {{configService.labelConfig?.lbl?.hasNoDuplicateUrlsFilepathColumn}}
-
-
-
-
-
-
-
-
-
-
-
- {{configService.labelConfig?.lbl?.processingDroppedFiles}}
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- {{configService.labelConfig?.lbl?.dragAndDrop}}
- {{configService.labelConfig?.lbl?.or}}
-
-
-
{{configService.labelConfig?.lbl?.uploadCSVXlEntries}}
-
-
-
-
-
-
-
-
-

-
-
-
-
-
-
-
-
-
- {{configService.labelConfig?.lbl?.validatingCSVFile}}
-
-
-
-
-
-
-
- {{configService.labelConfig?.lbl?.metadataFileValidationFailed}}
-
-
{{configService.labelConfig?.lbl?.metadataFollowingError}}
-
-
-
-
-
-
{{configService.labelConfig?.lbl?.uploadingYourContentFromCSV}}
-
-
-
{{configService.labelConfig?.lbl?.uploadFail}} : {{ process?.overall_stats?.upload_failed }}
-
{{configService.labelConfig?.lbl?.uploadSuccessful}} : {{ process?.overall_stats?.upload_success}}
-
{{configService.labelConfig?.lbl?.uploadRemaining}} : {{ process?.overall_stats?.upload_pending }}
-
-
-
-
-
-
{{configService.labelConfig?.lbl?.bulkUploadComplete}}
-
-
-
{{configService.labelConfig?.lbl?.uploadFail}} : {{ process?.overall_stats?.upload_failed }}
-
{{configService.labelConfig?.lbl?.contentUploaded}} : {{ process?.overall_stats?.total }}
-
{{configService.labelConfig?.lbl?.uploadSuccessful}} : {{ process?.overall_stats?.upload_success }}
-
-
-
-
-
-
-
-
-
-
-
-
- {{configService.labelConfig?.lbl?.bulkUploadNoticeLine1}}
- '{{configService.labelConfig?.lbl?.close}}'
- {{configService.labelConfig?.lbl?.bulkUploadNoticeLine2}}
- {{configService.labelConfig?.lbl?.bulkUploadNoticeLine3}}
-
-
-
-
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/bulk-upload/bulk-upload.component.scss b/projects/collection-editor-library/src/lib/components/bulk-upload/bulk-upload.component.scss
deleted file mode 100644
index 8e10e6342..000000000
--- a/projects/collection-editor-library/src/lib/components/bulk-upload/bulk-upload.component.scss
+++ /dev/null
@@ -1,40 +0,0 @@
-.qq-uploader.qq-uploader-selector.custom-qq-uploader {
- background: inherit;
- border-color: none;
- max-height: inherit;
- min-height: inherit;
- overflow-y: inherit;
- width: inherit;
- height: 240px;
- display: flex;
- justify-content: center;
- align-items: center;
-}
-
-.sb-bk-upload h6 {
- line-height: 22px;
-}
-
-@media screen and (min-width: 768px) {
- .sb-bk-upload .my--20 {
- margin: -1.25rem 0 !important;
- }
-}
-
-.sb-bk-upload .sb-circle-download-icon {
- background: var(--secondary-100);
- display: inline-block;
- width: 1.8rem;
- height: 1.8rem;
- line-height: 1.8rem;
- color: var(--white);
- border-radius: 100%;
- text-align: center;
- font-size: 0.8rem;
-}
-
-.sb-loader-with-lbl{
- .sb-loader{
- position: relative !important;
- }
-}
diff --git a/projects/collection-editor-library/src/lib/components/bulk-upload/bulk-upload.component.spec.ts b/projects/collection-editor-library/src/lib/components/bulk-upload/bulk-upload.component.spec.ts
deleted file mode 100644
index 065ca4ffe..000000000
--- a/projects/collection-editor-library/src/lib/components/bulk-upload/bulk-upload.component.spec.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
-
-import { BulkUploadComponent } from './bulk-upload.component';
-import { ToasterService } from '../../services/toaster/toaster.service';
-import { EditorService } from '../../services/editor/editor.service';
-import { ConfigService } from '../../services/config/config.service';
-import { BulkJobService } from '../../services/bulk-job/bulk-job.service';
-import { TreeService } from '../../services/tree/tree.service';
-import { EditorTelemetryService } from '../../services/telemetry/telemetry.service';
-import { HttpClientTestingModule } from '@angular/common/http/testing';
-import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
-import { of } from 'rxjs';
-declare const SunbirdFileUploadLib: any;
-xdescribe('BulkUploadComponent', () => {
- let component: BulkUploadComponent;
- let fixture: ComponentFixture;
-
- beforeEach(waitForAsync(() => {
- TestBed.configureTestingModule({
- declarations: [ BulkUploadComponent ],
- imports: [HttpClientTestingModule],
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
- providers: [ToasterService, EditorService, ConfigService,
- BulkJobService, TreeService, EditorTelemetryService]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(BulkUploadComponent);
- component = fixture.componentInstance;
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
- it('should call closeBulkUploadModal', () => {
- component.closeBulkUploadModal();
- expect(component.showBulkUploadModal).toBeFalsy();
- expect(component.bulkUploadState).toBe(0);
- });
- it('should call downloadSampleCSVFile', () => {
- spyOn(window, 'open').and.callThrough();
- component.sampleMetadataCsvUrl = 'https://dockstorage.blob.core.windows.net/content-service/bulk-question-upload-sample-format.csv';
- const downloadConfig = {
- blobUrl: component.sampleMetadataCsvUrl,
- successMessage: false,
- fileType: 'csv',
- fileName: 'do_11339645670870220811360'
- };
- component.downloadSampleCSVFile();
- expect(window.open).toHaveBeenCalledWith(downloadConfig.blobUrl, '_blank');
- });
- xit('should call updateBulkUploadState for state 6', () => {
- component.bulkUploadState = 6;
- spyOn(component, 'closeBulkUploadModal').and.callThrough();
- component.updateBulkUploadState('increment');
- expect(component.closeBulkUploadModal).toHaveBeenCalled();
- });
- xit('should call updateBulkUploadState for state other than 4', () => {
- component.bulkUploadState = 1;
- spyOn(component, 'initiateDocumentUploadModal').and.callThrough();
- component.updateBulkUploadState('increment');
- expect(component.initiateDocumentUploadModal).toHaveBeenCalled();
- });
-
- it('#uploadToBlob should upload file to blob and return URL', () => {
- const editorService = TestBed.inject(EditorService);
- spyOn(editorService, 'appendCloudStorageHeaders').and.callFake((config) => {
- return {...config, headers: { 'x-ms-blob-type': 'BlockBlob' }}
- });
- spyOn(editorService.httpClient, 'put').and.returnValue(of({}));
- const pre_signed_url = 'https://ekstep-public-dev.s3-ap-south-1.amazonaws.com/content/assets/do_11359481407042355211/test.pdf?X-Amz';
- const resultSub = component.uploadToBlob(pre_signed_url, {});
- resultSub.subscribe((data) => {
- expect(data).toEqual('https://ekstep-public-dev.s3-ap-south-1.amazonaws.com/content/assets/do_11359481407042355211/test.pdf');
- expect(editorService.appendCloudStorageHeaders).toHaveBeenCalled();
- })
- });
-
-});
diff --git a/projects/collection-editor-library/src/lib/components/bulk-upload/bulk-upload.component.ts b/projects/collection-editor-library/src/lib/components/bulk-upload/bulk-upload.component.ts
deleted file mode 100644
index 8ea0c5dd3..000000000
--- a/projects/collection-editor-library/src/lib/components/bulk-upload/bulk-upload.component.ts
+++ /dev/null
@@ -1,467 +0,0 @@
-import { Component, OnInit, ViewChild, ElementRef, Output, EventEmitter } from '@angular/core';
-import { FineUploader } from 'fine-uploader';
-import * as _ from 'lodash-es';
-import { throwError } from 'rxjs';
-import { catchError, map, mergeMap } from 'rxjs/operators';
-import { ToasterService } from '../../services/toaster/toaster.service';
-import { EditorService } from '../../services/editor/editor.service';
-import { ConfigService } from '../../services/config/config.service';
-import { BulkJobService } from '../../services/bulk-job/bulk-job.service';
-import { TreeService } from '../../services/tree/tree.service';
-import { EditorTelemetryService } from '../../services/telemetry/telemetry.service';
-declare const SunbirdFileUploadLib: any;
-
-@Component({
- selector: 'lib-bulk-upload',
- templateUrl: './bulk-upload.component.html',
- styleUrls: ['./bulk-upload.component.scss']
-})
-export class BulkUploadComponent implements OnInit {
- public collectionId: string;
- @ViewChild('fineUploaderUI') fineUploaderUI: ElementRef;
- @Output() bulkUploadEmitter = new EventEmitter();
- public storedCollectionData;
- public process: any = {
- process_id: '',
- status: '',
- type: 'bulk_upload',
- overall_stats: {
- total: 0,
- upload_failed: 0,
- upload_pending: 0,
- upload_success: 0
- }
- };
- public oldProcessStatus = '';
- public stageStatus = '';
- public contents: Array = [];
- public completionPercentage = 0;
- public showBulkUploadModal = false;
- public bulkUploadState = 0;
- public loading = false;
- public telemetryPageId: string;
- public assetConfig: any = {
- csv: {
- accepted: 'csv',
- size: 50
- }
- };
- uploader;
- public bulkUploadErrorMsgs = [];
- public bulkUploadValidationError = '';
- public sampleMetadataCsvUrl = '';
- constructor(
- private toasterService: ToasterService, private editorService: EditorService, public configService: ConfigService,
- private bulkJobService: BulkJobService, private treeService: TreeService, public telemetryService: EditorTelemetryService) { }
-
- ngOnInit() {
- this.collectionId = _.get(this.editorService.editorConfig, 'context.identifier');
- // tslint:disable-next-line:max-line-length
- this.sampleMetadataCsvUrl = _.get(this.editorService, 'editorConfig.config.publicStorageAccount') + _.get(this.configService.urlConFig, 'URLS.BULKJOB.SAMPLE_QUESTION_FILE');
- this.checkBulkUploadStatus();
- this.stageStatus = this.getContentStatus();
- }
-
- calculateCompletionPercentage() {
- this.completionPercentage = 0;
- console.log('process.overall_stats', this.process.overall_stats);
- const { total, upload_pending } = this.process.overall_stats;
-
- // tslint:disable-next-line:radix
- this.completionPercentage = parseInt(_.toNumber(100 - ((upload_pending / total) * 100)));
- console.log('completionPercentage', this.completionPercentage);
- }
-
- checkBulkUploadStatus() {
- const reqData = {
- filters: {
- program_id: _.get(this.editorService.editorConfig, 'context.programId', ''),
- collection_id: this.collectionId,
- type: 'bulk_upload',
- createdby: _.get(this.editorService.editorConfig, 'context.user.id')
- },
- limit: 1
- };
- this.bulkJobService.getBulkOperationStatus(reqData)
- .subscribe((statusResponse) => {
- const count = _.get(statusResponse, 'result.count', 0);
- if (!count) {
- return;
- }
-
- this.process = _.first(_.get(statusResponse, 'result.process', []));
- this.oldProcessStatus = this.process.status;
- this.searchContentWithProcessId();
- this.bulkUploadState = 5;
- }, (error) => {
- console.log(error);
- });
- }
-
- searchContentWithProcessId() {
- this.bulkJobService.searchContentWithProcessId(this.process.process_id).subscribe((searchResponse) => {
- this.process.overall_stats.upload_failed = 0;
- this.process.overall_stats.upload_success = 0;
- this.process.overall_stats.upload_pending = 0;
-
- if (_.get(searchResponse, 'result.count', 0) > 0) {
- this.contents = _.compact(_.get(searchResponse.result, 'Question'));
- let status = this.stageStatus;
- if (status === 'draft') {
- status = 'Draft';
- }
- _.each(this.contents, (content) => {
- if (content.status === 'Retired') {
- this.process.overall_stats.upload_failed++;
- } else if (content.status === status) {
- this.process.overall_stats.upload_success++;
- } else {
- this.process.overall_stats.upload_pending++;
- }
- });
-
- this.process.overall_stats.upload_pending = this.process.overall_stats.total -
- (this.process.overall_stats.upload_success + this.process.overall_stats.upload_failed);
-
- if (this.process.overall_stats.upload_pending === 0) {
- this.process.status = 'completed';
- }
- this.editorService.fetchCollectionHierarchy(this.collectionId).subscribe((response) => {
- this.storedCollectionData = response.result.questionSet;
- this.calculateCompletionPercentage();
- if (this.oldProcessStatus !== this.process.status) {
- this.updateJob();
- }
-
- });
- if (this.process.status === 'completed') {
- this.editorService.nextBulkUploadStatus('completed');
- } else {
- this.editorService.nextBulkUploadStatus('processing');
- }
- this.bulkUploadEmitter.emit({ status: true, type: 'updateHierarchy' });
- }
- }, (error) => {
- console.log(error);
- });
- }
-
- downloadReport() {
- const headers = ['Name of the Question', 'Level 1 Question Set Section', 'Keywords', 'Audience',
- 'Author', 'Copyright', 'License', 'Attributions', 'Identifier of the question '];
- try {
- headers.push('Status');
- headers.push('Reason for failure');
-
- const tableData = _.map(this.contents, (content, i) => {
- const result: any = {};
- result.name = _.get(content, 'name', '');
- result.level1 = '';
- result.keywords = _.join(_.get(content, 'keywords', []), ', ');
- result.audience = _.join(_.get(content, 'audience', []), ', ');
- result.creator = _.get(content, 'author', '');
- result.copyright = _.get(content, 'copyright', '');
- result.license = _.get(content, 'license', '');
- result.attributions = _.join(_.get(content, 'attributions', []), ', ');
- result.identifier = _.get(content, 'identifier', '');
- const selctedUnitParents: any = this.getParents(this.storedCollectionData.children, content.identifier);
- if (selctedUnitParents.found && !_.isEmpty(selctedUnitParents.parents)) {
- result.level1 = selctedUnitParents.parents;
- }
-
- let status = _.get(content, 'status', '');
- if ((this.stageStatus === 'draft' && status === 'Draft')) {
- status = 'Success';
- } else if (status === 'Retired') {
- status = 'Failure';
- }
-
- result.status = status;
- result.failedReason = _.get(content, 'questionUploadStatus', '');
- return result;
- });
-
- const csvDownloadConfig = {
- filename: `Bulk Upload ${this.questionSetMetadata.name.trim()}`,
- tableData,
- headers,
- showTitle: false
- };
- this.editorService.generateCSV(csvDownloadConfig);
- } catch (err) {
- console.log(err);
- this.toasterService.error(_.get(this.configService.labelConfig, 'messages.error.001'));
- }
- }
-
- updateJob() {
- const reqData = {
- process_id: this.process.process_id,
- overall_stats: this.process.overall_stats,
- status: this.process.status,
- updatedby: _.get(this.editorService.editorConfig, 'context.user.id')
- };
- this.bulkJobService.updateBulkJob(reqData)
- .subscribe((updateResponse) => {
- if (this.process.status === 'completed') {
- this.bulkUploadState = 6;
- } else if (this.process.status === 'processing') {
- this.bulkUploadState = 5;
- }
- this.oldProcessStatus = this.process.status;
- }, (error) => {
- console.log(error);
- });
- }
-
- initiateDocumentUploadModal() {
- this.loading = false;
- this.bulkUploadValidationError = '';
- this.bulkUploadErrorMsgs = [];
- return setTimeout(() => {
- this.initiateUploadModal();
- }, 0);
- }
-
- initiateUploadModal() {
- this.uploader = new FineUploader({
- element: document.getElementById('upload-document-div'),
- template: 'qq-template-validation',
- multiple: false,
- autoUpload: false,
- request: {
- endpoint: '/assets/uploads'
- },
- validation: {
- allowedExtensions: [this.assetConfig.csv.accepted],
- acceptFiles: ['text/csv'],
- itemLimit: 1,
- sizeLimit: _.toNumber(this.assetConfig.csv.size) * 1024 * 1024 // Convert into MB
- },
- messages: {
- sizeError: `{file} is too large, maximum file size is ${this.assetConfig.csv.size} MB.`,
- typeError: `Invalid content type (supported type: ${this.assetConfig.csv.accepted})`
- },
- callbacks: {
- onStatusChange: () => { },
- onSubmit: () => {
- this.uploadContent();
- },
- onError: () => {
- this.uploader.reset();
- }
- }
- });
- this.fineUploaderUI.nativeElement.remove();
- }
-
- uploadContent() {
- const file = this.uploader.getFile(0);
- const filename = this.uploader.getName(0);
- if (file == null) {
- this.toasterService.error('File is required to upload');
- this.uploader.reset();
- return;
- }
- this.bulkUploadState = 3;
- this.startBulkUpload(file, filename);
- }
-
- startBulkUpload(file, filename) {
- this.generatePreSignedUrl(filename).pipe(
- map(response => {
- return _.get(response.result, 'pre_signed_url');
- }), mergeMap(signedURL => {
- return this.uploadToBlob(signedURL, file);
- }), mergeMap(signedURL => this.createImportRequest(signedURL).pipe(
- map(importResponse => {
- this.process.process_id = _.get(importResponse, 'result.processId');
- return _.get(importResponse, 'result.count');
- }))), mergeMap(totalQuestion => this.createJobRequest(totalQuestion)
- )).subscribe((jobResponse) => {
- this.process = _.get(jobResponse, 'result');
- this.oldProcessStatus = this.process.status;
- this.calculateCompletionPercentage();
- this.editorService.nextBulkUploadStatus('processing');
- this.bulkUploadEmitter.emit({ status: true, type: 'updateHierarchy' });
- console.log('response ::', jobResponse);
- });
- }
-
- generatePreSignedUrl(filename) {
- const request = {
- content: {
- fileName: filename
- }
- };
- return this.editorService.generatePreSignedUrl(request, this.collectionId, 'hierarchy').pipe(catchError(err => {
- const errInfo = { errorMsg: _.get(this.configService.labelConfig, 'messages.error.035') };
- this.uploader.reset();
- this.updateBulkUploadState('decrement');
- return throwError(this.editorService.apiErrorHandling(err, errInfo));
- }));
- }
-
- uploadToBlob(signedURL, file) {
- const csp = _.get(this.editorService.editorConfig, 'context.cloudStorage.provider', 'azure');
- const uploaderLib = new SunbirdFileUploadLib.FileUploader();
- return uploaderLib.upload({ url: signedURL, file, csp })
- .on("error", (error) => {
- const errInfo = { errorMsg: _.get(this.configService.labelConfig, 'messages.error.036')};
- this.uploader.reset();
- this.updateBulkUploadState('decrement');
- return throwError(this.editorService.apiErrorHandling(error, errInfo));
- }).on("completed", (completed) => {
- return signedURL.split('?')[0]
- })
- }
-
- createImportRequest(fileUrl) {
- let reqBody = {
- fileUrl,
- questionType: 'MCQ',
- createdBy: _.get(this.editorService.editorConfig, 'context.user.id'),
- author: _.get(this.editorService.editorConfig, 'context.user.fullName', ''),
- status: 'Draft',
- questionSetId: this.collectionId
- };
- const headers = { 'X-Channel-ID': _.get(this.editorService.editorConfig, 'context.channel') };
- const derivedProperties = ['additionalCategories', 'board', 'medium', 'gradeLevel', 'subject', 'audience',
- 'license', 'framework', 'topic'];
- reqBody = _.merge({}, reqBody, _.pick(this.questionSetMetadata, derivedProperties));
- return this.bulkJobService.createBulkImport(reqBody, headers).pipe(catchError(err => {
- const errInfo = { errorMsg: _.get(this.configService.labelConfig, 'messages.error.001')};
- this.uploader.reset();
- if (_.get(err, 'error.result.messages')) {
- this.bulkUploadState = 4;
- this.bulkUploadErrorMsgs = _.get(err, 'error.result.messages');
- return throwError({});
- } else {
- this.updateBulkUploadState('decrement');
- return throwError(this.editorService.apiErrorHandling(err, errInfo));
- }
- }));
- }
-
- get questionSetMetadata() {
- const rootNode = this.treeService.getFirstChild();
- return _.get(rootNode, 'data.metadata');
- }
-
- viewDetails($event) {
- $event.preventDefault();
- this.showBulkUploadModal = true;
- if (this.process.status === 'processing') {
- this.bulkUploadState = 5;
- this.checkBulkUploadStatus();
- } else {
- this.bulkUploadState = 6;
- }
- }
-
- getContentStatus() {
- return 'draft';
- }
-
- createJobRequest(rowsCount) {
- this.bulkUploadState = 5;
- const orgId = _.get(this.editorService.editorConfig, 'context.contributionOrgId');
- const createdby = _.get(this.editorService.editorConfig, 'context.user.id');
- const programId = _.get(this.editorService.editorConfig, 'context.programId', '');
- const collectionId = this.collectionId;
-
- this.process.overall_stats = {
- total: rowsCount,
- upload_pending: rowsCount,
- upload_failed: 0,
- upload_success: 0
- };
- this.process.data = {
- program_id: programId,
- collection_id: collectionId
- };
- this.process.createdon = new Date();
- this.process.createdby = createdby;
- this.process.program_id = programId;
- this.process.collection_id = collectionId;
- this.process.status = 'processing';
-
- if (orgId) {
- this.process.data.org_id = orgId;
- this.process.org_id = orgId;
- }
- const request = { ...this.process };
- return this.bulkJobService.createBulkJob(request);
- }
-
- async openBulkUploadModal() {
- this.bulkUploadState = 0;
- this.showBulkUploadModal = true;
- this.updateBulkUploadState('increment');
- }
-
- closeBulkUploadModal() {
- this.showBulkUploadModal = false;
- this.bulkUploadState = 0;
- if (this.uploader) {
- this.uploader.reset();
- }
- }
-
- updateBulkUploadState(action) {
- if (this.bulkUploadState === 6 && action === 'increment') {
- return this.closeBulkUploadModal();
- }
- if (this.bulkUploadState === 4 && action === 'decrement') {
- this.bulkUploadState = 3;
- }
- this.bulkUploadState += (action === 'increment') ? 1 : -1;
- if (this.bulkUploadState === 2) {
- this.initiateDocumentUploadModal();
- }
- }
-
- getParentsHelper(tree: any, id: string, parents: string = '') {
- const self = this;
- if (tree.identifier === id) {
- return {
- found: true,
- parents
- };
- }
- let result = {
- found: false,
- };
- if (tree.children) {
- _.forEach(tree.children, (subtree, key) => {
- let maybeParents = parents;
- if (tree.identifier !== undefined) {
- maybeParents = tree.name;
- }
- const maybeResult: any = self.getParentsHelper(subtree, id, maybeParents);
- if (maybeResult.found) {
- result = maybeResult;
- return false;
- }
- });
- }
- return result;
- }
-
- getParents(data: Array, id: string) {
- const tree = {
- children: data
- };
- return this.getParentsHelper(tree, id);
- }
-
- downloadSampleCSVFile() {
- const downloadConfig = {
- blobUrl: this.sampleMetadataCsvUrl,
- successMessage: false,
- fileType: 'csv',
- fileName: this.collectionId
- };
- window.open(downloadConfig.blobUrl, '_blank');
- }
-}
diff --git a/projects/collection-editor-library/src/lib/components/ckeditor-tool/ckeditor-tool.component.html b/projects/collection-editor-library/src/lib/components/ckeditor-tool/ckeditor-tool.component.html
deleted file mode 100644
index 7170f215b..000000000
--- a/projects/collection-editor-library/src/lib/components/ckeditor-tool/ckeditor-tool.component.html
+++ /dev/null
@@ -1,291 +0,0 @@
-
-
-
-
0">
-
- {{configService.labelConfig?.lbl?.charactersLeft}} {{charactersLeft}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{assetsCount}}
-
-
{{emptyImageSearchMessage}}
-
-
-
-
![{{data?.name}}]()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{assetsCount}}
-
-
{{emptyImageSearchMessage}}
-
-
-
-
![{{data?.name}}]()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{assetsCount}}
-
-
{{emptyVideoSearchMessage}}
-
-
-
-
-
-
![{{data?.name}}]()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{assetsCount}}
-
-
{{emptyVideoSearchMessage}}
-
-
-
-
-
-
![{{data?.name}}]()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{configService.labelConfig?.lbl?.chooseOrDragImage}}*
-
-
-
- {{assetName}}
- {{configService.labelConfig?.lbl?.upload}} {{assetConfig.image.accepted}} ({{configService.labelConfig?.lbl?.maxFileSize}}
- {{assetConfig.image.size}}{{assetConfig.image.sizeType}})
-
-
-
-
-
- - {{configService.labelConfig?.lbl?.allowedFileTypes}} {{assetConfig.image.accepted}}
- - {{configService.labelConfig?.lbl?.maximumAllowedFileSize}} {{assetConfig.image.size}}{{assetConfig.image.sizeType}}
-
-
-
{{configService.labelConfig?.lbl?.copyRightsAndLicense}}*
-
{{termsAndCondition}}
-
-
-
-
-
- -
-
- {{configService.labelConfig?.lbl?.dropChooseFile}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{configService.labelConfig?.lbl?.chooseOrDragVideo}}*
-
-
-
- {{videoFile?.name}}
- {{configService.labelConfig?.lbl?.upload}} {{assetConfig.video.accepted}} ({{configService.labelConfig?.lbl?.maxFileSize}}
- {{assetConfig.video.size}}{{assetConfig.video.sizeType}})
-
-
-
-
-
- - {{configService.labelConfig?.lbl?.allowedFileTypes}} {{assetConfig.video.accepted}}
- - {{configService.labelConfig?.lbl?.maximumAllowedFileSize}} {{assetConfig.video.size}}{{assetConfig.video.sizeType}}
-
-
-
{{configService.labelConfig?.lbl?.copyRightsAndLicense}}*
-
{{termsAndCondition}}
-
-
-
-
-
- -
-
- {{configService.labelConfig?.lbl?.dropChooseFile}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/ckeditor-tool/ckeditor-tool.component.scss b/projects/collection-editor-library/src/lib/components/ckeditor-tool/ckeditor-tool.component.scss
deleted file mode 100644
index fbf8f2d32..000000000
--- a/projects/collection-editor-library/src/lib/components/ckeditor-tool/ckeditor-tool.component.scss
+++ /dev/null
@@ -1,386 +0,0 @@
-.editorWrapper {
- border: 0px solid white;
-}
-
-.editorWrapper.hasError {
- border: 1px solid red;
- border-radius: 2px;
-}
-
-.characterCount {
- text-align: right;
- /* background-color: #f2f2f2;
- border: 1px solid #c4c4c4; */
- border-top: 0;
- padding-right: 7px;
- font-size: 11px;
- font-weight: bold;
- margin-top: -16px;
- position: relative
-}
-
-.custom-image img {
- border: 1px dotted;
- padding: 7px;
- margin: 6px;
- cursor: pointer;
-}
-
-.resource-image {
- height: 180px !important;
-}
-
-.asset_container {
- overflow-y: auto;
- overflow-x: hidden;
- min-height: 300px !important;
- max-height: 300px !important;
- padding: 5px;
-}
-
-.insert-image-btn {
- position: absolute;
- z-index: 1;
- left: 653px;
- background-color: transparent;
- padding: 12px 14px !important;
- margin-left: 6px;
-}
-
-.insert-image-btn>.icon {
- opacity: 1;
-}
-
-.insert-image-btn:active {
- background-color: transparent;
-}
-
-.upload-file-section {
- display: flex;
- height: 240px;
- width: 100%;
- max-width: 800px;
- align-items: center;
- justify-content: center;
- flex-direction: column;
- margin: 0 auto;
- background-color: #F5F9FC;
- border: 1px dashed #80a7ce;
-}
-
-.upload-file-description p {
- color: #999999;
-}
-
-.upload-file-description ul {
- margin: 0;
- list-style: disc;
-}
-
-.upload-file-description ul li {
- margin-bottom: 8px;
-}
-
-.upload-file-description ul li a {
- cursor: pointer;
- font-size: 12px;
-}
-
-
-/* Grid Layout CSS for uploaded image & video section */
-.sb-grid-layout {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
- grid-gap: 16px;
-}
-
-.sb-grid-layout.image {
- grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
-}
-
-.sb-grid-layout.video {
- grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
-}
-
-.sb-grid-layout .sb-video-content .sb-image-section {
- height: 96px;
- overflow: hidden;
- border-radius: 4px;
- box-shadow: inset 0 1px 3px 0 rgba(0, 0, 0, 0.5);
-}
-
-.sb-image-section {
- .selected-video {
- display: none;
- }
-
- &.active {
- .selected-video {
- position: absolute;
- right: 4px;
- top: 4px;
- color: #07bc81;
- font-size: 20px;
- display: block;
- }
- }
-}
-.sb-grid-layout .sb-video-content .sb-image-section img {
- width: 100%;
- height: 100%;
- cursor: pointer;
-}
-
-.overlay-image {
- width: 100%;
- height: 100%;
- background: rgba(0, 0, 0, 0.3);
- position: absolute;
- left: 0;
- right: 0;
- cursor: pointer;
-}
-
-.overlay-image .play.icon {
- position: absolute;
- transform: translate(-50%, -50%);
- top: 50%;
- left: 50%;
- color: rgba(255, 255, 255, .6);
- font-size: 32px;
- cursor: pointer;
-}
-
-
-
-::ng-deep {
-
- .ck-rounded-corners .ck.ck-editor__top .ck-sticky-panel .ck-toolbar, .ck.ck-editor__top .ck-sticky-panel .ck-toolbar.ck-rounded-corners {
- border-left: none;
- border-right: none;
- border-bottom: 1px solid #c4c4c4;
- border-radius: 0;
- }
-
- .ck-rounded-corners .ck.ck-editor__main>.ck-editor__editable, .ck.ck-editor__main>.ck-editor__editable.ck-rounded-corners {
- border: none;
- }
-
- .ck-dropdown.ck-font-size-dropdown .ck-dropdown__panel {
- height: 150px;
- overflow-y: scroll;
- }
-
- figure.image.ck-widget {
- width: auto;
- height: auto;
- overflow: visible;
- }
-
- figure.image img {
- width: 100%;
- }
-
- figure.image.resize-25 {
- width: 25%;
- height: auto;
- }
- figure.image.resize-50 {
- width: 50%;
- height: auto;
- }
- figure.image.resize-75 {
- width: 75%;
- height: auto;
- }
- figure.image.resize-100 {
- width: 100%;
- height: auto;
- }
- figure.table{
- margin : 2.2rem 0 1.5rem 1rem!important;
- }
- .text-center { text-align: center }
- .text-left { text-align: left }
- .text-right { text-align: right }
-
- .fs-8 { font-size: 0.5rem; }
- .fs-10 { font-size: 0.625rem; }
- .fs-12 { font-size: 0.75rem; }
- .fs-14 { font-size: 0.875rem; }
- .fs-16 { font-size: 1rem; }
- .fs-18 { font-size: 1.125rem; }
- .fs-20 { font-size: 1.25rem; }
- .fs-22 { font-size: 1.375rem; }
- .fs-24 { font-size: 1.5rem; }
- .fs-26 { font-size: 1.625rem; }
- .fs-28 { font-size: 1.75rem; }
- .fs-30 { font-size: 1.875rem; }
- .fs-36 { font-size: 2.25rem; }
-}
-
-.upload-image-modal-section {
- border-radius: 4px;
- width: 100%;
- min-height: 130px;
- background: #F5F9FC;
- border: 1px dashed #024f9d;
-}
-
-.upload-input-button {
- input[type="file"] {
- position: absolute;
- right: 0px;
- top: 0px;
- font-size: 118px;
- margin: 0px;
- padding: 0px;
- cursor: pointer;
- opacity: 0;
- height: 100%;
-}
-}
-
-.upload-file-section {
- display: flex;
- height: 240px;
- width: 100%;
- max-width: 800px;
- align-items: center;
- justify-content: center;
- flex-direction: column;
- margin: 0 auto;
- background-color: #F5F9FC;
- border: 1px dashed #80a7ce;
-}
-
-.qq-uploader.qq-uploader-selector.custom-qq-uploader {
- background: inherit;
- border-color: none;
- border: none;
- max-height: inherit;
- min-height: inherit;
- overflow-y: inherit;
- width: 688px;
- height: 240px;
- display: flex;
- justify-content: center;
- align-items: center;
-}
-
-.terms-and-condition {
- line-height: 14px;
-}
-
-.sb-info-bx{
- padding: 0.4rem !important;
- li{
- margin: 0 !important;
- padding: 0 !important;
- &::before{
- content: "" !important;
- }
- }
-}
-
-.red{
- color: red;
-}
-.b-bl{
- border-left: solid 1px #e4e1e1;
-}
-.sb-form-fields{
- .sb-field-group{
- margin: 1rem 0;
- }
- .sb-field{
- position: relative;
- margin-bottom: 0.5rem;
- .sb-form-control{
- border: 1px solid rgba(34,36,38,.15);
- width: 100%;
- border-radius: .28571429rem;
- box-shadow: 0 0 0 0 transparent inset;
- padding: .25rem .5rem!important;
- }
- }
-}
-@keyframes spinner-border {
- to {
- transform: rotate(360deg);
- }
-}
-.sb-loading-spinner {
- width: 1rem;
- height: 1rem;
- margin-right: 8px;
- border-width: 0.2em;
- display: inline-block;
- vertical-align: text-bottom;
- border: 0.15em solid currentColor;
- border-right-color: transparent;
- border-radius: 50%;
- -webkit-animation: spinner-border 0.75s linear infinite;
- animation: spinner-border 0.75s linear infinite;
-}
-.sb-btn-loading:before {
- position: absolute;
- content: "";
- top: 50%;
- left: 50%;
- margin: -0.64285714em 0 0 -0.64285714em;
- width: 1.28571429em;
- height: 1.28571429em;
- border-radius: 500rem;
- border: 0.2em solid rgba(0, 0, 0, 0.15);
-}
-.sb-btn-loading:after {
- position: absolute;
- content: "";
- top: 50%;
- left: 50%;
- margin: -0.64285714em 0 0 -0.64285714em;
- width: 1.28571429em;
- height: 1.28571429em;
- -webkit-animation: button-spin 0.6s linear;
- animation: button-spin 0.6s linear;
- -webkit-animation-iteration-count: infinite;
- animation-iteration-count: infinite;
- border-radius: 500rem;
- border-color: #fff transparent transparent;
- border-style: solid;
- border-width: 0.2em;
- -webkit-box-shadow: 0 0 0 1px transparent;
- box-shadow: 0 0 0 1px transparent;
-}
-.sb-btn-outline-disabled {
- background-color: #ffffff;
- border: 1px solid #cccccc;
- color: #999999;
- cursor: default;
- font-weight: 400;
-}
-.sb-color-grey{color:#666;}
-
-.flex-jc-space-end {
- justify-content: flex-end !important;
-}
-.fs-0785{
- font-size: 0.785rem !important;
-}
-.ui.info.message{
- color: #276f86 !important;
-}
-.sb-textbox[disabled="true"]{
- opacity: 0.3 !important;
- font-weight: 500 !important;
-}
-.sb-tabset-segment {
- min-height: 288px;
- max-height: 288px;
- overflow-y: auto;
-}
-
-input:focus-visible{
- border: none !important;
-}
diff --git a/projects/collection-editor-library/src/lib/components/ckeditor-tool/ckeditor-tool.component.ts b/projects/collection-editor-library/src/lib/components/ckeditor-tool/ckeditor-tool.component.ts
deleted file mode 100644
index 12a84f6df..000000000
--- a/projects/collection-editor-library/src/lib/components/ckeditor-tool/ckeditor-tool.component.ts
+++ /dev/null
@@ -1,943 +0,0 @@
-import { Component, OnInit, AfterViewInit, Output, Input, EventEmitter, OnChanges, ViewChild, ElementRef } from '@angular/core';
-import ClassicEditor from '@project-sunbird/ckeditor-build-classic';
-import * as _ from 'lodash-es';
-import { catchError, map } from 'rxjs/operators';
-import { throwError, Observable } from 'rxjs';
-import { QuestionService } from '../../services/question/question.service';
-import { EditorService } from '../../services/editor/editor.service';
-import { ToasterService } from '../../services/toaster/toaster.service';
-import { ConfigService } from '../../services/config/config.service';
-import { config } from '../asset-browser/asset-browser.data';
-declare const SunbirdFileUploadLib: any;
-@Component({
- selector: 'lib-ckeditor-tool',
- templateUrl: './ckeditor-tool.component.html',
- styleUrls: ['./ckeditor-tool.component.scss']
-})
-export class CkeditorToolComponent implements OnInit, AfterViewInit, OnChanges {
- @ViewChild('editor') public editorRef: ElementRef;
- @Input() editorDataInput: any;
- @Output() editorDataOutput = new EventEmitter();
- @Output() hasError = new EventEmitter();
- @Output() videoDataOutput = new EventEmitter();
- @Input() videoShow;
- @Input() setCharacterLimit: number;
- @Input() setImageLimit: any;
- public editorConfig: any;
- public imageUploadLoader = false;
- public editorInstance: any;
- public isEditorFocused: boolean;
- public limitExceeded: boolean;
- public charactersLeft: number;
- public isAssetBrowserReadOnly = false;
- public characterCount;
- public mediaobj;
- initialized = false;
- public assetProxyUrl: any;
- public lastImgResizeWidth;
- constructor(private questionService: QuestionService, private editorService: EditorService,
- private toasterService: ToasterService, public configService: ConfigService) { }
- assetConfig: any = {};
- myAssets = [];
- allImages = [];
- allVideos = [];
- selectedVideo = {};
- loading = false;
- isClosable = true;
- selectedVideoId: string;
- showAddButton: boolean;
- showImagePicker: boolean;
- showVideoPicker = false;
- showImageUploadModal: boolean;
- showVideoUploadModal: boolean;
- acceptVideoType: any;
- acceptImageType: any;
- showErrorMsg: boolean;
- errorMsg: string;
- query: string;
- public assetsCount: any;
- public searchMyInput = '';
- public searchAllInput: any;
- public formData: any;
- public assestData = {};
- public formConfig: any;
- public initialFormConfig: any;
- public imageFormValid = false;
- public videoFile: any;
- public imageFile: any;
- public termsAndCondition: any;
- public assetName: any;
- public emptyImageSearchMessage: any;
- public emptyVideoSearchMessage: any;
- ngOnInit() {
- this.assetProxyUrl = _.get(this.configService.urlConFig, 'URLS.assetProxyUrl');
- this.initialFormConfig = _.get(config, 'uploadIconFormConfig');
- this.formConfig = _.get(config, 'uploadIconFormConfig');
- this.emptyImageSearchMessage = _.get(this.configService.labelConfig, 'messages.error.016');
- this.emptyVideoSearchMessage = _.get(this.configService.labelConfig, 'messages.error.017');
- this.termsAndCondition = _.get(this.configService.labelConfig, 'termsAndConditions.001');
- this.assetConfig = this.editorService.editorConfig.config.assetConfig;
- this.initialized = true;
- this.editorConfig = {
- toolbar: ['heading', '|', 'bold', '|', 'italic', '|', 'underline', '|', 'BulletedList', '|', 'alignment',
- '|', 'insertTable', '|', 'numberedList', '|', 'fontSize', '|', 'subscript', '|', 'superscript', '|',
- 'MathText', '|', 'specialCharacters', '|'
- ],
- fontSize: {
- options: [
- 'eight',
- 'ten',
- 'twelve',
- 'fourteen',
- 'sixteen',
- 'eighteen',
- 'twenty',
- 'twentytwo',
- 'twentyfour',
- 'twentysix',
- 'twentyeight',
- 'thirty',
- 'thirtysix'
- ]
- },
- image: {
- resizeUnit: '%',
- resizeOptions: [{
- name: 'resizeImage:25',
- value: '25',
- icon: 'small',
- className: 'resize-25'
- },
- {
- name: 'resizeImage:50',
- value: '50',
- icon: 'medium',
- className: 'resize-50'
- },
- {
- name: 'resizeImage:75',
- value: '75',
- icon: 'large',
- className: 'resize-75'
- },
- {
- name: 'resizeImage:100',
- value: '100',
- icon: 'full',
- className: 'resize-100'
- },
- {
- name: 'resizeImage:original',
- value: null,
- icon: 'original',
- className: 'resize-original'
- }],
- toolbar: ['imageStyle:alignLeft', 'imageStyle:alignCenter', 'imageStyle:alignRight', '|',
- 'resizeImage:25', 'resizeImage:50', 'resizeImage:75', 'resizeImage:100', 'resizeImage:original'],
- styles: ['full', 'alignLeft', 'alignRight', 'alignCenter']
- },
- isReadOnly: false,
- removePlugins: ['ImageCaption', 'mathtype', 'ChemType', 'ImageResizeHandles']
- };
-
- this.acceptVideoType = this.getAcceptType(this.assetConfig.video.accepted, 'video');
- this.acceptImageType = this.getAcceptType(this.assetConfig.image.accepted, 'image');
- }
- ngOnChanges() {
- if (this.videoShow) {
- this.showVideoPicker = true;
- this.selectVideo(undefined);
- }
- }
-
- ngAfterViewInit() {
- this.initializeEditors();
- }
-
-
- initializeImagePicker(editorType) {
- this.showImagePicker = true;
- }
-
- initializeVideoPicker(editorType) {
- this.showVideoPicker = true;
- }
- /**
- * function to hide image picker
- */
- dismissImagePicker() {
- this.showImagePicker = false;
- }
-
- /**
- * function to hide video picker
- */
- dismissVideoPicker() {
- this.showVideoPicker = false;
- this.videoShow = false;
- this.videoDataOutput.emit(false);
- }
- dismissImageUploadModal() {
- if (this.isClosable) {
- this.showImageUploadModal = false;
- }
- }
- initiateImageUploadModal() {
- this.showImagePicker = false;
- this.showImageUploadModal = true;
- this.loading = false;
- this.isClosable = true;
- }
-
- dismissVideoUploadModal() {
- if (this.isClosable) {
- this.showVideoUploadModal = false;
- }
- }
- initiateVideoUploadModal() {
- this.showVideoPicker = false;
- this.showImageUploadModal = true;
- this.loading = false;
- this.isClosable = true;
- }
- public isEditorReadOnly(state) {
- this.editorInstance.isReadOnly = state;
- this.isAssetBrowserReadOnly = state;
- }
- getAcceptType(typeList, type) {
- const acceptTypeList = typeList.split(', ');
- const result = [];
- _.forEach(acceptTypeList, (content) => {
- result.push(`${type}/${content}`);
- });
- return result.toString();
- }
-
- customImageResizer(editor) {
- // Both the data and the editing pipelines are affected by this conversion.
- editor.conversion.for('downcast').add(dispatcher => {
- // Links are represented in the model as a "linkHref" attribute.
- // Use the "low" listener priority to apply the changes after the link feature.
- dispatcher.on('attribute:width:image', (evt, data, conversionApi) => {
- if (!conversionApi.consumable.consume(data.item, evt.name)) {
- return;
- }
- const options = editor.config.get('image.resizeOptions');
- const isEnabled = editor.config.get('image.resizeEnabled');
- const sizeLables = options.map((item) => {
- return item.label;
- });
- const newImgWidthValue = data.attributeNewValue === null ? 'Original' : data.attributeNewValue;
- if (sizeLables.includes(newImgWidthValue)) {
- this.lastImgResizeWidth = newImgWidthValue;
- }
-
- if (!isEnabled && sizeLables.length > 0 && !sizeLables.includes(newImgWidthValue)) {
- editor.execute('imageResize', { width: this.lastImgResizeWidth });
- return evt.stop();
- }
-
- const viewWriter = conversionApi.writer;
- const figure = conversionApi.mapper.toViewElement(data.item);
-
- if (data.attributeNewValue !== null) {
- viewWriter.setStyle('width', data.attributeNewValue, figure);
- viewWriter.addClass('image_resized', figure);
- } else {
- viewWriter.removeStyle('width', figure);
- viewWriter.removeClass('image_resized', figure);
- }
- });
- });
- }
-
- initializeEditors() {
- ClassicEditor.create(this.editorRef.nativeElement, {
- alignment: {
- options: [
- { name: 'left', className: 'text-left' },
- { name: 'center', className: 'text-center' },
- { name: 'right', className: 'text-right' }
- ]
- },
- heading: {
- options: [
- { model: 'paragraph', title: 'Paragraph' },
- { model: 'heading1', view: 'h1', title: 'Heading 1' },
- { model: 'heading2', view: 'h2', title: 'Heading 2' },
- { model: 'heading3', view: 'h3', title: 'Heading 3' },
- { model: 'heading4', view: 'h4', title: 'Heading 4' },
- { model: 'heading5', view: 'h5', title: 'Heading 5' },
- { model: 'heading6', view: 'h6', title: 'Heading 6' }
- ]
- },
- extraPlugins: ['Table', 'Heading'],
- toolbar: this.editorConfig.toolbar,
- fontSize: this.editorConfig.fontSize,
- image: this.editorConfig.image,
- isReadOnly: this.editorConfig.isReadOnly,
- removePlugins: this.editorConfig.removePlugins
- })
- .then(editor => {
- this.editorInstance = editor;
- this.isAssetBrowserReadOnly = this.editorConfig.isReadOnly;
- if (this.editorDataInput) {
- this.editorDataInput = this.editorDataInput
- .replace(/(
])*)>/gi, '$1/>')
- .replace(/(
])*)>/gi, '$1/>');
- this.editorInstance.setData(this.editorDataInput);
- } else {
- this.editorInstance.setData('');
- }
- console.log('Editor was initialized');
- this.changeTracker(this.editorInstance);
- this.attachEvent(this.editorInstance);
- // this.pasteTracker(this.editorInstance);
- this.characterCount = this.countCharacters(this.editorInstance.model.document);
- this.charactersLeft = this.getCharactersLeft();
- })
- .catch(error => {
- console.error(error.stack);
- });
- }
- changeTracker(editor) {
- editor.model.document.on('change', (eventInfo, batch) => {
- if (this.setCharacterLimit && this.setCharacterLimit > 0) {
- this.checkCharacterLimit();
- }
- const selectedElement = eventInfo.source.selection.getSelectedElement();
- this.isEditorFocused = (selectedElement && selectedElement.name === 'image') ? true : false;
- if (this.setImageLimit && this.setImageLimit > 0) {
- this.checkImageLimit();
- }
- this.editorDataOutput.emit({
- body: editor.getData(),
- length: this.characterCount,
- mediaobj: this.mediaobj
- });
- });
- }
- pasteTracker(editor) {
- editor.editing.view.document.on('clipboardInput', (evt, data) => {
- const dataTransfer = data.dataTransfer;
- const urlMatch =
- // tslint:disable-next-line:max-line-length
- /(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,}|file:\/\/\/+[^\s]{0,})/gi;
- const regex = new RegExp(urlMatch);
- const getUrl = dataTransfer.getData('text/html').match(regex);
- if (getUrl && getUrl.length > 0) {
- this.toasterService.error(_.get(this.configService, 'labelConfig.messages.error.010'));
- evt.stop();
- }
- });
- }
- checkImageLimit() {
- const childNodes = this.editorInstance.model.document.getRoot()._children._nodes;
- this.isAssetBrowserReadOnly = _.keys(_.pickBy(childNodes, { name: 'image' })).length === this.setImageLimit ? true : false;
- }
- checkCharacterLimit() {
- this.characterCount = this.countCharacters(this.editorInstance.model.document);
- this.charactersLeft = this.getCharactersLeft();
- this.limitExceeded = (this.characterCount <= this.setCharacterLimit) ? false : true;
- this.hasError.emit(this.limitExceeded);
- }
- /**
- * function to get images
- * @param offset page no
- */
- getMyImages(offset, query?, search?) {
- this.assetsCount = 0;
- if (!search) {
- this.searchMyInput = '';
- }
- if (offset === 0) {
- this.myAssets.length = 0;
- }
- const req = {
- filters: {
- mediaType: ['image'],
- createdBy: _.get(this.editorService.editorConfig, 'context.user.id')
- },
- offset
- };
- if (query) {
- req['query'] = query;
- }
- this.questionService.getAssetMedia(req).pipe(catchError(err => {
- const errInfo = { errorMsg: _.get(this.configService.labelConfig, 'messages.error.022') };
- return throwError(this.editorService.apiErrorHandling(err, errInfo));
- })).subscribe((res) => {
- this.assetsCount = res.result.count;
- _.map(res.result.content, (item) => {
- if (item.downloadUrl) {
- this.myAssets.push(item);
- }
- });
- });
- }
-
- addImageInEditor(imageUrl, imageId, imageName) {
- const src = this.getMediaOriginURL(imageUrl);
- const baseUrl = _.get(this.editorService.editorConfig, 'context.host') || document.location.origin;
- this.mediaobj = {
- id: imageId,
- type: 'image',
- src,
- baseUrl
- };
- this.editorInstance.model.change(writer => {
- const imageElement = writer.createElement('image', {
- src,
- alt: imageName,
- 'data-asset-variable': imageId
- });
- this.editorInstance.model.insertContent(imageElement, this.editorInstance.model.document.selection);
- });
- this.showImagePicker = false;
- this.showImageUploadModal = false;
- }
-
- addVideoInEditor(videoModal?) {
- const videoData: any = _.cloneDeep(this.selectedVideo);
- videoData.src = this.getMediaOriginURL(videoData.downloadUrl);
- videoData.thumbnail = (videoData.thumbnail) && this.getMediaOriginURL(videoData.thumbnail);
- this.showVideoPicker = false;
- this.videoDataOutput.emit(videoData);
- if (videoModal) {
- videoModal.deny();
- }
- }
-
-
- getAllImages(offset, query?, search?) {
- this.assetsCount = 0;
- if (!search) {
- this.searchAllInput = '';
- }
- if (offset === 0) {
- this.allImages.length = 0;
- }
- const req = {
- filters: {
- mediaType: ['image']
- },
- offset
- };
- if (query) {
- req['query'] = query;
- }
- this.questionService.getAssetMedia(req).pipe(catchError(err => {
- const errInfo = { errorMsg: _.get(this.configService.labelConfig, 'messages.error.022') };
- return throwError(this.editorService.apiErrorHandling(err, errInfo));
- }))
- .subscribe((res) => {
- this.assetsCount = res.result.count;
- _.map(res.result.content, (item) => {
- if (item.downloadUrl) {
- this.allImages.push(item);
- }
- });
- });
- }
-
- /**
- * function to get videos
- * @param offset page no
- */
- getMyVideos(offset, query?, search?) {
- this.assetsCount = 0;
- if (!search) {
- this.searchMyInput = '';
- this.selectVideo(undefined);
- }
- if (offset === 0) {
- this.myAssets.length = 0;
- }
- const req: any = {
- filters: {
- mediaType: ['video'],
- createdBy: _.get(this.editorService.editorConfig, 'context.user.id')
- },
- offset
- };
-
- if (query) {
- req.query = query;
- }
-
- this.questionService.getAssetMedia(req).pipe(catchError(err => {
- const errInfo = { errorMsg: _.get(this.configService.labelConfig, 'messages.error.023')};
- return throwError(this.editorService.apiErrorHandling(err, errInfo));
- })).subscribe((res) => {
- this.assetsCount = res.result.count;
- _.map(res.result.content, (item) => {
- if (item.downloadUrl) {
- this.myAssets.push(item);
- }
- });
- });
- }
-
- getAllVideos(offset, query?, search?) {
- this.assetsCount = 0;
- if (!search) {
- this.searchAllInput = '';
- this.selectVideo(undefined);
- }
- if (offset === 0) {
- this.allVideos.length = 0;
- }
- const req: any = {
- filters: {
- mediaType: ['video'],
- },
- offset
- };
- if (query) {
- req.query = query;
- }
-
- this.questionService.getAssetMedia(req).pipe(catchError(err => {
- const errInfo = { errorMsg: _.get(this.configService.labelConfig, 'messages.error.023') };
- return throwError(this.editorService.apiErrorHandling(err, errInfo));
- })).subscribe((res) => {
- this.assetsCount = res.result.count;
- _.map(res.result.content, (item) => {
- if (item.downloadUrl) {
- this.allVideos.push(item);
- }
- });
- });
- }
-
- /**
- * function to lazy load my images
- */
- lazyloadMyImages() {
- const offset = this.myAssets.length;
- this.getMyImages(offset, this.query, true);
- }
-
- /**
- * function to lazy load all images
- */
- lazyloadAllImages() {
- const offset = this.allImages.length;
- this.getAllImages(offset, this.query, true);
- }
-
-
- lazyloadMyVideos() {
- const offset = this.myAssets.length;
- this.getMyVideos(offset, this.query, true);
- }
-
- /**
- * function to lazy load all videos
- */
- lazyloadAllVideos() {
- const offset = this.allVideos.length;
- this.getAllVideos(offset, this.query, true);
- }
-
- /**
- * function to upload image
- */
- uploadImage(event) {
- this.imageFile = event.target.files[0];
- const file = event.target.files[0];
- this.assetName = file.name;
- const reader = new FileReader();
- this.formData = new FormData();
- this.formData.append('file', file);
- const fileType = file.type;
- const fileName = file.name.split('.').slice(0, -1).join('.');
- const fileSize = file.size / 1024 / 1024;
- if (fileType.split('/')[0] === 'image') {
- this.showErrorMsg = false;
- if (fileSize > this.assetConfig.image.size) {
- this.showErrorMsg = true;
- this.errorMsg = _.get(this.configService.labelConfig, 'messages.error.021')
- + this.assetConfig.image.size + this.assetConfig.image.sizeType;
- this.resetFormConfig();
- } else {
- this.errorMsg = '';
- this.showErrorMsg = false;
- reader.readAsDataURL(file);
- }
- } else {
- this.showErrorMsg = true;
- this.errorMsg = _.get(this.configService.labelConfig, 'messages.error.020');
- }
- if (!this.showErrorMsg) {
- this.imageUploadLoader = true;
- this.imageFormValid = true;
- this.assestData = this.generateAssetCreateRequest(fileName, fileType, 'image');
- this.populateFormData(this.assestData);
- }
- }
- resetFormConfig() {
- this.imageUploadLoader = false;
- this.imageFormValid = false;
- this.formConfig = this.initialFormConfig;
- }
- populateFormData(formData) {
- const formvalue = _.cloneDeep(this.formConfig);
- this.formConfig = null;
- _.forEach(formvalue, (formFieldCategory) => {
- formFieldCategory.default = formData[formFieldCategory.code];
- formFieldCategory.editable = true;
- });
- this.formConfig = formvalue;
- }
- uploadAndUseImage(modal) {
- this.isClosable = false;
- this.loading = true;
- this.showErrorMsg = false;
- this.imageFormValid = false;
- this.questionService.createMediaAsset({ asset: this.assestData }).pipe(catchError(err => {
- const errInfo = { errorMsg: _.get(this.configService.labelConfig, 'messages.error.019') };
- this.loading = false;
- this.isClosable = true;
- this.imageFormValid = true;
- return throwError(this.editorService.apiErrorHandling(err, errInfo));
- })).subscribe((res) => {
- const imgId = res.result.node_id;
- const preSignedRequest = {
- content: {
- fileName: this.assetName
- }
- };
- this.questionService.generatePreSignedUrl(preSignedRequest, imgId).pipe(catchError(err => {
- const errInfo = { errorMsg: _.get(this.configService.labelConfig, 'messages.error.026') };
- this.loading = false;
- this.isClosable = true;
- this.imageFormValid = true;
- return throwError(this.editorService.apiErrorHandling(err, errInfo));
- })).subscribe((response) => {
- const signedURL = response.result.pre_signed_url;
- let blobConfig = {
- processData: false,
- contentType: 'Asset'
- };
- blobConfig = this.editorService.appendCloudStorageHeaders(blobConfig);
- this.uploadToBlob(signedURL, this.imageFile, blobConfig).subscribe(() => {
- const fileURL = signedURL.split('?')[0];
- const data = new FormData();
- data.append('fileUrl', fileURL);
- data.append('mimeType', this.imageFile.type);
- const config1 = {
- enctype: 'multipart/form-data',
- processData: false,
- contentType: false,
- cache: false
- };
- const uploadMediaConfig = {
- data,
- param: config1
- };
- this.questionService.uploadMedia(uploadMediaConfig, imgId).pipe(catchError(err => {
- const errInfo = { errorMsg: _.get(this.configService.labelConfig, 'messages.error.019') };
- this.isClosable = true;
- this.loading = false;
- this.imageFormValid = true;
- return throwError(this.editorService.apiErrorHandling(err, errInfo));
- })).subscribe((response1) => {
- this.addImageInEditor(response1.result.content_url, response1.result.node_id, this.assestData['name']);
- });
- });
- });
-
- });
- }
- openImageUploadModal() {
- this.showImageUploadModal = true;
- this.resetFormData();
- }
- dismissPops(modal) {
- this.dismissImagePicker();
- modal.deny();
- }
- onStatusChanges(event) {
- if (event.isValid && this.imageUploadLoader) {
- this.imageFormValid = true;
- } else {
- this.imageFormValid = false;
- }
- }
- valueChanges(event) {
- this.assestData = _.merge({}, this.assestData, event);
- }
- // search feature for images
- searchImages(event, type) {
- if (event === 'clearInput' && type === 'myImages') {
- this.query = '';
- this.searchMyInput = '';
- } else if (event === 'clearInput' && type === 'allImages') {
- this.query = '';
- this.searchAllInput = '';
- } else {
- this.query = event.target.value;
- }
- if (type === 'myImages') {
- this.getMyImages(0, this.query, true);
- } else {
- this.getAllImages(0, this.query, true);
- }
- }
- // general method
- resetFormData() {
- this.showErrorMsg = false;
- this.formData = null;
- this.formConfig = this.initialFormConfig;
- this.imageUploadLoader = false;
- this.imageFormValid = false;
- this.loading = false;
- this.isClosable = true;
- }
- /**
- * function to upload video
- */
- openVideoUploadModal() {
- this.showVideoUploadModal = true;
- this.resetFormData();
- }
- dismissVideoPops(modal) {
- if (this.isClosable) {
- this.dismissVideoPicker();
- modal.deny();
- }
- }
- uploadVideoFromLocal(event) {
- this.videoFile = event.target.files[0];
- const reader = new FileReader();
- this.formData = new FormData();
- this.formData.append('file', this.videoFile);
- const fileType = this.videoFile.type;
- const fileName = this.videoFile.name.split('.').slice(0, -1).join('.');
- const fileSize = this.videoFile.size / 1024 / 1024;
- if (_.includes(fileType.split('/'), 'video')) {
- this.showErrorMsg = false;
- if (fileSize > this.assetConfig.video.size) {
- this.showErrorMsg = true;
- this.errorMsg = _.get(this.configService.labelConfig, 'messages.error.021') +
- this.assetConfig.video.size + this.assetConfig.video.sizeType;
- this.resetFormConfig();
- } else {
- this.errorMsg = '';
- this.showErrorMsg = false;
- reader.readAsDataURL(this.videoFile);
- }
- } else {
- this.showErrorMsg = true;
- this.errorMsg = _.get(this.configService.labelConfig, 'messages.error.024');
- }
- if (!this.showErrorMsg) {
- this.imageUploadLoader = true;
- this.imageFormValid = true;
- this.assestData = this.generateAssetCreateRequest(fileName, fileType, 'video');
- this.populateFormData(this.assestData);
- }
- }
- uploadVideo(videoModal) {
- this.isClosable = false;
- this.loading = true;
- this.showErrorMsg = false;
- this.imageFormValid = false;
- if (!this.showErrorMsg) {
- this.questionService.createMediaAsset({ asset: this.assestData }).pipe(catchError(err => {
- this.loading = false;
- this.isClosable = true;
- this.imageFormValid = true;
- const errInfo = { errorMsg: _.get(this.configService.labelConfig, 'messages.error.025') };
- return throwError(this.editorService.apiErrorHandling(err, errInfo));
- })).subscribe((res) => {
- const contentId = res.result.node_id;
- const request = {
- content: {
- fileName: this.videoFile.name
- }
- };
- this.questionService.generatePreSignedUrl(request, contentId).pipe(catchError(err => {
- const errInfo = { errorMsg: _.get(this.configService.labelConfig, 'messages.error.026') };
- this.loading = false;
- this.isClosable = true;
- this.imageFormValid = true;
- return throwError(this.editorService.apiErrorHandling(err, errInfo));
- })).subscribe((response) => {
- const signedURL = response.result.pre_signed_url;
- let blobConfig = {
- processData: false,
- contentType: 'Asset'
- };
- blobConfig = this.editorService.appendCloudStorageHeaders(blobConfig);
- this.uploadToBlob(signedURL, this.videoFile, blobConfig).subscribe(() => {
- const fileURL = signedURL.split('?')[0];
- this.updateContentWithURL(fileURL, this.videoFile.type, contentId, videoModal);
- });
- });
- });
- }
- }
-
- generateAssetCreateRequest(fileName, fileType, mediaType) {
- return {
- name: fileName,
- mediaType,
- mimeType: fileType,
- createdBy: _.get(this.editorService.editorConfig, 'context.user.id'),
- creator: _.get(this.editorService.editorConfig, 'context.user.fullName'),
- channel: _.get(this.editorService.editorConfig, 'context.channel')
- };
- }
-
- uploadToBlob(signedURL, file, config): Observable {
- const csp = _.get(this.editorService.editorConfig, 'context.cloudStorage.provider', 'azure');
- return new Observable((observer) => {
- const uploaderLib = new SunbirdFileUploadLib.FileUploader();
- uploaderLib.upload({ url: signedURL, file, csp })
- .on("error", (error) => {
- const errInfo = { errorMsg: _.get(this.configService.labelConfig, 'messages.error.018') };
- this.isClosable = true;
- this.loading = false;
- this.imageFormValid = true;
- observer.error(this.editorService.apiErrorHandling(error, errInfo));
- }).on("completed", (completed) => {
- observer.next(completed);
- observer.complete();
- })
- });
- }
-
- updateContentWithURL(fileURL, mimeType, contentId, videoModal?) {
- const data = new FormData();
- data.append('fileUrl', fileURL);
- data.append('mimeType', mimeType);
- const config = {
- enctype: 'multipart/form-data',
- processData: false,
- contentType: false,
- cache: false
- };
- const option = {
- data,
- param: config
- };
- this.questionService.uploadMedia(option, contentId).pipe(catchError(err => {
- const errInfo = { errorMsg: _.get(this.configService.labelConfig, 'messages.error.027') };
- this.isClosable = true;
- this.loading = false;
- this.imageFormValid = true;
- return throwError(this.editorService.apiErrorHandling(err, errInfo));
- })).subscribe(res => {
- // Read upload video data
- this.getUploadVideo(res.result.node_id, videoModal);
- });
- }
-
- getUploadVideo(videoId, videoModal?) {
- this.questionService.getVideo(videoId).pipe(map((data: any) => data.result.content), catchError(err => {
- const errInfo = { errorMsg: _.get(this.configService, 'labelConfig.messages.error.011') };
- this.loading = false;
- this.isClosable = true;
- this.imageFormValid = true;
- return throwError(this.editorService.apiErrorHandling(err, errInfo));
- })).subscribe(res => {
- this.toasterService.success(_.get(this.configService, 'labelConfig.messages.success.006'));
- this.selectedVideo = res;
- this.showAddButton = true;
- this.loading = false;
- this.isClosable = true;
- this.imageFormValid = true;
- this.addVideoInEditor(videoModal);
- });
- }
-
- searchMyVideo(event) {
- this.query = event.target.value;
- this.getMyVideos(0, this.query);
- }
- searchAllVideo(event) {
- this.query = event.target.value;
- this.getAllVideos(0, this.query);
- }
- // searchVideo feature
- searchVideo(event, type) {
- if (event === 'clearInput' && type === 'myVideos') {
- this.query = '';
- this.searchMyInput = '';
- } else if (event === 'clearInput' && type === 'allVideos') {
- this.query = '';
- this.searchAllInput = '';
- } else {
- this.query = event.target.value;
- }
- if (type === 'myVideos') {
- this.getMyVideos(0, this.query, true);
- } else {
- this.getAllVideos(0, this.query, true);
- }
- }
- selectVideo(data) {
- if (data) {
- this.showAddButton = true;
- this.selectedVideoId = data.identifier;
- this.selectedVideo = data;
- } else {
- this.showAddButton = false;
- this.selectedVideoId = '';
- this.selectedVideo = {};
- }
-
- }
-
- countCharacters(document) {
- const rootElement = document.getRoot();
- return this.countCharactersInElement(rootElement);
- }
- countCharactersInElement(node) {
- let chars = 0;
- const forEach = Array.prototype.forEach;
- const forE = node.getChildren();
- let child;
-
- while (!(child = forE.next()).done) {
- if (child.value.is('text')) {
- chars += child.value.data.length;
- } else if (child.value.is('element')) {
- chars += this.countCharactersInElement(child.value);
- }
- }
- return chars;
- }
-
- getMediaOriginURL(src) {
- const replaceText = this.assetProxyUrl;
- const cloudStorageUrls = _.compact(_.get(this.editorService.editorConfig, 'context.cloudStorageUrls') || []);
- _.forEach(cloudStorageUrls, url => {
- if (src.indexOf(url) !== -1) {
- src = src.replace(url, replaceText);
- }
- });
- return src;
- }
- // Here Event listener is attached to document to listen the click event from Wiris plugin ('OK'-> button)
- attachEvent(editor) {
- document.addEventListener('click', e => {
- if (e.target && (e.target as Element).className === 'wrs_modal_button_accept') {
- editor.model.change(writer => {
- const insertPosition = editor.model.document.selection.getFirstPosition();
- writer.insertText(' ', insertPosition);
- });
- }
- });
- }
-
- getCharactersLeft() {
- if (this.setCharacterLimit) {
- let charRemaining = this.setCharacterLimit - this.characterCount;
- return charRemaining > 0 ? charRemaining : 0;
- }
- return null;
- }
-}
diff --git a/projects/collection-editor-library/src/lib/components/editor/editor.component.html b/projects/collection-editor-library/src/lib/components/editor/editor.component.html
index ffed017c0..ad46a6e7a 100755
--- a/projects/collection-editor-library/src/lib/components/editor/editor.component.html
+++ b/projects/collection-editor-library/src/lib/components/editor/editor.component.html
@@ -138,9 +138,6 @@
-
-
@@ -150,16 +147,6 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/projects/collection-editor-library/src/lib/components/header/header.component.html b/projects/collection-editor-library/src/lib/components/header/header.component.html
index 9975296f4..c462fa612 100755
--- a/projects/collection-editor-library/src/lib/components/header/header.component.html
+++ b/projects/collection-editor-library/src/lib/components/header/header.component.html
@@ -54,7 +54,6 @@
Progress
-
-
-
-
-
diff --git a/projects/collection-editor-library/src/lib/components/options/options.component.scss b/projects/collection-editor-library/src/lib/components/options/options.component.scss
deleted file mode 100644
index e8556c9b7..000000000
--- a/projects/collection-editor-library/src/lib/components/options/options.component.scss
+++ /dev/null
@@ -1,137 +0,0 @@
-.q-sb-layout-single{
- &:before{
- content: url("/assets/images/layoutoneicon.svg");
- }
- &.active,
- &:hover
- {
- border-color: var(--primary-400);
- background-color: #ffffff;
- color: var(--primary-400);
- &:before{
- content: url("/assets/images/layoutoneicon_blue.svg");
- }
- }
-}
-.q-sb-layout-two{
- &:before{
- content: url("/assets/images/layouttwoicon.svg");
- }
- &.active,
- &:hover
- {
- border-color: var(--primary-400);
- background-color: #ffffff;
- color: var(--primary-400);
- &:before{
- content: url("/assets/images/layouttwoicon_blue.svg");
- }
- }
-}
-.q-sb-layout-three{
- &:before{
- content: url("/assets/images/layoutthreeicon.svg");
- top: -2px;
- position: relative;
- }
- &.active,
- &:hover
- {
- border-color: var(--primary-400);
- background-color: #ffffff;
- color: var(--primary-400);
- &:before{
- content: url("/assets/images/layoutthreeicon_blue.svg");
- }
- }
-}
-.q-sb-layout-imgoption{
- &:before{
- content: url("/assets/images/imageicon.svg");
- }
- &.active,
- &:hover
- {
- &:before{
- content: url("/assets/images/imageicon_blue.svg");
- }
- }
-}
-.q-sb-layout-alignleft{
- &:before{
- content: url("/assets/images/leftalignicon.svg");
- }
- &.active,
- &:hover
- {
- &:before{
- content: url("/assets/images/leftalignicon_blue.svg");
- }
- }
-}
-.q-sb-layout-aligncenter{
- &:before{
- content: url("/assets/images/middlealignicon.svg");
- }
- &.active,
- &:hover
- {
- &:before{
- content: url("/assets/images/middlealignicon_blue.svg");
- }
- }
-}
-.q-sb-layout-alignright{
- &:before{
- content: url("/assets/images/rightalignicon.svg");
- }
- &.active,
- &:hover
- {
-
- &:before{
- content: url("/assets/images/rightalignicon_blue.svg");
- }
- }
-}
-
-.h-7 {
- height: 7px;
-}
-.w-20 {
- width: 20px;
-}
-.b-0 {
- border: 0 !important;
-}
-
-.sb-line-height-24 {
- line-height: 24px;
-}
-
-
-.bg-none {
- background-color: transparent !important;
-
- &:hover,
- &:focus {
- background-color: transparent !important;
- }
-}
-
-.sb-w-85 div[data-title]:hover::before{
- left: 0%;
- top: -122% !important;
- width: 256px;
-}
-.sb-field-group .sb-left-icon-btn.sb-btn-xs{
- padding: 0 !important;
- margin-top: -10px;
-}
-
-.optionLabel{
- font-size: 12px !important;
- margin-bottom: 0.5rem !important;
- color: #121213e0;
- font-weight: 600;
-}
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/options/options.component.spec.data.ts b/projects/collection-editor-library/src/lib/components/options/options.component.spec.data.ts
deleted file mode 100644
index 106c4a8d3..000000000
--- a/projects/collection-editor-library/src/lib/components/options/options.component.spec.data.ts
+++ /dev/null
@@ -1,128 +0,0 @@
-export const mockOptionData = {
- editorOptionData: {
- question:
- 'D.D.T. was invented by?
',
- options: [
- {
- body: 'Mosley
',
- },
- {
- body: 'Rudolf
',
- },
- {
- body: 'Karl Benz
',
- },
- {
- body: 'Dalton
',
- },
- ],
- templateId: 'mcq-split-grid',
- answer: '0',
- numberOfOptions: 4,
- },
- prepareMcqBody: {
- templateId: 'mcq-vertical',
- name: 'Multiple Choice Question',
- responseDeclaration: {
- response1: {
- maxScore: 1,
- cardinality: 'single',
- type: 'integer',
- correctResponse: {
- value: '0',
- outcomes: {
- SCORE: 1,
- },
- },
- },
- },
- interactionTypes: ['choice'],
- interactions: {
- response1: {
- type: 'choice',
- options: [
- {
- label: 'Mosley
',
- value: 0,
- },
- {
- label: 'Rudolf
',
- value: 1,
- },
- {
- label: 'Karl Benz
',
- value: 2,
- },
- {
- label: 'Dalton
',
- value: 3,
- },
- ],
- },
- },
- editorState: {
- options: [
- {
- answer: true,
- value: {
- body: 'Mosley
',
- value: 0,
- },
- },
- {
- answer: false,
- value: {
- body: 'Rudolf
',
- value: 1,
- },
- },
- {
- answer: false,
- value: {
- body: 'Karl Benz
',
- value: 2,
- },
- },
- {
- answer: false,
- value: {
- body: 'Dalton
',
- value: 3,
- },
- },
- ],
- },
- qType: 'MCQ',
- primaryCategory: 'Multiple Choice Question',
- },
- subMenus : [
- [{
- id: 'addHint',
- name: 'Add Hint',
- value: 'test',
- enabled: false,
- type: 'input',
- label: 'label',
- show:true
- }]
- ]
-};
-
-export const sourcingSettingsMock = {
- enforceCorrectAnswer: false,
- showSolution: false,
- showAddHints: true,
- showAddScore: false,
- showAddTips: true,
- showAddTranslation: true,
- showAddSecondaryQuestion: false,
-};
-
-
-export const nativeElement = ``;
-
-
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/options/options.component.spec.ts b/projects/collection-editor-library/src/lib/components/options/options.component.spec.ts
deleted file mode 100644
index 849b13caa..000000000
--- a/projects/collection-editor-library/src/lib/components/options/options.component.spec.ts
+++ /dev/null
@@ -1,161 +0,0 @@
-import { TelemetryInteractDirective } from '../../directives/telemetry-interact/telemetry-interact.directive';
-import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
-import { HttpClientTestingModule } from '@angular/common/http/testing';
-import { FormsModule } from '@angular/forms';
-import { OptionsComponent } from './options.component';
-import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
-import { mockOptionData, nativeElement, sourcingSettingsMock } from './options.component.spec.data';
-import { ConfigService } from '../../services/config/config.service';
-import { SuiModule } from 'ng2-semantic-ui-v9';
-import { TreeService } from '../../services/tree/tree.service';
-import { treeData } from './../fancy-tree/fancy-tree.component.spec.data';
-import { EditorTelemetryService } from '../../services/telemetry/telemetry.service';
-import { EditorService } from "../../services/editor/editor.service";
-
-const mockEditorService = {
- editorConfig: {
- config: {
- renderTaxonomy:true,
- hierarchy: {
- level1: {
- name: "Module",
- type: "Unit",
- mimeType: "application/vnd.ekstep.content-collection",
- contentType: "Course Unit",
- iconClass: "fa fa-folder-o",
- children: {},
- },
- },
- },
- },
- parentIdentifier: ""
-};
-
-
-describe('OptionsComponent', () => {
- let component: OptionsComponent;
- let fixture: ComponentFixture;
- let treeService,telemetryService;
- beforeEach(waitForAsync(() => {
- TestBed.configureTestingModule({
- imports: [ HttpClientTestingModule, FormsModule, SuiModule ],
- declarations: [ OptionsComponent, TelemetryInteractDirective ],
- providers: [ConfigService,TreeService,EditorTelemetryService,
- { provide: EditorService, useValue: mockEditorService },],
- schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(OptionsComponent);
- treeService = TestBed.inject(TreeService);
- telemetryService = TestBed.inject(EditorTelemetryService);
- component = fixture.componentInstance;
- component.sourcingSettings = sourcingSettingsMock;
- spyOn(treeService, 'setTreeElement').and.callFake((el) => {
- treeService.nativeElement = nativeElement;
- });
- spyOn(treeService, 'getFirstChild').and.callFake(() => {
- return { data: { metadata: treeData } };
- });
- component.editorState = mockOptionData.editorOptionData;
-
- // fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-
- it('#ngOnInit() should call editorDataHandler on ngOnInit', () => {
- component.editorState = mockOptionData.editorOptionData;
- spyOn(component, 'editorDataHandler');
- component.ngOnInit();
- expect(component.editorDataHandler).toHaveBeenCalled();
- });
-
- it('should not set #templateType when creating new question', () => {
- component.editorState = {};
- spyOn(component, 'editorDataHandler');
- component.ngOnInit();
- expect(component.templateType).toEqual('mcq-vertical');
- });
-
- it('should set #templateType when updating an existing question', () => {
- component.editorState = mockOptionData.editorOptionData;
- spyOn(component, 'editorDataHandler');
- component.ngOnInit();
- expect(component.templateType).toEqual('mcq-split-grid');
- });
-
- it('#editorDataHandler() should emit option data', () => {
- spyOn(component, 'prepareMcqBody').and.callThrough();
- spyOn(component.editorDataOutput, 'emit').and.callThrough();
- component.editorState = mockOptionData.editorOptionData;
- component.editorDataHandler();
- component.questionPrimaryCategory='Multiselect Multiple Choice Question';
- expect(component.prepareMcqBody).toHaveBeenCalledWith(mockOptionData.editorOptionData);
- expect(component.editorDataOutput.emit).toHaveBeenCalled();
- });
-
- it('#prepareMcqBody() should return expected mcq option data', () => {
- spyOn(component, 'getResponseDeclaration').and.callThrough();
- spyOn(component, 'getInteractions').and.callThrough();
- const result = component.prepareMcqBody(mockOptionData.editorOptionData);
- // expect(mockOptionData.prepareMcqBody).toEqual(result);
- expect(component.getResponseDeclaration).toHaveBeenCalledWith(mockOptionData.editorOptionData);
- expect(component.getInteractions).toHaveBeenCalledWith(mockOptionData.editorOptionData.options);
- });
-
- it('#getResponseDeclaration() should return expected response declaration', () => {
- spyOn(component,"getResponseDeclaration").and.callThrough();
- component.getResponseDeclaration(mockOptionData.editorOptionData);
- expect(component.getResponseDeclaration).toHaveBeenCalled();
- // expect(mockOptionData.prepareMcqBody.responseDeclaration).toEqual(result);
- });
-
- it('#getInteractions() should return expected response declaration', () => {
- spyOn(component,"getInteractions").and.callThrough();
- component.getInteractions(mockOptionData.editorOptionData.options);
- expect(component.getInteractions).toHaveBeenCalled();
- // expect(mockOptionData.prepareMcqBody.interactions).toEqual(result);
- });
-
- it('#setTemplete() should set #templateType to "mcq-vertical-split" ', () => {
- spyOn(component, 'editorDataHandler').and.callThrough();
- const templateType = 'mcq-vertical-split';
- component.editorState = mockOptionData.editorOptionData;
- component.setTemplete(templateType);
- expect(component.templateType).toEqual(templateType);
- expect(component.editorDataHandler).toHaveBeenCalled();
- });
-
- it('#subMenuChange() should set the sub-menu value ', () => {
- component.subMenus = mockOptionData.subMenus;
- spyOn(component, 'subMenuChange').and.callThrough();
- component.subMenuChange({index:1,value:'test'},1)
- expect(component.subMenus[0][0].value).toBe('test');
- })
-
- it('#subMenuConfig() should set on initialize', () => {
- spyOn(component,'subMenuConfig').and.callThrough();
- const options = [
- {
- "body": "true
"
- }
- ];
- component.subMenuConfig(options);
- expect(component.subMenuConfig).toHaveBeenCalledWith(options)
- })
-
- it('#setScore() should call if score is entered', () => {
- spyOn(component,'setScore').and.callThrough();
- const value = "20";
- const scoreIndex = 1;
- component.setScore(value,scoreIndex);
- component.editorDataHandler();
- expect(component.setScore).toHaveBeenCalled();
- });
-
-});
diff --git a/projects/collection-editor-library/src/lib/components/options/options.component.ts b/projects/collection-editor-library/src/lib/components/options/options.component.ts
deleted file mode 100644
index 16984e133..000000000
--- a/projects/collection-editor-library/src/lib/components/options/options.component.ts
+++ /dev/null
@@ -1,149 +0,0 @@
-import { Component, OnInit, Input, EventEmitter, Output, ViewEncapsulation } from '@angular/core';
-import * as _ from 'lodash-es';
-import { EditorTelemetryService } from '../../services/telemetry/telemetry.service';
-import { ConfigService } from '../../services/config/config.service';
-import { SubMenu } from '../question-option-sub-menu/question-option-sub-menu.component';
-import { TreeService } from '../../services/tree/tree.service';
-import { EditorService } from '../../services/editor/editor.service';
-@Component({
- selector: 'lib-options',
- templateUrl: './options.component.html',
- styleUrls: ['./options.component.scss'],
-})
-export class OptionsComponent implements OnInit {
- @Input() editorState: any;
- @Input() showFormError;
- @Input() sourcingSettings;
- @Input() questionPrimaryCategory;
- @Input() mapping = [];
- @Input() isReadOnlyMode;
- @Output() editorDataOutput: EventEmitter = new EventEmitter();
- public setCharacterLimit = 160;
- public setImageLimit = 1;
- public templateType = 'mcq-vertical';
- subMenus: SubMenu[][];
- hints = [];
- showSubMenu:boolean=false;
- parentMeta: any;
- constructor(
- public telemetryService: EditorTelemetryService,
- public configService: ConfigService,
- public treeService: TreeService,
- private editorService: EditorService
- ) {}
-
- ngOnInit() {
- if (!_.isUndefined(this.editorState.templateId)) {
- this.templateType = this.editorState.templateId;
- }
- this.editorDataHandler();
- this.mapping = _.get(this.editorState, 'responseDeclaration.response1.mapping') || [];
- if(!_.isUndefined(this.editorService.editorConfig.config.renderTaxonomy)){
- this.parentMeta = this.treeService.getFirstChild().data.metadata;
- this.showSubMenu=true;
- }
- }
-
- editorDataHandler(event?) {
- const body = this.prepareMcqBody(this.editorState);
- this.editorDataOutput.emit({ body, mediaobj: event ? event.mediaobj : undefined });
- }
-
- prepareMcqBody(editorState) {
- let metadata: any;
- const correctAnswer = editorState.answer;
- let resindex;
- const options = _.map(editorState.options, (opt, key) => {
- resindex = Number(key);
- if (Number(correctAnswer) === key) {
- return { answer: true, value: { body: opt.body, value: resindex } };
- } else {
- return { answer: false, value: { body: opt.body, value: resindex } };
- }
- });
- metadata = {
- templateId: this.templateType,
- name: this.questionPrimaryCategory || 'Multiple Choice Question',
- responseDeclaration: this.getResponseDeclaration(editorState),
- interactionTypes: ['choice'],
- interactions: this.getInteractions(editorState.options),
- editorState: {
- options,
- },
- qType: 'MCQ',
- primaryCategory: this.questionPrimaryCategory || 'Multiple Choice Question',
- };
- return metadata;
- }
-
- getResponseDeclaration(editorState) {
- const responseDeclaration = {
- response1: {
- maxScore: 1,
- cardinality: 'single',
- type: 'integer',
- correctResponse: {
- value: editorState.answer,
- outcomes: { SCORE: 1 },
- },
- mapping: this.mapping,
- },
- };
- return responseDeclaration;
- }
-
- getInteractions(options) {
- let index;
- const interactOptions = _.map(options, (opt, key) => {
- index = Number(key);
- const hints = _.get(this.editorState, `interactions.response1.options[${index}].hints`)
- return { label: opt.body, value: index, hints };
- });
- this.subMenuConfig(options);
- const interactions = {
- response1: {
- type: 'choice',
- options: interactOptions,
- },
- };
- return interactions;
- }
-
- setTemplete(template) {
- this.templateType = template;
- this.editorDataHandler();
- }
-
- subMenuChange({ index, value }, optionIndex) {
- _.set(this.editorState, `interactions.response1.options[${optionIndex}].hints.en`, value)
- }
-
- subMenuConfig(options) {
- this.subMenus = []
- options.map((opt, index) => {
- const value = _.get(this.editorState, `interactions.response1.options[${index}].hints.en`)
- this.subMenus[index] = [
- {
- id: 'addHint',
- name: 'Add Hint',
- value,
- label: 'Hint',
- enabled: value ? true : false,
- type: 'input',
- show: _.get(this.sourcingSettings, 'showAddHints'),
- },
- ];
- });
- }
-
- setScore(value, scoreIndex) {
- const obj = {
- response: scoreIndex,
- outcomes: {
- score: value,
- },
- };
- this.mapping[scoreIndex] = obj;
- this.editorDataHandler();
- }
-}
diff --git a/projects/collection-editor-library/src/lib/components/plain-tree/plain-tree.component.html b/projects/collection-editor-library/src/lib/components/plain-tree/plain-tree.component.html
deleted file mode 100644
index a5b63aa08..000000000
--- a/projects/collection-editor-library/src/lib/components/plain-tree/plain-tree.component.html
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/projects/collection-editor-library/src/lib/components/plain-tree/plain-tree.component.scss b/projects/collection-editor-library/src/lib/components/plain-tree/plain-tree.component.scss
deleted file mode 100644
index e69de29bb..000000000
diff --git a/projects/collection-editor-library/src/lib/components/plain-tree/plain-tree.component.spec.data.ts b/projects/collection-editor-library/src/lib/components/plain-tree/plain-tree.component.spec.data.ts
deleted file mode 100644
index e37c00d2f..000000000
--- a/projects/collection-editor-library/src/lib/components/plain-tree/plain-tree.component.spec.data.ts
+++ /dev/null
@@ -1,352 +0,0 @@
-export const mockTreedata = {
- id: 'do_1134460323603906561218',
- title: 'Science',
- tooltip: 'Science',
- primaryCategory: 'Observation With Rubrics',
- objectType: 'QuestionSet',
- metadata: {
- parent: 'do_1134357224765685761203',
- code: 'a51c0d9f-4696-3354-062f-b2078048656c',
- allowScoring: 'Yes',
- allowSkip: 'Yes',
- containsUserData: 'No',
- channel: '01309282781705830427',
- language: ['English'],
- mimeType: 'application/vnd.sunbird.questionset',
- showHints: 'No',
- createdOn: '2022-01-05T05:42:52.118+0000',
- objectType: 'QuestionSet',
- primaryCategory: 'Observation With Rubrics',
- contentDisposition: 'inline',
- lastUpdatedOn: '2022-03-03T08:35:03.542+0000',
- contentEncoding: 'gzip',
- showSolutions: 'No',
- allowAnonymousAccess: 'Yes',
- identifier: 'do_1134460323603906561218',
- lastStatusChangedOn: '2022-01-05T05:42:52.118+0000',
- requiresSubmit: 'No',
- visibility: 'Parent',
- showTimer: 'No',
- index: 1,
- setType: 'materialised',
- languageCode: ['en'],
- version: 1,
- versionKey: '1641361372118',
- showFeedback: 'No',
- license: 'CC BY 4.0',
- depth: 1,
- compatibilityLevel: 5,
- name: 'Science',
- navigationMode: 'non-linear',
- allowBranching: 'Yes',
- shuffle: true,
- attributions: [],
- status: 'Draft',
- },
- folder: true,
- children: [
- {
- id: 'do_1134460323602841601200',
- title: 'Chemistry',
- tooltip: 'Chemistry',
- primaryCategory: 'Observation With Rubrics',
- objectType: 'QuestionSet',
- metadata: {
- parent: 'do_1134460323603906561218',
- code: 'b4c3e613-5c3f-9c8b-d61f-417f4c5d8df2',
- allowScoring: 'Yes',
- allowSkip: 'Yes',
- containsUserData: 'No',
- channel: '01309282781705830427',
- branchingLogic: {
- do_113449775832088576181: {
- target: [],
- source: ['do_113449672558780416163'],
- preCondition: {
- and: [
- {
- eq: [
- {
- var: 'do_113449672558780416163.response1.value',
- type: 'responseDeclaration',
- },
- [0],
- ],
- },
- ],
- },
- },
- do_113449787008081920183: {
- target: [],
- source: ['do_113449672558780416163'],
- preCondition: {
- and: [
- {
- ne: [
- {
- var: 'do_113449672558780416163.response1.value',
- type: 'responseDeclaration',
- },
- [1],
- ],
- },
- ],
- },
- },
- do_11345671149997260811: {
- target: [],
- source: ['do_113449672558780416163'],
- preCondition: {
- and: [
- {
- eq: [
- {
- var: 'do_113449672558780416163.response1.value',
- type: 'responseDeclaration',
- },
- [0],
- ],
- },
- ],
- },
- },
- do_113449808985628672185: {
- target: [],
- source: ['do_113449672558780416163'],
- preCondition: {
- and: [
- {
- eq: [
- {
- var: 'do_113449672558780416163.response1.value',
- type: 'responseDeclaration',
- },
- [0],
- ],
- },
- ],
- },
- },
- do_113449672558780416163: {
- target: [
- 'do_113449775832088576181',
- 'do_113449787008081920183',
- 'do_113449808985628672185',
- 'do_11345671149997260811',
- ],
- preCondition: {},
- source: [],
- },
- },
- language: ['English'],
- mimeType: 'application/vnd.sunbird.questionset',
- showHints: 'No',
- createdOn: '2022-01-05T05:42:52.106+0000',
- objectType: 'QuestionSet',
- primaryCategory: 'Observation With Rubrics',
- contentDisposition: 'inline',
- lastUpdatedOn: '2022-03-03T08:35:03.542+0000',
- contentEncoding: 'gzip',
- showSolutions: 'No',
- allowAnonymousAccess: 'Yes',
- identifier: 'do_1134460323602841601200',
- lastStatusChangedOn: '2022-01-05T05:42:52.106+0000',
- requiresSubmit: 'No',
- visibility: 'Parent',
- showTimer: 'No',
- index: 1,
- setType: 'materialised',
- languageCode: ['en'],
- version: 1,
- versionKey: '1641361372106',
- showFeedback: 'No',
- license: 'CC BY 4.0',
- depth: 2,
- compatibilityLevel: 5,
- name: 'Chemistry',
- navigationMode: 'non-linear',
- allowBranching: 'Yes',
- shuffle: true,
- attributions: [],
- status: 'Draft',
- },
- folder: true,
- children: [],
- root: false,
- extraClasses: '',
- icon: 'fa fa-folder-o',
- },
- {
- id: 'do_1134460323604971521236',
- title: 'Biology',
- tooltip: 'Biology',
- primaryCategory: 'Observation With Rubrics',
- objectType: 'QuestionSet',
- metadata: {
- parent: 'do_1134460323603906561218',
- code: 'bfdac63e-4cd1-c9fe-00a0-be98f73e13d8',
- allowScoring: 'Yes',
- allowSkip: 'Yes',
- containsUserData: 'No',
- channel: '01309282781705830427',
- branchingLogic: {},
- language: ['English'],
- mimeType: 'application/vnd.sunbird.questionset',
- showHints: 'No',
- createdOn: '2022-01-05T05:42:52.131+0000',
- objectType: 'QuestionSet',
- primaryCategory: 'Observation With Rubrics',
- contentDisposition: 'inline',
- lastUpdatedOn: '2022-01-10T13:09:04.092+0000',
- contentEncoding: 'gzip',
- showSolutions: 'No',
- allowAnonymousAccess: 'Yes',
- identifier: 'do_1134460323604971521236',
- lastStatusChangedOn: '2022-01-05T05:42:52.131+0000',
- requiresSubmit: 'No',
- visibility: 'Parent',
- showTimer: 'No',
- index: 2,
- setType: 'materialised',
- languageCode: ['en'],
- version: 1,
- versionKey: '1641361372131',
- showFeedback: 'No',
- license: 'CC BY 4.0',
- depth: 2,
- compatibilityLevel: 5,
- name: 'Biology',
- navigationMode: 'non-linear',
- allowBranching: 'Yes',
- shuffle: true,
- attributions: [],
- status: 'Draft',
- },
- folder: true,
- children: [],
- root: false,
- extraClasses: '',
- icon: 'fa fa-folder-o',
- },
- {
- id: 'do_1134460323603578881212',
- title: 'General Science',
- tooltip: 'General Science',
- primaryCategory: 'Observation With Rubrics',
- objectType: 'QuestionSet',
- metadata: {
- parent: 'do_1134460323603906561218',
- code: '9916f5fc-4f37-3f8e-5151-b32ce65217da',
- allowScoring: 'Yes',
- allowSkip: 'Yes',
- containsUserData: 'No',
- channel: '01309282781705830427',
- language: ['English'],
- mimeType: 'application/vnd.sunbird.questionset',
- showHints: 'No',
- createdOn: '2022-01-05T05:42:52.114+0000',
- objectType: 'QuestionSet',
- primaryCategory: 'Observation With Rubrics',
- contentDisposition: 'inline',
- lastUpdatedOn: '2022-01-05T05:42:52.114+0000',
- contentEncoding: 'gzip',
- showSolutions: 'No',
- allowAnonymousAccess: 'Yes',
- identifier: 'do_1134460323603578881212',
- lastStatusChangedOn: '2022-01-05T05:42:52.114+0000',
- requiresSubmit: 'No',
- visibility: 'Parent',
- showTimer: 'No',
- index: 3,
- setType: 'materialised',
- languageCode: ['en'],
- version: 1,
- versionKey: '1641361372114',
- showFeedback: 'No',
- license: 'CC BY 4.0',
- depth: 2,
- compatibilityLevel: 5,
- name: 'General Science',
- navigationMode: 'non-linear',
- allowBranching: 'Yes',
- shuffle: true,
- attributions: [],
- status: 'Draft',
- },
- folder: true,
- children: [],
- root: false,
- extraClasses: '',
- icon: 'fa fa-folder-o',
- },
- ],
- root: false,
- extraClasses: '',
- icon: 'fa fa-folder-o',
-};
-
-export const treeConfigData = {
- extensions: ["glyph", "dnd5"],
- clickFolderMode: 3,
- source: [
- {
- title: "Criteria Name",
- key: "2",
- folder: true,
- icon: "fa fa-folder-o",
- children: [
- {
- id: "do_1134460323602841601200",
- title: "Chemistry",
- tooltip: "Chemistry",
- primaryCategory: "Observation With Rubrics",
- metadata: {
- objectType: "QuestionSet",
- name: "Chemistry",
- },
- folder: true,
- root: false,
- icon: "fa fa-folder-o",
- },
- {
- id: "do_1134460323604971521236",
- title: "Biology",
- tooltip: "Biology",
- primaryCategory: "Observation With Rubrics",
- metadata: {
- objectType: "QuestionSet",
- name: "Biology",
- },
- folder: true,
- root: false,
- icon: "fa fa-folder-o",
- },
- ],
- },
- ],
- escapeTitles: true,
- glyph: {
- preset: "awesome4",
- map: {
- folder: "icon folder sb-fancyTree-icon",
- folderOpen: "icon folder outline sb-fancyTree-icon",
- },
- },
- dnd5: {
- autoExpandMS: 400,
- preventVoidMoves: true,
- preventRecursion: true,
- filter: {
- autoApply: true,
- autoExpand: false,
- counter: true,
- fuzzy: false,
- hideExpandedCounter: true,
- hideExpanders: false,
- highlight: true,
- leavesOnly: false,
- nodata: true,
- mode: 'dimm'
- },
- },
-};
diff --git a/projects/collection-editor-library/src/lib/components/plain-tree/plain-tree.component.spec.ts b/projects/collection-editor-library/src/lib/components/plain-tree/plain-tree.component.spec.ts
deleted file mode 100644
index c0200418f..000000000
--- a/projects/collection-editor-library/src/lib/components/plain-tree/plain-tree.component.spec.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
-import { PlainTreeComponent } from './plain-tree.component';
-import { HttpClientTestingModule } from '@angular/common/http/testing';
-import { NO_ERRORS_SCHEMA } from '@angular/core';
-import { mockTreedata } from './plain-tree.component.spec.data';
-import { of, throwError } from 'rxjs';
-
-describe('PlainTreeComponent', () => {
- let component: PlainTreeComponent;
- let fixture: ComponentFixture;
- beforeEach(waitForAsync(() => {
- TestBed.configureTestingModule({
- imports: [HttpClientTestingModule],
- declarations: [ PlainTreeComponent ],
- providers: [],
- schemas: [NO_ERRORS_SCHEMA]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(PlainTreeComponent);
- component = fixture.componentInstance;
- // fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-
- it('#buildTreeData should call', async () => {
- expect(component.buildTreeData).toBeDefined();
- component.buildTreeData(mockTreedata);
- });
-
- it('#ngAfterViewInit() should call #getTreeConfig() and #renderTree()', () => {
- spyOn(component, 'getTreeConfig').and.callFake(() => {});
- spyOn(component, 'renderTree').and.callFake(() => {});
- spyOn(component, 'ngAfterViewInit').and.callThrough();
- component.ngAfterViewInit();
- expect(component.getTreeConfig).toHaveBeenCalled();
- expect(component.renderTree).toHaveBeenCalled();
- });
-
- it('#getQuestionsList should call', () => {
- spyOn(component, 'getQuestionsList').and.callThrough();
- spyOn(component.treeEmitter, 'emit');
- component.getQuestionsList({id: 'do_123', metadata: {name: 'Classroom'}});
- expect(component.treeEmitter.emit).toHaveBeenCalledWith({identifier : 'do_123', criteriaName : 'Classroom'});
- });
-
- it('getTreeConfig should call', () => {
- // spyOn(component, 'buildTreeData').and.returnValue(of(mockTreedata));
- expect(component.getTreeConfig).toBeDefined();
- component.getTreeConfig();
- });
-});
diff --git a/projects/collection-editor-library/src/lib/components/plain-tree/plain-tree.component.ts b/projects/collection-editor-library/src/lib/components/plain-tree/plain-tree.component.ts
deleted file mode 100644
index 166f8540f..000000000
--- a/projects/collection-editor-library/src/lib/components/plain-tree/plain-tree.component.ts
+++ /dev/null
@@ -1,142 +0,0 @@
-import {
- AfterViewInit,
- Component,
- ElementRef,
- EventEmitter,
- Input,
- OnInit,
- Output,
- ViewChild,
-} from '@angular/core';
-import 'jquery.fancytree';
-import * as _ from 'lodash-es';
-import { EditorService } from '../../services/editor/editor.service';
-
-declare var $: any;
-
-@Component({
- selector: 'lib-plain-tree',
- templateUrl: './plain-tree.component.html',
- styleUrls: ['./plain-tree.component.scss'],
-})
-export class PlainTreeComponent implements OnInit, AfterViewInit {
- @ViewChild('plainTree') public tree: ElementRef;
- @Input() treeData;
- @Output() treeEmitter: EventEmitter = new EventEmitter();
-
- constructor(private editorService: EditorService) {}
-
- ngOnInit(): void {}
-
- ngAfterViewInit() {
- this.renderTree(this.getTreeConfig());
- }
-
- renderTree(options) {
- $(this.tree.nativeElement).fancytree(options);
- }
-
- buildTreeData(data) {
- let tree = [];
- _.forEach(data, (child: any) => {
- if (child.children) {
- _.forEach(child.children, (data) => {
- tree.push({
- id: data?.id,
- title: data?.title,
- tooltip: data?.title,
- primaryCategory: _.get(
- this.editorService,
- 'editorConfig.config.primaryCategory'
- ),
- metadata: {
- objectType: _.get(
- this.editorService,
- 'editorConfig.config.objectType'
- ),
- name: data?.title,
- },
- folder: true,
- root: false,
- icon: 'fa fa-folder-o',
- });
- });
- }
- });
- return tree;
- }
-
- getQuestionsList(data) {
- this.treeEmitter.emit({
- identifier: _.get(data, 'id'),
- criteriaName: _.get(data, 'metadata.name')
- });
- }
-
- getTreeConfig() {
- const rootNode = [
- {
- title: 'Criteria Name',
- key: '2',
- folder: true,
- expanded: true,
- root: true,
- icon: 'fa fa-folder-o',
- children: this.buildTreeData(this.treeData),
- },
- ];
- const options: any = {
- extensions: ['glyph', 'dnd5'],
- clickFolderMode: 3,
- source: rootNode,
- escapeTitles: true,
- glyph: {
- preset: 'awesome4',
- map: {
- folder: 'icon folder sb-fancyTree-icon',
- folderOpen: 'icon folder outline sb-fancyTree-icon',
- },
- },
- dnd5: {
- autoExpandMS: 400,
- // focusOnClick: true,
- preventVoidMoves: true, // Prevent dropping nodes 'before self', etc.
- preventRecursion: true, // Prevent dropping nodes on own descendants
- filter: {
- autoApply: true,
- autoExpand: false,
- counter: true,
- fuzzy: false,
- hideExpandedCounter: true,
- hideExpanders: false,
- highlight: true,
- leavesOnly: false,
- nodata: true,
- mode: 'dimm',
- },
- },
- init: (event, data) => {},
- click: (event, data): boolean => {
- this.tree.nativeElement.click();
- return true;
- },
- activate: (event, data) => {
- if (!_.isUndefined(data.node.data.id)){
- this.getQuestionsList(_.get(data, 'node.data'));
- }
- },
- renderNode: (event, data) => {
- const node = data.node;
- const $nodeSpan = $(node.span);
-
- // check if span of node already rendered
- if (!$nodeSpan.data('rendered')) {
- // span rendered
- $nodeSpan.data('rendered', true);
- }
- },
- };
- return options;
- }
-
-}
diff --git a/projects/collection-editor-library/src/lib/components/progress-status/progress-status.component.html b/projects/collection-editor-library/src/lib/components/progress-status/progress-status.component.html
deleted file mode 100644
index c47ee24eb..000000000
--- a/projects/collection-editor-library/src/lib/components/progress-status/progress-status.component.html
+++ /dev/null
@@ -1,44 +0,0 @@
-
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/progress-status/progress-status.component.scss b/projects/collection-editor-library/src/lib/components/progress-status/progress-status.component.scss
deleted file mode 100644
index 9367710c4..000000000
--- a/projects/collection-editor-library/src/lib/components/progress-status/progress-status.component.scss
+++ /dev/null
@@ -1,68 +0,0 @@
-table {
- font-family: arial, sans-serif;
- width: 97%;
- border-collapse: collapse;
- thead {
- tr{
- .width-40{
- width: 40%;
- }
- .width-13{
- width: 13%;
- }
- .width-24{
- width: 24%;
- }
- .width-10{
- width: 10%;
- }
- }
- }
- tbody{
- border-top: 15px solid white;
- tr{
- height: 60px;
- background: #e9e8e8;
- td{
- input{
- max-width: 37%;
- box-sizing: border-box;
- height: 43px;
- border-radius: 6px;
- text-align: center;
- background: white;
- }
- .hidden-input{
- margin-bottom: 10px;
- }
- .label{
- font-size: 18px !important;
- margin-top: 5px;
- }
- }
- .padding-x-25{
- padding:0px 25px;
- }
- .font-blue{
- color: rgb(47, 47, 176);
- }
- .font-bold{
- font-weight: bold;
- }
- }
- font-family: arial, sans-serif;
- }
- }
- .border{
- border-left: 1px solid rgb(126, 126, 126);
- }
- .flex{
- display: flex;
- justify-content: center;
- height: inherit;
- align-items: center;
- }
- .hidden-block{
- display: table-row;
- background: white !important;
- }
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/progress-status/progress-status.component.spec.ts b/projects/collection-editor-library/src/lib/components/progress-status/progress-status.component.spec.ts
deleted file mode 100644
index a32c223bf..000000000
--- a/projects/collection-editor-library/src/lib/components/progress-status/progress-status.component.spec.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { ProgressStatusComponent } from './progress-status.component';
-import { HttpClientTestingModule } from '@angular/common/http/testing';
-
-describe('ProgressStatusComponent', () => {
- let component: ProgressStatusComponent;
- let fixture: ComponentFixture;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- imports: [HttpClientTestingModule],
- declarations: [ ProgressStatusComponent ]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(ProgressStatusComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
diff --git a/projects/collection-editor-library/src/lib/components/progress-status/progress-status.component.ts b/projects/collection-editor-library/src/lib/components/progress-status/progress-status.component.ts
deleted file mode 100644
index fabe027c0..000000000
--- a/projects/collection-editor-library/src/lib/components/progress-status/progress-status.component.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import { Component, EventEmitter, OnInit, Output } from '@angular/core';
-import { EditorService } from '../../services/editor/editor.service';
-
-@Component({
- selector: 'lib-progress-status',
- templateUrl: './progress-status.component.html',
- styleUrls: ['./progress-status.component.scss']
-})
-export class ProgressStatusComponent implements OnInit {
- toolbarConfig: any = {};
- pageId = 'progressStatus';
- data=[{criteria:"Classrooms",maxScore:10,minScore:10,questionsCreated:10,isExpanded:false},
- {criteria:"Toilets",maxScore:10,minScore:10,questionsCreated:10,isExpanded:false},
- {criteria:"Assembly",maxScore:10,minScore:10,questionsCreated:10,isExpanded:false},
- {criteria:"Teaching and Learning",maxScore:10,minScore:10,questionsCreated:10,isExpanded:false}]
- expandedElement="";
- @Output() assignPageEmitter = new EventEmitter();
-
- constructor(private editorService: EditorService) { }
-
- ngOnInit(): void {
- this.toolbarConfig = this.editorService.getToolbarConfig();
- this.toolbarConfig.title = 'Observation Form';
- }
-
- toolbarEventListener(event) {
- switch (event.button) {
- case 'backContent':
- this.redirectToQuestionSet();
- break;
- default :
- break;
- }
- }
-
- redirectToQuestionSet() {
- this.assignPageEmitter.emit({ status: false });
- }
-
- expand(event){
- this.expandedElement = (this.expandedElement==event.criteria)?"":event.criteria;
- }
-
-}
diff --git a/projects/collection-editor-library/src/lib/components/quality-params-modal/quality-params-modal.component.css b/projects/collection-editor-library/src/lib/components/quality-params-modal/quality-params-modal.component.css
deleted file mode 100644
index ff215b558..000000000
--- a/projects/collection-editor-library/src/lib/components/quality-params-modal/quality-params-modal.component.css
+++ /dev/null
@@ -1,14 +0,0 @@
-::ng-deep .dynamic-form label, .add-to-library .dynamic-form .multi-select-container .list-border ul {
- font-size: 1rem !important;
- line-height: 1.4;
- font-weight: 400;
-}
-.sb-modal-content{
- padding: 1.3rem;
-}
-
-.sb-modal-content label{
- font-weight: bolder;
-}
-
-
diff --git a/projects/collection-editor-library/src/lib/components/quality-params-modal/quality-params-modal.component.html b/projects/collection-editor-library/src/lib/components/quality-params-modal/quality-params-modal.component.html
deleted file mode 100644
index c4187c746..000000000
--- a/projects/collection-editor-library/src/lib/components/quality-params-modal/quality-params-modal.component.html
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
Score each parameter out of 5
-
-
-
{{configService.labelConfig?.lbl?.qualityReview}}
-
-
-
- {{configService.labelConfig?.button_labels?.publish_collection_btn_label}}
-
-
- {{configService.labelConfig?.button_labels?.reject_collection_btn_label}}
-
-
-
-
diff --git a/projects/collection-editor-library/src/lib/components/quality-params-modal/quality-params-modal.component.ts b/projects/collection-editor-library/src/lib/components/quality-params-modal/quality-params-modal.component.ts
deleted file mode 100644
index 1b534bb13..000000000
--- a/projects/collection-editor-library/src/lib/components/quality-params-modal/quality-params-modal.component.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
-import {ConfigService} from '../../services/config/config.service';
-
-@Component({
- selector: 'lib-quality-params-modal',
- templateUrl: './quality-params-modal.component.html',
- styleUrls: ['./quality-params-modal.component.css']
-})
-export class QualityParamsModalComponent implements OnInit {
- @Input() qualityFormConfig: any;
- @Input() showQualityParameterPopup: boolean;
- @Output() qualityParamChanged = new EventEmitter();
- @Input() labelConfigData: any;
- formData: any;
- isApprovalBtnEnable: boolean;
- isRequestChangeBtnEnable: boolean;
- totalScoreValue = 0;
-
- constructor(public configService: ConfigService) {
- }
-
- ngOnInit(): void {
- }
-
- onStatusChanges(event) {
- this.isApprovalBtnEnable = event?.isValid;
- this.isRequestChangeBtnEnable = event?.isValid;
- }
-
- valueChanges(event) {
- this.formData = event;
- this.totalScoreValue = 0;
- for (const key in this.formData) {
- if (this.formData[key] && !isNaN(this.formData[key])) {
- this.totalScoreValue += parseInt(this.formData[key]);
- }
- }
- }
-
- submitApproval() {
- this.qualityParamChanged.emit({action: 'submit', data: this.formData});
- }
-
- requestChanges() {
- this.qualityParamChanged.emit({action: 'requestChange', data: this.formData});
- }
-
- onModalClose() {
- this.qualityParamChanged.emit({action: 'close'});
- }
-}
diff --git a/projects/collection-editor-library/src/lib/components/question-option-sub-menu/question-option-sub-menu.component.css b/projects/collection-editor-library/src/lib/components/question-option-sub-menu/question-option-sub-menu.component.css
deleted file mode 100644
index 1a9fcac86..000000000
--- a/projects/collection-editor-library/src/lib/components/question-option-sub-menu/question-option-sub-menu.component.css
+++ /dev/null
@@ -1,6 +0,0 @@
-label {
- font-size: 12px !important;
- margin-bottom: 0.5rem !important;
- color: #121213e0;
- font-weight: 600;
-}
diff --git a/projects/collection-editor-library/src/lib/components/question-option-sub-menu/question-option-sub-menu.component.html b/projects/collection-editor-library/src/lib/components/question-option-sub-menu/question-option-sub-menu.component.html
deleted file mode 100644
index 0bfdff7eb..000000000
--- a/projects/collection-editor-library/src/lib/components/question-option-sub-menu/question-option-sub-menu.component.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
- {{ menu?.name }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/projects/collection-editor-library/src/lib/components/question-option-sub-menu/question-option-sub-menu.component.spec.ts b/projects/collection-editor-library/src/lib/components/question-option-sub-menu/question-option-sub-menu.component.spec.ts
deleted file mode 100644
index 3531ce3ed..000000000
--- a/projects/collection-editor-library/src/lib/components/question-option-sub-menu/question-option-sub-menu.component.spec.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
-import { HttpClientTestingModule } from "@angular/common/http/testing";
-import { QuestionOptionSubMenuComponent } from './question-option-sub-menu.component';
-import { mockData } from './question-option-sub-menu.spec.data';
-
-describe('QuestionOptionSubMenuComponent', () => {
- let component: QuestionOptionSubMenuComponent;
- let fixture: ComponentFixture;
-
- beforeEach(waitForAsync(() => {
- TestBed.configureTestingModule({
- imports:[HttpClientTestingModule],
- declarations: [QuestionOptionSubMenuComponent],
- }).compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(QuestionOptionSubMenuComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
- it('#onMenuClick() should enable the submenu if type is input ', () => {
- component.subMenus = mockData.subMenus;
- spyOn(component, 'onMenuClick').and.callThrough();
- component.onMenuClick(1)
- expect(component.subMenus[1].enabled).toBe(true);
- });
- it('#onMenuClick() should push dependant question if input value is array ', () => {
- component.subMenus = mockData.subMenus;
- spyOn(component, 'onMenuClick').and.callThrough();
- component.onMenuClick(2)
- expect(component.subMenus[2].value.length).toBe(0);
- });
- it('#onValueChange() should emit the value if type is input ', () => {
- component.subMenus = mockData.subMenus;
- spyOn(component, 'onValueChange').and.callThrough();
- spyOn(component.onChange, 'emit')
-
- let ev = {
- target:{value:'text'}
- }
- component.onValueChange(ev,1)
- expect(component.onValueChange).toHaveBeenCalled();
- expect(component.onChange.emit).toHaveBeenCalled()
- });
-});
diff --git a/projects/collection-editor-library/src/lib/components/question-option-sub-menu/question-option-sub-menu.component.ts b/projects/collection-editor-library/src/lib/components/question-option-sub-menu/question-option-sub-menu.component.ts
deleted file mode 100644
index 502dfbbc0..000000000
--- a/projects/collection-editor-library/src/lib/components/question-option-sub-menu/question-option-sub-menu.component.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-import { Component, EventEmitter, Input, Output } from '@angular/core';
-import { EditorService } from '../../services/editor/editor.service';
-
-export class SubMenuEvent {
- index: number;
- value: any;
-}
-export interface SubMenu {
- id: string;
- name: string;
- label: string;
- value: string|any[];
- enabled: boolean;
- type: string;
- show: boolean;
-}
-@Component({
- selector: 'lib-question-option-sub-menu',
- templateUrl: './question-option-sub-menu.component.html',
- styleUrls: ['./question-option-sub-menu.component.css'],
-})
-export class QuestionOptionSubMenuComponent {
- @Input() subMenus: SubMenu[];
- @Output() public onChange: EventEmitter = new EventEmitter();
-
- constructor(public editorService: EditorService){
-
- }
-
- onMenuClick(index) {
- const selectedMenu = this.subMenus[index];
- selectedMenu.enabled = !selectedMenu.enabled;
- if (selectedMenu.enabled && selectedMenu.type !== 'input' && Array.isArray(selectedMenu.value)) {
- this.onChange.emit({index, value: undefined});
- }
- }
-
- onValueChange(event, index) {
- if (this.subMenus[index].type === 'input') { this.subMenus[index].value = event.target.value; }
- this.onChange.emit({ index, value: event.target.value});
- }
-}
diff --git a/projects/collection-editor-library/src/lib/components/question-option-sub-menu/question-option-sub-menu.spec.data.ts b/projects/collection-editor-library/src/lib/components/question-option-sub-menu/question-option-sub-menu.spec.data.ts
deleted file mode 100644
index 4a8246034..000000000
--- a/projects/collection-editor-library/src/lib/components/question-option-sub-menu/question-option-sub-menu.spec.data.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-export const mockData = {
- subMenus: [
- {
- id: 'addHint',
- name: 'Add Hint',
- value: '',
- enabled: false,
- type: 'input',
- label: 'label',
- show: true,
- },
- {
- id: 'addTip',
- name: 'Add Tip',
- value: '',
- enabled: false,
- type: 'input',
- label: 'label',
- show: true,
- },
- {
- id: 'addDependantQuestion',
- name: 'Add Dependant Question',
- value: [],
- enabled: false,
- type: '',
- label: 'label',
- show: true,
- },
- ],
-};
diff --git a/projects/collection-editor-library/src/lib/components/question/question.component.html b/projects/collection-editor-library/src/lib/components/question/question.component.html
deleted file mode 100644
index 3d41417b3..000000000
--- a/projects/collection-editor-library/src/lib/components/question/question.component.html
+++ /dev/null
@@ -1,232 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ questionSetHierarchy.children ? 'Q'+ (questionSetHierarchy.children.length+1):''}} {{'. '+
- (childindex+1)}}
-
- edit question
-
-
-
-
-
- {{configService.labelConfig?.lbl?.Questiondetails}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{configService.labelConfig?.lbl?.confirmQuestionNotSaved}}
-
-
-
- {{configService.labelConfig?.button_labels?.yes_btn_label}}
-
-
- {{configService.labelConfig?.button_labels?.no_btn_label}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{configService.labelConfig?.button_labels?.close_btn_label}}
-
-
-
-
-
diff --git a/projects/collection-editor-library/src/lib/components/question/question.component.scss b/projects/collection-editor-library/src/lib/components/question/question.component.scss
deleted file mode 100644
index ba2cd2934..000000000
--- a/projects/collection-editor-library/src/lib/components/question/question.component.scss
+++ /dev/null
@@ -1,320 +0,0 @@
-.sb-w-85{
- width: 85%;
-}
-sui-select {
- width: 100%;
- border: 1px solid rgba(34, 36, 38, 0.15);
- font-size: 0.8rem;
- padding: 0.4rem 0.2rem;
- background: #fff;
-}
-.dropdown.icon {
- float: right !important;
-}
-.menu {
- width: 100%;
-}
-.solution-media {
- &__video {
- width: 166px;
- height: 96px;
- .overlay-image {
- width: 100%;
- height: 100%;
- background: rgba(0, 0, 0, 0.3);
- position: absolute;
- left: 0;
- right: 0;
- cursor: pointer;
- z-index: 1;
- }
- .overlay-image .play.icon {
- position: absolute;
- transform: translate(-50%, -50%);
- top: 50%;
- left: 50%;
- color: rgba(255, 255, 255, 0.6);
- font-size: 32px;
- cursor: pointer;
- height: auto;
- }
- }
- &__desc {
- font-size: 12px;
- font-weight: bold;
- color: #333;
- max-width: 180px;
- height: 96px;
- display: flex;
- align-items: flex-end;
- line-height: normal;
- line-height: 13px;
- }
-}
-
-.ckeditor-tool__option,
-.ckeditor-tool__question{
- border: 1px solid #c4c4c4;
- border-radius: 4px;
- border-top: 0;
- position: relative;
- display: flow-root;
-}
-.ckeditor-tool__solution, .ckeditor-tool__question-readonly, .ckeditor-tool__option-readonly {
- border: 1px solid #c4c4c4;
- border-radius: 4px;
- margin-bottom: -4px;
-}
-
-.ckeditor-tool__label {
- background-color: #f3f8ff;
- color: var(--primary-color)!important;
- font-weight: 600;
- border-top-left-radius: 4px;
- border-top-right-radius: 4px;
-}
-
-.mcq-checkbox-answer {
- background: #f2f2f2;
- padding: 8px;
- display: flex;
- justify-content: center;
- align-items: center;
- border-bottom-left-radius: 4px;
- border-bottom-right-radius: 4px;
-}
-
-.ckeditor-tool__solution .menu {
- .item {
- font-size: 0.785rem !important;
- }
-}
-
-.solution_video{
- .ckeditor-tool__option{
- border:0;
- }
-}
-.ck-rounded-corners .ck.ck-editor__top .ck-sticky-panel .ck-toolbar{
- border-radius: 4px !important;
-}
-.solution_html,
-.solution_video
-{
- .sb-ckeditor{
- .sb-ckeditor-close{
- right: 5px;
- top: -30px;
- border: 0;
- background: none;
- min-width: auto;
- padding: 0;
- color: #999999;
- }
- }
-}
-.sb-ckeditor{
- .sb-ckeditor-close{
- right: -5px;
- top: -22px;
- border: 0;
- background: none;
- min-width: auto;
- padding: 0;
- color: #999999;
- }
-}
-.sb-mcq-form{
- .sb-mcq-item:nth-child(4){
- .sb-ckeditor{
- .ckeditor-tool__option{
- margin-bottom: 0 !important;
- }
- }
- }
-}
-
-.two-column-grid {
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- column-gap: 0.5rem;
- border-bottom: solid 1px var(--gray-100);
- &:last-child{
- border-bottom: none;
- }
-}
-.dynamic-form{
- .sb-search-input::-webkit-input-placeholder {
- padding-left: 1.4rem !important;
- }
- .required{
- label{
- &:after{
- content: "*";
- margin: -.2em 0 0 .2em;
- color: #db2828;
- }
- }
- }
-}
-.list-border{
- height: inherit !important;
- ul{
- padding: 0 !important;
- span{
- font-weight: 500 !important;
- font-size: 0.785rem;
- }
- }
-}
-
-.sb-editor-container {
- position: relative;
- z-index: 998 !important;
- .sb-input:first-child{
- margin: 1rem 0 !important;
- }
- .sb-container {
- width: 95% !important;
- }
-
- .dynamic-form {
- .sb-dropdown-select{
- padding: 11px 8px !important;
- }
- label {
- font-size: 12px !important;
- margin-bottom: 0.5rem !important;
- color: #121213e0;
- font-weight: 600;
- }
-
- .sb-textbox,
- select,
- .sb-textarea,
- .list-border {
- border: 1px solid rgba(34, 36, 38, 0.15) !important;
- padding: 12px 8px !important;
- border-radius: 0.28571429rem;
- font-size: 0.785rem !important;
- font-weight: 500;
- // text-transform: capitalize;
- }
-
- .multi-select-container{
- .list-border{
- ul{
- @extend label;
- color: #333;
- padding: 0;
- margin: 0 !important;
- opacity: 1 !important;
- font-weight: 500 !important;
- }
- }
- }
-
- .sb-modal-dropdown-web{
- ul{
- color: #333;
- padding: 0;
- margin: 0 !important;
- opacity: 1 !important;
- font-size: 12px !important;
- font-weight: 500;
- border: 2px solid #eeeeef;
- }
- }
- .sb-keywordbox{
- border: 1px solid rgba(34,36,38,.15) !important;
- padding: .45rem .5rem!important;
- border-radius: .28571429rem;
- font-size: 0.785rem !important;
- font-weight: 500;
- padding: 0 !important;
- .ng2-tag-input{
- padding: 0;
- tag{
- margin-left: 0.5rem;
- }
- }
- .ng2-tags-container{
- margin-top: 0.2rem;
- }
- .tag-wrapper,delete-icon svg{
- height: 24px;
- line-height: 24px;
- }
- }
- .topic-picker-selector{
- @extend .sb-textbox;
- }
- .sb-dropdown{
- label{
- padding: 0;
- }
- }
- .sb-textarea-container{
- .sb-textarea{
- height: 2.9rem;
- padding-top: 0.5rem !important;
- }
- label{
- padding: 0;
- }
- }
- .sb-checkbox{
- padding: 0;
- margin-top: 0;
- }
- sb-icon-dropdown{
- top: 10px !important;
- right: 6px !important;
- }
- }
- .sb-textarea-container,
- .sb-dropdown{
- margin: 1rem 0 !important;
- }
- }
-
- lib-chat-window, .chat_bot{
- display: none !important;
- }
-
- .h-100{
- height: 100% !important;
- }
-
- .sb-required {
- color:#ff4558;
- padding-left: 2px;
- position: relative;
- top: -5px;
- }
- select[disabled]{
- opacity: 0.8 !important;
- font-weight: 500 !important;
- }
-
- .multiselect{
- position: relative;
- top: -7px;
- height: 48px;
- left:7px;
- font-size: 14px;
- font-weight: 400;
- }
-
-.treepicker-parent .list-border {
- height: 38px!important;
- padding: 1rem!important;
- margin-top: 15px !important;
-}
-
-.options{
- justify-content: flex-end;
- margin-right:10px;
- display: flex;
- gap: 10px;
-}
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/question/question.component.spec.data.ts b/projects/collection-editor-library/src/lib/components/question/question.component.spec.data.ts
deleted file mode 100644
index 288174f9b..000000000
--- a/projects/collection-editor-library/src/lib/components/question/question.component.spec.data.ts
+++ /dev/null
@@ -1,3406 +0,0 @@
-export const mockData = {
- childMetadata: {
- templateName: "",
- required: [],
- properties: [
- {
- code: "name",
- dataType: "text",
- description: "Name of the content",
- editable: true,
- inputType: "text",
- label: "Title",
- name: "Title",
- placeholder: "Title",
- renderingHints: {
- class: "sb-g-col-lg-1 required",
- },
- required: true,
- visible: true,
- validations: [
- {
- type: "max",
- value: "120",
- message: "Input is Exceeded",
- },
- {
- type: "required",
- message: "Title is required",
- },
- ],
- },
- {
- code: "description",
- dataType: "text",
- description: "Description of the content",
- editable: true,
- inputType: "textarea",
- label: "Description",
- name: "Description",
- placeholder: "Description",
- renderingHints: {
- class: "sb-g-col-lg-1 required",
- },
- required: true,
- visible: true,
- validations: [
- {
- type: "max",
- value: "200",
- message: "Input is Exceeded",
- },
- {
- type: "required",
- message: "Title is required",
- },
- ],
- },
- {
- code: "keywords",
- visible: true,
- editable: true,
- dataType: "list",
- name: "Keywords",
- renderingHints: {
- class: "sb-g-col-lg-1 required",
- },
- description: "Keywords for the content",
- inputType: "keywords",
- label: "keywords",
- placeholder: "Enter Keywords",
- required: false,
- validations: [
- {
- type: "required",
- message: "Keyword is required",
- },
- ],
- },
- ],
- },
- mcqQuestionMetaData: {
- id: "api.question.read",
- ver: "3.0",
- ts: "2022-01-31T04:38:30ZZ",
- params: {
- resmsgid: "327f9629-17b6-4b11-b15a-c60279285292",
- msgid: null,
- err: null,
- status: "successful",
- errmsg: null,
- },
- responseCode: "OK",
- result: {
- question: {
- mimeType: "application/vnd.sunbird.question",
- media: [
- {
- src: "/assets/public/content/do_1135205326975467521585/artifact/1650455654269.thumb.png",
- type: "image",
- id: "video_do_1135205326975467521585",
- baseUrl: "https://dock.sunbirded.org",
- },
- {
- id: "do_1135205326975467521585",
- src: "/assets/public/content/assets/do_1135205326975467521585/file_example_mp4_640_3mg.mp4",
- type: "video",
- assetId: "do_1135205326975467521585",
- name: "file_example_MP4_640_3MG",
- thumbnail:
- "/assets/public/content/do_1135205326975467521585/artifact/1650455654269.thumb.png",
- baseUrl: "https://dock.sunbirded.org",
- },
- ],
- editorState: {
- options: [
- {
- answer: false,
- value: {
- body: "option 1
",
- value: 0,
- },
- },
- {
- answer: false,
- value: {
- body: "option 2
",
- value: 1,
- },
- },
- {
- answer: false,
- value: {
- body: "option 3
",
- value: 2,
- },
- },
- ],
- question: "MCQ Question
",
- },
- templateId: "mcq-vertical",
- solutions: [
- {
- id: "1",
- type: "video",
- },
- ],
- interactions: {
- response1: {
- type: "choice",
- options: [
- {
- label: "option 1
",
- value: 0,
- hints: {
- en: "test hint 1",
- },
- },
- {
- label: "option 2
",
- value: 1,
- hints: {
- en: "test hint 2",
- },
- },
- {
- label: "option 3
",
- value: 2,
- hints: {
- en: "test hint 3",
- },
- },
- ],
- autoCapture: "Yes",
- validation: {
- limit:{
- maxLength:100
- },
- required: "Yes",
- pattern: "dd/mm/yyyy",
- },
- },
- },
- evidence: {
- mimeType: ["audio", "vedio"],
- },
- name: "MCQ Question",
- responseDeclaration: {
- response1: {
- maxScore: 1,
- cardinality: "multiple",
- type: "integer",
- correctResponse: {
- outcomes: {
- SCORE: 1,
- },
- },
- mapping: [
- {
- response: 0,
- outcomes: {
- score: '10'
- }
- },
- {
- response: 1,
- outcomes: {
- score: '5'
- }
- }
- ],
- },
- },
- remarks: {
- maxLength: 100,
- },
- interactionTypes: ["choice"],
- qType: "MCQ",
- primaryCategory: "Multiselect Multiple Choice Question",
- body: "",
- creator: "Vaibahv Bhuva",
- createdBy: "5a587cc1-e018-4859-a0a8-e842650b9d64",
- board: "CBSE",
- medium: ["English"],
- gradeLevel: ["Grade 1"],
- subject: ["English"],
- topic: ["Forest"],
- author: "check1@yopmail.com",
- channel: "01309282781705830427",
- framework: "nit_k-12",
- license: "CC BY 4.0",
- maxScore: "1",
- identifier: "",
- },
- },
- },
- sliderQuestionMetaData: {
- id: "api.question.read",
- ver: "3.0",
- ts: "2022-01-31T04:17:19ZZ",
- params: {
- resmsgid: "68a6ed45-a6eb-4fe3-930b-bbcefa7a4511",
- msgid: null,
- err: null,
- status: "successful",
- errmsg: null,
- },
- responseCode: "OK",
- result: {
- question: {
- mimeType: "application/vnd.sunbird.question",
- media: [],
- editorState: {
- question: "Slider Question
",
- },
- body: "Slider Question
",
- responseDeclaration: {
- response1: {
- mapping: [],
- type: "integer",
- maxScore: 1,
- },
- },
- solutions: [],
- creator: "Vaibahv Bhuva",
- createdBy: "5a587cc1-e018-4859-a0a8-e842650b9d64",
- board: "CBSE",
- medium: ["English"],
- gradeLevel: ["Grade 1"],
- subject: ["English"],
- topic: ["Forest"],
- author: "check1@yopmail.com",
- channel: "01309282781705830427",
- framework: "nit_k-12",
- license: "CC BY 4.0",
- name: "Slider Question",
- showEvidence: "Yes",
- evidence: {
- required: "No",
- mimeType: ["audio"],
- minCount: 1,
- maxCount: 1,
- sizeLimit: "20480",
- },
- showRemarks: "Yes",
- remarks: {
- maxLength: "100",
- required: "No",
- },
- interactions: {
- validation: {
- required: "Yes",
- },
- response1: {
- validation: {
- range: {
- min: "0",
- max: "10",
- },
- },
- step: "1",
- },
- },
- hints: {
- en: [null],
- },
- instructions: {
- en: [null],
- },
- interactionTypes: ["slider"],
- primaryCategory: "Slider",
- },
- },
- },
- dateQuestionMetaDate: {
- id: "api.question.read",
- ver: "3.0",
- ts: "2022-01-31T04:21:32ZZ",
- params: {
- resmsgid: "10091336-fd86-49bd-8505-2d67e3ce9241",
- msgid: null,
- err: null,
- status: "successful",
- errmsg: null,
- },
- responseCode: "OK",
- result: {
- question: {
- mimeType: "application/vnd.sunbird.question",
- media: [],
- editorState: {
- question: "Child Date Question
",
- },
- body: "Child Date Question
",
- responseDeclaration: {
- response1: {
- type: "string",
- },
- },
- solutions: [],
- creator: "Vaibahv Bhuva",
- createdBy: "5a587cc1-e018-4859-a0a8-e842650b9d64",
- board: "CBSE",
- medium: ["English"],
- gradeLevel: ["Grade 1"],
- subject: ["English"],
- topic: ["Forest"],
- author: "check1@yopmail.com",
- channel: "01309282781705830427",
- framework: "nit_k-12",
- license: "CC BY 4.0",
- name: "Child Date Question",
- interactions: {
- validation: {
- required: "Yes",
- },
- response1: {
- validation: {
- pattern: "DD/MM/YYYY",
- },
- autoCapture: "Yes",
- },
- },
- hints: {
- en: [null],
- },
- instructions: {
- en: [null],
- },
- interactionTypes: ["date"],
- primaryCategory: "Date",
- },
- },
- },
- textQuestionNetaData: {
- id: "api.question.read",
- ver: "3.0",
- ts: "2022-01-31T04:22:24ZZ",
- params: {
- resmsgid: "a536133f-822e-4533-a57c-5558ef65297d",
- msgid: null,
- err: null,
- status: "successful",
- errmsg: null,
- },
- responseCode: "OK",
- result: {
- question: {
- mimeType: "application/vnd.sunbird.question",
- media: [],
- editorState: {
- question: "Text Question
",
- },
- body: "Text Question
",
- responseDeclaration: {
- response1: {
- mapping: [],
- type: "string",
- maxScore: 1,
- },
- },
- solutions: [],
- creator: "Vaibahv Bhuva",
- createdBy: "5a587cc1-e018-4859-a0a8-e842650b9d64",
- board: "CBSE",
- medium: ["English"],
- gradeLevel: ["Grade 1"],
- subject: ["English"],
- topic: ["Forest"],
- author: "check1@yopmail.com",
- channel: "01309282781705830427",
- framework: "nit_k-12",
- license: "CC BY 4.0",
- name: "Text Question",
- showEvidence: "No",
- showRemarks: "No",
- interactions: {
- validation: {
- required: "Yes",
- },
- response1: {
- validation: {
- limit: {
- maxLength: "100",
- },
- },
- type: {
- number: "Yes",
- },
- },
- },
- hints: {
- en: [null],
- },
- instructions: {
- en: [null],
- },
- interactionTypes: ["text"],
- primaryCategory: "Text",
- },
- },
- },
- defaultQuestionMetaData: {
- id: "api.question.read",
- ver: "3.0",
- ts: "2022-01-31T04:22:24ZZ",
- params: {
- resmsgid: "a536133f-822e-4533-a57c-5558ef65297d",
- msgid: null,
- err: null,
- status: "successful",
- errmsg: null,
- },
- responseCode: "OK",
- result: {
- question: {
- instructions: {
- en: [null],
- },
- responseDeclaration: {
- response1: {
- type: "string",
- maxScore: 1,
- },
- },
- mimeType: "application/vnd.sunbird.question",
- media: [],
- body: "child Text Question
",
- editorState: {
- question: "child Text Question
",
- },
- interactions: {
- validation: {
- required: "Yes",
- },
- response1: {},
- },
- primaryCategory: "Default",
- showRemarks: "Yes",
- remarksLimit: "20",
- identifier: "do_11345671149997260811",
- solutions: [],
- hints: {
- en: [null],
- },
- languageCode: ["en"],
- interactionTypes: "",
- name: "child Text Question",
- },
- },
- },
- childMetadataUpdated: {
- templateName: "",
- required: [],
- properties: [
- {
- code: "name",
- dataType: "text",
- description: "Name of the content",
- editable: false,
- inputType: "text",
- label: "Title",
- name: "Title",
- placeholder: "Title",
- renderingHints: {
- class: "sb-g-col-lg-1 required",
- },
- required: true,
- visible: true,
- validations: [
- {
- type: "max",
- value: "120",
- message: "Input is Exceeded",
- },
- {
- type: "required",
- message: "Title is required",
- },
- ],
- },
- {
- code: "description",
- dataType: "text",
- description: "Description of the content",
- editable: false,
- inputType: "textarea",
- label: "Description",
- name: "Description",
- placeholder: "Description",
- renderingHints: {
- class: "sb-g-col-lg-1 required",
- },
- required: true,
- visible: true,
- validations: [
- {
- type: "max",
- value: "200",
- message: "Input is Exceeded",
- },
- {
- type: "required",
- message: "Title is required",
- },
- ],
- },
- {
- code: "board",
- default: "",
- visible: true,
- depends: [],
- editable: true,
- dataType: "text",
- renderingHints: {
- class: "sb-g-col-lg-1",
- },
- description: "Board",
- label: "Board/Syllabus",
- required: false,
- name: "Board/Syllabus",
- inputType: "select",
- placeholder: "Select Board/Syllabus",
- },
- {
- code: "keywords",
- visible: true,
- editable: false,
- dataType: "list",
- name: "Keywords",
- renderingHints: {
- class: "sb-g-col-lg-1 required",
- },
- description: "Keywords for the content",
- inputType: "keywords",
- label: "keywords",
- placeholder: "Enter Keywords",
- required: false,
- validations: [
- {
- type: "required",
- message: "Keyword is required",
- },
- ],
- },
- ],
- },
- formData: {
- numberOnly: "yes",
- name: "description",
- },
- frameWorkDetails: {
- frameworkData: [
- {
- identifier: "ekstep_ncert_k-12_board",
- code: "board",
- terms: [
- {
- associations: [
- {
- identifier:
- "ekstep_ncert_k-12_learningoutcome_9686a2a712bdfdb43408555865cda57f2367699a",
- code: "9686a2a712bdfdb43408555865cda57f2367699a",
- translations: null,
- name: "Inequalities in a triangle.",
- description: "Inequalities in a triangle.",
- index: 0,
- category: "learningoutcome",
- status: "Live",
- },
- {
- identifier:
- "ekstep_ncert_k-12_topic_08859db5d07d93b99c12b3e5bceb975c582d31b7",
- code: "08859db5d07d93b99c12b3e5bceb975c582d31b7",
- translations: null,
- name: "Nature around the kids",
- description: "Nature around the kids",
- index: 0,
- category: "topic",
- status: "Live",
- },
- ],
- identifier: "ekstep_ncert_k-12_board_cbse",
- code: "cbse",
- translations: null,
- name: "CBSE",
- description: "CBSE",
- index: 10,
- category: "board",
- status: "Live",
- },
- ],
- translations: null,
- name: "Board",
- description: "Board",
- index: 1,
- status: "Live",
- },
- ],
- topicList: [
- {
- identifier:
- "ekstep_ncert_k-12_topic_08859db5d07d93b99c12b3e5bceb975c582d31b7",
- code: "08859db5d07d93b99c12b3e5bceb975c582d31b7",
- translations: null,
- name: "Nature around the kids",
- description: "Nature around the kids",
- index: 10,
- category: "topic",
- status: "Live",
- },
- ],
- },
- editorState: {
- body: {
- answer: " Yes",
- question: "Hi how are you ?
",
- editorState: {
- answer: " Yes",
- },
- name: "Subjective Question",
- qType: "SA",
- primaryCategory: "Subjective Question",
- responseDeclaration: {
- response1: {
- mapping: [],
- },
- },
- },
- mediaobj: {},
- },
- eventData: {
- body: { answer: "dad
" },
- editorState: { answer: "dad
" },
- name: "Subjective Question",
- qType: "SA",
- primaryCategory: "Subjective Question",
- mediaobj: undefined,
- },
- subMenus: [
- {
- id: "addHint",
- name: "Add Hint",
- value: "",
- enabled: false,
- type: "input",
- label: "label",
- show: true,
- },
- {
- id: "addTip",
- name: "Add Tip",
- value: "",
- enabled: false,
- type: "input",
- label: "label",
- show: true,
- },
- {
- id: "addDependantQuestion",
- name: "Add Dependant Question",
- value: [{ id: 1 }],
- enabled: false,
- type: "",
- label: "label",
- show: true,
- },
- ],
-};
-
-export const readQuestionMock = {
- id: "api.question.read",
- ver: "3.0",
- ts: "2021-09-30T09:18:52ZZ",
- params: {
- resmsgid: "04f55276-8ddc-4a23-a52e-a188e2ef5c2c",
- msgid: null,
- err: null,
- status: "successful",
- errmsg: null,
- },
- responseCode: "OK",
- result: {
- question: {
- instructions: {
- en: [null],
- },
- showRemarks: "No",
- responseDeclaration: {
- response1: {
- maxScore: 1,
- cardinality: "multiple",
- type: "integer",
- correctResponse: {
- outcomes: {
- SCORE: 1,
- },
- },
- mapping: [],
- },
- },
- mimeType: "application/vnd.sunbird.question",
- media: [],
- body: "",
- editorState: {
- options: [
- {
- answer: false,
- value: {
- body: "false
",
- value: 0,
- },
- },
- {
- answer: false,
- value: {
- body: "true
",
- value: 1,
- },
- },
- ],
- question: "MCQ Question 3
",
- },
- templateId: "mcq-vertical",
- interactions: {
- response1: {
- type: "choice",
- options: [
- {
- label: "false
",
- value: 0,
- },
- {
- label: "true
",
- value: 1,
- },
- ],
- },
- validation: {
- required: "Yes",
- },
- },
- primaryCategory: "Multiselect Multiple Choice Question",
- identifier: "do_1134355569264885761166",
- solutions: [],
- hints: {
- en: [null],
- },
- qType: "MCQ",
- languageCode: ["en"],
- interactionTypes: ["choice"],
- name: "MCQ Question 3",
- showEvidence: "No",
- },
- },
-};
-
-export const readQuestionMockSlider = {
- id: "api.question.read",
- ver: "3.0",
- ts: "2021-09-30T09:18:52ZZ",
- params: {
- resmsgid: "04f55276-8ddc-4a23-a52e-a188e2ef5c2c",
- msgid: null,
- err: null,
- status: "successful",
- errmsg: null,
- },
- responseCode: "OK",
- result: {
- question: {
- instructions: {
- en: [null],
- },
- showRemarks: "No",
- mimeType: "application/vnd.sunbird.question",
- media: [],
- body: "Dep Slider 3
",
- editorState: {
- question: "Dep Slider 3
",
- },
- interactions: {
- validation: {
- required: "Yes",
- },
- response1: {
- validation: {
- range: {
- min: "0",
- max: "10",
- },
- },
- step: "1",
- },
- },
- primaryCategory: "Slider",
- identifier: "do_1134355571590184961168",
- solutions: [],
- hints: {
- en: [null],
- },
- languageCode: ["en"],
- interactionTypes: ["slider"],
- name: "Dep Slider 3",
- showEvidence: "No",
- },
- },
-};
-
-export const readQuestionMockDate = {
- id: "api.question.read",
- ver: "3.0",
- ts: "2021-09-30T09:18:52ZZ",
- params: {
- resmsgid: "04f55276-8ddc-4a23-a52e-a188e2ef5c2c",
- msgid: null,
- err: null,
- status: "successful",
- errmsg: null,
- },
- responseCode: "OK",
- result: {
- question: {
- instructions: {
- en: [null],
- },
- mimeType: "application/vnd.sunbird.question",
- media: [],
- body: "Dep Date 3
",
- editorState: {
- question: "Dep Date 3
",
- },
- interactions: {
- validation: {
- required: "Yes",
- },
- response1: {
- validation: {
- pattern: "DD/MM/YYYY",
- },
- autoCapture: "Yes",
- },
- },
- primaryCategory: "Date",
- identifier: "do_1134355574936780801170",
- solutions: [],
- hints: {
- en: [null],
- },
- languageCode: ["en"],
- interactionTypes: ["date"],
- name: "Dep Date 3",
- },
- },
-};
-
-export const readQuestionMockText = {
- id: "api.question.read",
- ver: "3.0",
- ts: "2021-09-30T09:18:52ZZ",
- params: {
- resmsgid: "04f55276-8ddc-4a23-a52e-a188e2ef5c2c",
- msgid: null,
- err: null,
- status: "successful",
- errmsg: null,
- },
- responseCode: "OK",
- result: {
- question: {
- instructions: {
- en: [null],
- },
- showRemarks: "No",
- mimeType: "application/vnd.sunbird.question",
- media: [],
- body: "Dep Text 2
",
- editorState: {
- question: "Dep Text 2
",
- },
- interactions: {
- validation: {
- required: "Yes",
- },
- response1: {
- validation: {
- limit: {
- maxLength: "100",
- },
- },
- type: {
- number: "Yes",
- },
- },
- },
- primaryCategory: "Text",
- identifier: "do_1134347722012835841130",
- solutions: [],
- hints: {
- en: [null],
- },
- languageCode: ["en"],
- interactionTypes: ["text"],
- name: "Dep Text 2",
- showEvidence: "No",
- },
- },
-};
-
-export const collectionHierarchyMock = {
- id: "api.questionset.hierarchy.get",
- params: {
- resmsgid: "61a32bae-ba2f-4779-aa27-1428c6b70f8c",
- msgid: null,
- err: null,
- status: "successful",
- errmsg: null,
- },
- responseCode: "OK",
- result: {
- questionSet: {
- acceptedContributions: [
- "do_11326368076523929623",
- "do_11326368076523929635",
- ],
- rejectedContributions: [
- "do_11326368076523929647",
- "do_11326368076523929659",
- ],
- rejectedContributionComments: {
- do_11326368076523929647: "test comment 1",
- do_11326368076523929659: "test comment 2",
- },
- organisationId: "937dd865-b256-4c1a-9830-a9b5b89f0913",
- keywords: ["test"],
- subject: ["English"],
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- ecm: [
- "Student interview",
- "Teacher interview",
- "Parent interview",
- "HM/HT interview",
- ],
- objectType: "QuestionSet",
- gradeLevel: ["Grade 1"],
- primaryCategory: "Observation With Rubrics",
- children: [
- {
- parent: "do_1134357224765685761203",
- code: "a51c0d9f-4696-3354-062f-b2078048656c",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.118+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- children: [
- {
- parent: "do_1134460323603906561218",
- code: "b4c3e613-5c3f-9c8b-d61f-417f4c5d8df2",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- branchingLogic: {
- do_113449775832088576181: {
- target: [],
- source: ["do_113449672558780416163"],
- preCondition: {
- and: [
- {
- eq: [
- {
- var: "do_113449672558780416163.response1.value",
- type: "responseDeclaration",
- },
- [0],
- ],
- },
- ],
- },
- },
- do_113449787008081920183: {
- target: [],
- source: ["do_113449672558780416163"],
- preCondition: {
- and: [
- {
- ne: [
- {
- var: "do_113449672558780416163.response1.value",
- type: "responseDeclaration",
- },
- [1],
- ],
- },
- ],
- },
- },
- do_11345671149997260811: {
- target: [],
- source: ["do_113449672558780416163"],
- preCondition: {
- and: [
- {
- eq: [
- {
- var: "do_113449672558780416163.response1.value",
- type: "responseDeclaration",
- },
- [0],
- ],
- },
- ],
- },
- },
- do_113449808985628672185: {
- target: [],
- source: ["do_113449672558780416163"],
- preCondition: {
- and: [
- {
- eq: [
- {
- var: "do_113449672558780416163.response1.value",
- type: "responseDeclaration",
- },
- [0],
- ],
- },
- ],
- },
- },
- do_113449672558780416163: {
- target: [
- "do_113449775832088576181",
- "do_113449787008081920183",
- "do_113449808985628672185",
- "do_11345671149997260811",
- ],
- preCondition: {},
- source: [],
- },
- },
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.106+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- children: [
- {
- parent: "do_1134460323602841601200",
- code: "d0ab14ae-9f67-41cf-dcfa-80c8432bf424",
- evidence: {
- required: "No",
- mimeType: ["audio"],
- minCount: 1,
- maxCount: 1,
- sizeLimit: "20480",
- },
- subject: ["English"],
- showRemarks: "No",
- channel: "01309282781705830427",
- language: ["English"],
- medium: ["English"],
- mimeType: "application/vnd.sunbird.question",
- templateId: "mcq-vertical",
- createdOn: "2022-01-10T09:08:52.273+0000",
- objectType: "Question",
- gradeLevel: ["Grade 1"],
- primaryCategory: "Multiselect Multiple Choice Question",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-20T07:49:01.518+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_113449672558780416163",
- lastStatusChangedOn: "2022-01-10T09:08:52.273+0000",
- visibility: "Parent",
- showTimer: "No",
- author: "check1@yopmail.com",
- index: 1,
- qType: "MCQ",
- languageCode: ["en"],
- version: 1,
- versionKey: "1642664941814",
- showFeedback: "No",
- license: "CC BY 4.0",
- interactionTypes: ["choice"],
- framework: "tpd",
- depth: 3,
- createdBy: "5a587cc1-e018-4859-a0a8-e842650b9d64",
- compatibilityLevel: 4,
- name: "Parent Question MCQ",
- topic: ["Forest"],
- board: "CBSE",
- status: "Draft",
- showEvidence: "Yes",
- },
- {
- parent: "do_1134460323602841601200",
- code: "c03eddbf-8194-ce67-3f49-08c4b5b33e55",
- subject: ["English"],
- showRemarks: "No",
- channel: "01309282781705830427",
- language: ["English"],
- medium: ["English"],
- mimeType: "application/vnd.sunbird.question",
- createdOn: "2022-01-20T07:49:38.034+0000",
- objectType: "Question",
- gradeLevel: ["Grade 1"],
- primaryCategory: "Text",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-20T07:49:38.023+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_11345671149997260811",
- lastStatusChangedOn: "2022-01-20T07:49:38.034+0000",
- creator: "Vaibahv Bhuva",
- visibility: "Parent",
- showTimer: "No",
- author: "check1@yopmail.com",
- index: 2,
- languageCode: ["en"],
- version: 1,
- versionKey: "1642664978234",
- showFeedback: "No",
- license: "CC BY 4.0",
- interactionTypes: ["text"],
- framework: "tpd",
- depth: 3,
- createdBy: "5a587cc1-e018-4859-a0a8-e842650b9d64",
- compatibilityLevel: 4,
- name: "child Text Question",
- topic: ["Forest"],
- board: "CBSE",
- status: "Draft",
- showEvidence: "No",
- },
- {
- parent: "do_1134460323602841601200",
- code: "10cf6d1b-ba3d-2925-1d13-032aa3d2d317",
- subject: ["English"],
- channel: "01309282781705830427",
- language: ["English"],
- medium: ["English"],
- mimeType: "application/vnd.sunbird.question",
- createdOn: "2022-01-10T13:46:25.941+0000",
- objectType: "Question",
- gradeLevel: ["Grade 1"],
- primaryCategory: "Date",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-10T13:46:25.941+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_113449808985628672185",
- lastStatusChangedOn: "2022-01-10T13:46:25.941+0000",
- creator: "Vaibahv Bhuva",
- visibility: "Parent",
- showTimer: "No",
- author: "check1@yopmail.com",
- index: 3,
- languageCode: ["en"],
- version: 1,
- versionKey: "1641822385942",
- showFeedback: "No",
- license: "CC BY 4.0",
- interactionTypes: ["date"],
- framework: "tpd",
- depth: 3,
- createdBy: "5a587cc1-e018-4859-a0a8-e842650b9d64",
- compatibilityLevel: 4,
- name: "Child Date 1",
- topic: ["Forest"],
- board: "CBSE",
- status: "Draft",
- },
- {
- parent: "do_1134460323602841601200",
- code: "5403efd9-064e-89af-8f44-a9b10c80291c",
- subject: ["English"],
- showRemarks: "No",
- channel: "01309282781705830427",
- language: ["English"],
- medium: ["English"],
- mimeType: "application/vnd.sunbird.question",
- createdOn: "2022-01-10T12:38:58.878+0000",
- objectType: "Question",
- gradeLevel: ["Grade 1"],
- primaryCategory: "Slider",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-10T12:38:58.878+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_113449775832088576181",
- lastStatusChangedOn: "2022-01-10T12:38:58.878+0000",
- creator: "Vaibahv Bhuva",
- visibility: "Parent",
- showTimer: "No",
- author: "check1@yopmail.com",
- index: 4,
- languageCode: ["en"],
- version: 1,
- versionKey: "1641818338879",
- showFeedback: "No",
- license: "CC BY 4.0",
- interactionTypes: ["slider"],
- framework: "tpd",
- depth: 3,
- createdBy: "5a587cc1-e018-4859-a0a8-e842650b9d64",
- compatibilityLevel: 4,
- name: "test slider 2",
- topic: ["Forest"],
- board: "CBSE",
- status: "Draft",
- showEvidence: "No",
- },
- {
- parent: "do_1134460323602841601200",
- code: "4395c049-8ba7-c611-6334-8bee3f02fa27",
- subject: ["English"],
- showRemarks: "No",
- channel: "01309282781705830427",
- language: ["English"],
- medium: ["English"],
- mimeType: "application/vnd.sunbird.question",
- createdOn: "2022-01-10T13:01:43.135+0000",
- objectType: "Question",
- gradeLevel: ["Grade 1"],
- primaryCategory: "Slider",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-10T13:01:43.135+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_113449787008081920183",
- lastStatusChangedOn: "2022-01-10T13:01:43.135+0000",
- creator: "Vaibahv Bhuva",
- visibility: "Parent",
- showTimer: "No",
- author: "check1@yopmail.com",
- index: 5,
- languageCode: ["en"],
- version: 1,
- versionKey: "1641819703136",
- showFeedback: "No",
- license: "CC BY 4.0",
- interactionTypes: ["slider"],
- framework: "tpd",
- depth: 3,
- createdBy: "5a587cc1-e018-4859-a0a8-e842650b9d64",
- compatibilityLevel: 4,
- name: "test slider 4",
- topic: ["Forest"],
- board: "CBSE",
- status: "Draft",
- showEvidence: "No",
- },
- ],
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-20T07:49:38.234+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323602841601200",
- lastStatusChangedOn: "2022-01-05T05:42:52.106+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 1,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372106",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Chemistry",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134460323603906561218",
- code: "bfdac63e-4cd1-c9fe-00a0-be98f73e13d8",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- branchingLogic: {},
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.131+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-10T13:09:04.092+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323604971521236",
- lastStatusChangedOn: "2022-01-05T05:42:52.131+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 2,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372131",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Biology",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134460323603906561218",
- code: "9916f5fc-4f37-3f8e-5151-b32ce65217da",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.114+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.114+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323603578881212",
- lastStatusChangedOn: "2022-01-05T05:42:52.114+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 3,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372114",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "General Science",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- ],
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-12T08:37:51.019+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323603906561218",
- lastStatusChangedOn: "2022-01-05T05:42:52.118+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 1,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372118",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 1,
- compatibilityLevel: 5,
- name: "Science",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134357224765685761203",
- code: "36b6e0bd-ef9e-9fd1-5092-257c8e6af0a9",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.190+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- children: [
- {
- parent: "do_1134460323609804801240",
- code: "fd63a953-d9c1-cb14-df75-5918afb4b4b0",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.110+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-12T08:37:51.018+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323603251201206",
- lastStatusChangedOn: "2022-01-05T05:42:52.110+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 1,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372110",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "History",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134460323609804801240",
- code: "de1454cf-bfa9-faa5-8a71-cf7954e9f95b",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.100+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.100+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323602432001194",
- lastStatusChangedOn: "2022-01-05T05:42:52.100+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 2,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372100",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Political Science",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134460323609804801240",
- code: "916893b4-816f-9613-1456-bea7da40c4ef",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.195+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.195+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323610214401248",
- lastStatusChangedOn: "2022-01-05T05:42:52.195+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 3,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372195",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Geography",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134460323609804801240",
- code: "0c34d378-77e9-db88-589a-7695edcf1d70",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.094+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.094+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323601940481186",
- lastStatusChangedOn: "2022-01-05T05:42:52.094+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 4,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372094",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Sociology",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134460323609804801240",
- code: "cca8fe66-b7e9-c3cb-a226-b5f96e10dfe9",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.126+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.126+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323604561921228",
- lastStatusChangedOn: "2022-01-05T05:42:52.126+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 5,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372126",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Social Studies",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134460323609804801240",
- code: "cedcdd78-2950-e8d7-fa17-f57e67a349b9",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.128+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.128+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323604725761232",
- lastStatusChangedOn: "2022-01-05T05:42:52.128+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 6,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372128",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Environmental Studies",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- ],
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-12T08:37:51.019+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323609804801240",
- lastStatusChangedOn: "2022-01-05T05:42:52.190+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 2,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372190",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 1,
- compatibilityLevel: 5,
- name: "Social Science",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134357224765685761203",
- code: "19589d40-f25d-5204-bfba-9a331c1d22f1",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.191+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- children: [
- {
- parent: "do_1134460323609886721242",
- code: "4be73894-ace8-f9f8-9e22-206ae1854782",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.091+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.090+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323601612801182",
- lastStatusChangedOn: "2022-01-05T05:42:52.091+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 1,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372091",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Telugu",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134460323609886721242",
- code: "35ee819a-8906-eace-1a62-9d296ba7b23a",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.192+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.192+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323609968641244",
- lastStatusChangedOn: "2022-01-05T05:42:52.192+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 2,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372192",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "English",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134460323609886721242",
- code: "4bf42318-fb09-6384-fb3a-67a3b942126a",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.193+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.193+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323610050561246",
- lastStatusChangedOn: "2022-01-05T05:42:52.193+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 3,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372193",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Assamese",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134460323609886721242",
- code: "77161a93-5be9-5548-cc95-9033fddc882b",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.120+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.120+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323604070401220",
- lastStatusChangedOn: "2022-01-05T05:42:52.120+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 4,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372120",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Sanskrit",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134460323609886721242",
- code: "924bdaa8-25a5-286b-2dfd-ae3160754e0f",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.108+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.107+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323603087361202",
- lastStatusChangedOn: "2022-01-05T05:42:52.108+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 5,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372108",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Hindi",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- ],
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-12T08:37:51.018+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323609886721242",
- lastStatusChangedOn: "2022-01-05T05:42:52.191+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 3,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372191",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 1,
- compatibilityLevel: 5,
- name: "Language",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134357224765685761203",
- code: "a8c0c30c-71b9-1f28-0f28-78c92502b458",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.115+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- children: [
- {
- parent: "do_1134460323603660801214",
- code: "8ab5c31d-52b7-cf4b-fc19-5ef5f972b482",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.092+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.092+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323601776641184",
- lastStatusChangedOn: "2022-01-05T05:42:52.093+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 1,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372092",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Physical Education",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134460323603660801214",
- code: "fe79e53a-600a-347a-1627-1333edce33df",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.125+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.124+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323604398081226",
- lastStatusChangedOn: "2022-01-05T05:42:52.125+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 2,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372125",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Economics",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134460323603660801214",
- code: "3901dd2a-a60a-fc5b-8a4c-728cb67f78d3",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.122+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.121+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323604234241222",
- lastStatusChangedOn: "2022-01-05T05:42:52.122+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 3,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372122",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Mathematics",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- ],
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-12T08:37:51.018+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323603660801214",
- lastStatusChangedOn: "2022-01-05T05:42:52.115+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 4,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372115",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 1,
- compatibilityLevel: 5,
- name: "Other Curriculum Subjects",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134357224765685761203",
- code: "de3bb487-8417-f8a4-04d3-802f3bab8e4c",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.113+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- children: [
- {
- parent: "do_1134460323603496961210",
- code: "4b99fa00-448d-9790-4ce9-c53215ad3ca9",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.123+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.123+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323604316161224",
- lastStatusChangedOn: "2022-01-05T05:42:52.123+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 1,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372123",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Pedagogy",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134460323603496961210",
- code: "7d84bdba-9856-63f5-26c6-c40d0ee05fc4",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.129+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.129+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323604807681234",
- lastStatusChangedOn: "2022-01-05T05:42:52.129+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 2,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372129",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Classroom Management",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134460323603496961210",
- code: "65da6804-99b9-e7ee-80db-522b0256ed45",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.095+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.095+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323602022401188",
- lastStatusChangedOn: "2022-01-05T05:42:52.095+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 3,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372095",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Child Management",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- ],
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-12T08:37:51.018+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323603496961210",
- lastStatusChangedOn: "2022-01-05T05:42:52.113+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 5,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372113",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 1,
- compatibilityLevel: 5,
- name: "Teaching and Classroom Management",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134357224765685761203",
- code: "40153827-6fc2-694a-4785-15f1170b9ec8",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.112+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- children: [
- {
- parent: "do_1134460323603415041208",
- code: "da305492-32e3-c498-4397-a9365d525171",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.127+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.127+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323604643841230",
- lastStatusChangedOn: "2022-01-05T05:42:52.127+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 1,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372127",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "ICT",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- ],
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-12T08:37:51.018+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323603415041208",
- lastStatusChangedOn: "2022-01-05T05:42:52.112+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 6,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372112",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 1,
- compatibilityLevel: 5,
- name: "ICT",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134357224765685761203",
- code: "318b9fb5-2020-e9ce-b1d7-99ba646c9dfc",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.132+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- children: [
- {
- parent: "do_1134460323605053441238",
- code: "8b045060-400c-ff62-e88e-1567d300a912",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.109+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.109+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323603169281204",
- lastStatusChangedOn: "2022-01-05T05:42:52.109+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 1,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372109",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Leadership Management",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- ],
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-12T08:37:51.019+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323605053441238",
- lastStatusChangedOn: "2022-01-05T05:42:52.132+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 7,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372132",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 1,
- compatibilityLevel: 5,
- name: "Leadership Management",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134357224765685761203",
- code: "099a65b6-7456-621c-1cb3-a073e2b4ccc0",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.101+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- children: [
- {
- parent: "do_1134460323602513921196",
- code: "b5ccdaed-a685-5d7e-2b5b-92ddd13b11bb",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.097+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.096+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323602186241190",
- lastStatusChangedOn: "2022-01-05T05:42:52.097+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 1,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372097",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Health Education",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- ],
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-12T08:37:51.019+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323602513921196",
- lastStatusChangedOn: "2022-01-05T05:42:52.101+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 8,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372101",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 1,
- compatibilityLevel: 5,
- name: "Health Education",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134357224765685761203",
- code: "d1ea15c0-812b-b05d-74ef-57016243e081",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.098+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- children: [
- {
- parent: "do_1134460323602268161192",
- code: "677a3586-36fe-17d7-be06-4972084bff07",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.103+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.103+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323602677761198",
- lastStatusChangedOn: "2022-01-05T05:42:52.103+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 1,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372103",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Personal Development",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- ],
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-12T08:37:51.019+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323602268161192",
- lastStatusChangedOn: "2022-01-05T05:42:52.098+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 9,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372098",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 1,
- compatibilityLevel: 5,
- name: "Personal Development",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134357224765685761203",
- code: "19f41337-ac33-4028-095c-1f602da77698",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.117+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.117+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323603824641216",
- lastStatusChangedOn: "2022-01-05T05:42:52.117+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 10,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372117",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 1,
- compatibilityLevel: 5,
- name: "Physics",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- ],
- contentEncoding: "gzip",
- secondaryLanguage: ["English"],
- showSolutions: "No",
- identifier: "do_1134357224765685761203",
- subjectIds: ["nit_k-12_subject_english"],
- visibility: "Default",
- showTimer: "No",
- author: "check1@yopmail.com",
- entityType: "Cluster",
- consumerId: "fa13b438-8a3d-41b1-8278-33b0c50210e4",
- childNodes: [
- "do_1134460323601776641184",
- "do_1134460323603660801214",
- "do_1134460323604398081226",
- "do_1134460323604234241222",
- "do_1134460323603251201206",
- "do_1134460323609804801240",
- "do_1134460323601940481186",
- "do_1134460323602432001194",
- "do_1134460323610214401248",
- "do_1134460323604725761232",
- "do_1134460323604561921228",
- "do_1134460323610050561246",
- "do_1134460323609886721242",
- "do_1134460323601612801182",
- "do_1134460323609968641244",
- "do_1134460323604070401220",
- "do_1134460323603087361202",
- "do_1134460323602677761198",
- "do_1134460323602268161192",
- "do_1134460323602186241190",
- "do_1134460323602513921196",
- "do_1134460323604643841230",
- "do_1134460323603415041208",
- "do_1134460323603824641216",
- "do_1134460323604316161224",
- "do_1134460323603496961210",
- "do_1134460323604807681234",
- "do_1134460323602022401188",
- "do_113449775832088576181",
- "do_1134460323602841601200",
- "do_1134460323603906561218",
- "do_113449787008081920183",
- "do_11345671149997260811",
- "do_113449808985628672185",
- "do_113449672558780416163",
- "do_1134460323604971521236",
- "do_1134460323603578881212",
- "do_1134460323603169281204",
- "do_1134460323605053441238",
- ],
- maxScore: 4,
- languageCode: ["en"],
- version: 1,
- license: "CC BY 4.0",
- name: "Observation",
- allowBranching: "Yes",
- mediumIds: ["nit_k-12_medium_english"],
- status: "Draft",
- code: "6510727b-91ac-0ec6-48cb-0ea74ee7300d",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- description: "test",
- medium: ["English"],
- createdOn: "2021-12-21T16:07:21.382+0000",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-20T07:49:38.722+0000",
- allowAnonymousAccess: "Yes",
- lastStatusChangedOn: "2021-12-21T16:07:21.382+0000",
- creator: "check1@yopmail.com",
- requiresSubmit: "No",
- setType: "materialised",
- versionKey: "1642664978722",
- showFeedback: "No",
- recordedBy: "External",
- framework: "tpd",
- depth: 0,
- boardIds: ["nit_k-12_board_cbse"],
- createdBy: "4e397c42-495e-4fdb-8558-f98176230916",
- compatibilityLevel: 5,
- navigationMode: "non-linear",
- shuffle: true,
- gradeLevelIds: ["nit_k-12_gradelevel_grade-1"],
- board: "CBSE",
- programId: "ab75b870-6274-11ec-874d-3de2a8c29d94",
- },
- },
- ts: "2022-01-25T07:35:10ZZ",
- ver: "3.0",
-};
-
-export const sourcingSettingsMock = {
- enforceCorrectAnswer: false,
- showSolution: false,
- showAddHints: true,
- showAddScore: false,
- showAddTips: true,
- showAddTranslation: true,
- showAddSecondaryQuestion: false,
-};
-
-export const leafFormConfigMock = [
- {
- code: "name",
- dataType: "text",
- description: "Name of the content",
- editable: true,
- inputType: "text",
- label: "Title",
- name: "Title",
- placeholder: "Title",
- renderingHints: {
- class: "sb-g-col-lg-1 required",
- },
- required: true,
- visible: true,
- validations: [
- {
- type: "max",
- value: "100",
- message: "Input is Exceeded",
- },
- {
- type: "required",
- message: "Title is required",
- },
- ],
- default: "test",
- },
- {
- code: "allowMultiSelect",
- dataType: "text",
- description: "allowMultiSelect",
- editable: true,
- index: 5,
- default: "Yes",
- inputType: "checkbox",
- label: "Allow Multi Select",
- name: "allowMultiSelect",
- placeholder: "allowMultiSelect",
- renderingHints: {
- class: "sb-g-col-lg-1",
- },
- required: false,
- visible: true,
- },
- {
- code: "showEvidence",
- dataType: "text",
- description: "Allow Evidence",
- editable: true,
- index: 5,
- default: "Yes",
- inputType: "checkbox",
- label: "Allow Evidence",
- name: "showEvidence",
- placeholder: "showEvidence",
- renderingHints: {
- class: "sb-g-col-lg-1",
- },
- required: false,
- visible: true,
- },
- {
- code: "evidenceMimeType",
- dataType: "list",
- depends: ["showEvidence"],
- description: "Evidence",
- editable: true,
- inputType: "multiselect",
- label: "evidence",
- name: "evidenceMimeType",
- placeholder: "evidence",
- renderingHints: {
- class: "sb-g-col-lg-1",
- },
- required: false,
- visible: true,
- range: null,
- },
- {
- code: "showRemarks",
- dataType: "text",
- description: "Allow Remarks",
- editable: false,
- index: 5,
- inputType: "checkbox",
- label: "Allow Remarks",
- name: "showRemarks",
- placeholder: "showRemarks",
- renderingHints: {
- class: "sb-g-col-lg-1",
- },
- required: false,
- visible: true,
- },
- {
- code: "remarksLimit",
- dataType: "text",
- description: "Remark limit",
- depends: ["showRemarks"],
- editable: false,
- inputType: "text",
- label: "Remark limit",
- name: "remarksLimit",
- placeholder: "Add limit",
- renderingHints: {
- class: "sb-g-col-lg-1",
- },
- required: false,
- visible: true,
- },
- {
- code: "markAsNotMandatory",
- dataType: "text",
- description: "markAsNotMandatory",
- editable: true,
- index: 5,
- inputType: "checkbox",
- label: "Mark As Not Mandatory",
- name: "markAsNotMandatory",
- placeholder: "markAsNotMandatory",
- renderingHints: {
- class: "sb-g-col-lg-1",
- },
- required: false,
- visible: true,
- default: "No",
- },
- {
- code: "maxScore",
- dataType: "text",
- description: "Marks",
- editable: true,
- inputType: "text",
- default: "",
- label: "Marks:",
- name: "Marks",
- placeholder: "Marks",
- tooltip: "Provide marks of this question.",
- renderingHints: {
- class: "sb-g-col-lg-1 required",
- },
- validations: [
- {
- type: "pattern",
- value: "^([1-9][0-9]+|[1-9])$",
- message: "Input should be numeric",
- },
- {
- type: "required",
- message: "Marks is required",
- },
- ],
- },
- {
- code: "dateFormat",
- dataType: "text",
- description: "Select format",
- editable: true,
- index: 5,
- inputType: "select",
- label: "Select format",
- name: "dateFormat",
- placeholder: "Select format",
- renderingHints: {
- class: "sb-g-col-lg-1 required",
- },
- required: true,
- visible: true,
- range: ["DD/MM/YYYY", "YYYY/MM/DD"],
- validations: [
- {
- type: "required",
- message: "Format is required",
- },
- ],
- },
- {
- code: "autoCapture",
- dataType: "text",
- description: "Auto capture",
- editable: true,
- index: 5,
- inputType: "checkbox",
- label: "Auto capture",
- name: "autoCapture",
- placeholder: "Auto capture",
- renderingHints: {
- class: "sb-g-col-lg-1",
- },
- range: ["Yes", "No"],
- required: true,
- visible: true,
- },
-];
-export const creationContextMock: any = {
- objectType: "question",
- collectionObjectType: "QuestionSet",
- isReadOnlyMode: true,
- unitIdentifier: "do_11330102570702438417",
- correctionComments: "",
- mode: "sourcingreview",
- editableFields: {
- orgreview: ["name", "learningOutcome"],
- sourcingreview: ["name", "learningOutcome"],
- },
-};
-
-export const mockTreeService = {
- getChildren: () => {
- return ["do_11330103476396851218", "do_233"];
- },
- getFirstChild: () => {
- return {
- data: {
- metadata: {},
- },
- };
- },
- getActiveNode: () => {
- return {
- data: {
- id: "do_11330103476396851218",
- },
- getParent: () => {
- return {
- getChildren: () => {
- return [
- {
- data: {
- id: "do_11330103476396851218",
- },
- },
- ];
- },
- };
- },
- };
- },
- getNodeById: () => {},
- clearTreeCache: () => {},
- updateNode: () => {},
- updateAppIcon: () => {},
-};
-
-export const mockEditorCursor = {
- setQuestionMap: () => {},
- clearQuestionMap: () => {},
-};
-
-export const childMetaData = {
- allowMultiSelect: "Yes",
- evidenceMimeType: ["audio"],
- markAsNotMandatory: "No",
- name: "MCQ Question",
- remarksLimit: "100",
- showEvidence: "Yes",
- showRemarks: "Yes",
- dateFormat: "dd/mm/yyyy",
- autoCapture: "Yes",
- numberOnly: "Yes",
- characterLimit: "50",
-};
-
-export const HierarchyMockData = {
- do_1133610108714352641210: {
- name: "Observation",
- children: ["do_1133850220538183681722", "do_1133850220538019841720"],
- root: true,
- },
- do_1133850220538183681722: {
- name: "School InfraStructure",
- children: [
- "do_1133850224897638401724",
- "do_1133850228043038721726",
- "do_1133867265349795841865",
- "d07b76a3-56e0-7660-4b49-a556376ae813",
- ],
- root: false,
- },
- do_1133850220538019841720: {
- name: "Midday meal",
- children: [],
- root: false,
- },
-};
-
-export const BranchingLogic = {
- do_1134355569264885761166: {
- target: ["do_1134355571590184961168", "do_1134355574936780801170"],
- preCondition: {},
- source: [],
- },
- do_1134355571590184961168: {
- target: [],
- source: ["do_1134355569264885761166"],
- preCondition: {
- and: [
- {
- ne: [
- {
- var: "do_1134355569264885761166.response1.value",
- type: "responseDeclaration",
- },
- [0],
- ],
- },
- ],
- },
- },
- do_1134355574936780801170: {
- target: [],
- source: ["do_1134355569264885761166"],
- preCondition: {
- and: [
- {
- eq: [
- {
- var: "do_1134355569264885761166.response1.value",
- type: "responseDeclaration",
- },
- [1],
- ],
- },
- ],
- },
- },
-};
-
-export const interactionChoiceEditorState = {
- question: 'q
',
- options: [
- {
- body: 'a
'
- },
- {
- body: 'b
'
- }
- ],
- templateId: 'mcq-vertical',
- answer: '0',
- numberOfOptions: 2,
- interactions: {
- response1: {
- type: 'choice',
- options: [
- {
- label: 'a
',
- value: 0
- },
- {
- label: 'b
',
- value: 1
- }
- ]
- },
- validation: {
- required: 'Yes'
- }
- },
- name: 'Multiple Choice Question',
- responseDeclaration: {
- response1: {
- maxScore: 1,
- cardinality: 'single',
- type: 'integer',
- correctResponse: {
- value: '0',
- outcomes: {
- SCOR: 1
- }
- },
- mapping: []
- }
- },
- interactionTypes: [
- 'choice'
- ],
- editorState: {
- options: [
- {
- answer: true,
- value: {
- body: 'a
',
- value: 0
- }
- },
- {
- answer: false,
- value: {
- body: 'b
',
- value: 1
- }
- }
- ],
- question: 'q
'
- },
- qType: 'MCQ',
- primaryCategory: 'Multiple Choice Question'
-};
-
-export const RubricData = [
- {
- parent: "do_1134357224765685761203",
- code: "a51c0d9f-4696-3354-062f-b2078048656c",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.118+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- children: [
- {
- parent: "do_1134460323603906561218",
- code: "b4c3e613-5c3f-9c8b-d61f-417f4c5d8df2",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- branchingLogic: {
- do_113449672558780416163: {
- target: ["do_11357623678335385613440"],
- preCondition: {},
- source: [],
- },
- do_11357623678335385613440: {
- target: [],
- source: ["do_113449672558780416163"],
- preCondition: {
- and: [
- {
- eq: [
- {
- var: "do_113449672558780416163.response1.value",
- type: "responseDeclaration",
- },
- [0],
- ],
- },
- ],
- },
- },
- },
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.106+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- children: [
- {
- parent: "do_1134460323602841601200",
- code: "d0ab14ae-9f67-41cf-dcfa-80c8432bf424",
- evidence: {
- required: "No",
- mimeType: ["audio"],
- minCount: 1,
- maxCount: 1,
- sizeLimit: "20480",
- },
- subject: ["English"],
- showRemarks: "No",
- channel: "01309282781705830427",
- language: ["English"],
- medium: ["English"],
- mimeType: "application/vnd.sunbird.question",
- templateId: "mcq-vertical",
- createdOn: "2022-01-10T09:08:52.273+0000",
- objectType: "Question",
- gradeLevel: ["Grade 1"],
- primaryCategory: "Multiselect Multiple Choice Question",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-07-08T05:10:07.226+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_113449672558780416163",
- lastStatusChangedOn: "2022-01-10T09:08:52.273+0000",
- visibility: "Parent",
- showTimer: "No",
- author: "check1@yopmail.com",
- index: 1,
- qType: "MCQ",
- languageCode: ["en"],
- version: 1,
- versionKey: "1657257007231",
- showFeedback: "No",
- license: "CC BY 4.0",
- interactionTypes: ["choice"],
- framework: "tpd",
- depth: 3,
- createdBy: "5a587cc1-e018-4859-a0a8-e842650b9d64",
- compatibilityLevel: 4,
- name: "Parent Question MCQ",
- topic: ["Forest"],
- board: "CBSE",
- status: "Draft",
- showEvidence: "Yes",
- },
- {
- parent: "do_1134460323602841601200",
- code: "b22ac67b-6381-3f9a-5d6b-5421149b6dab",
- subject: ["English"],
- channel: "01309282781705830427",
- language: ["English"],
- medium: ["English"],
- mimeType: "application/vnd.sunbird.question",
- createdOn: "2022-07-08T04:44:26.718+0000",
- objectType: "Question",
- gradeLevel: ["Grade 1"],
- primaryCategory: "Date",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-07-08T04:44:26.718+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_11357623678335385613440",
- lastStatusChangedOn: "2022-07-08T04:44:26.718+0000",
- creator: "Vaibahv Bhuva",
- visibility: "Parent",
- showTimer: "No",
- author: "check1@yopmail.com",
- index: 2,
- languageCode: ["en"],
- version: 1,
- versionKey: "1657255466719",
- showFeedback: "No",
- license: "CC BY 4.0",
- interactionTypes: ["date"],
- framework: "tpd",
- depth: 3,
- createdBy: "5a587cc1-e018-4859-a0a8-e842650b9d64",
- compatibilityLevel: 4,
- name: "bb",
- topic: ["Forest"],
- board: "CBSE",
- status: "Draft",
- },
- ],
- contentDisposition: "inline",
- lastUpdatedOn: "2022-07-08T05:05:35.113+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323602841601200",
- lastStatusChangedOn: "2022-01-05T05:42:52.106+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 1,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372106",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Chemistry",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134460323603906561218",
- code: "bfdac63e-4cd1-c9fe-00a0-be98f73e13d8",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- branchingLogic: {},
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.131+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-10T13:09:04.092+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323604971521236",
- lastStatusChangedOn: "2022-01-05T05:42:52.131+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 2,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372131",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "Biology",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- {
- parent: "do_1134460323603906561218",
- code: "9916f5fc-4f37-3f8e-5151-b32ce65217da",
- allowScoring: "Yes",
- allowSkip: "Yes",
- containsUserData: "No",
- channel: "01309282781705830427",
- language: ["English"],
- mimeType: "application/vnd.sunbird.questionset",
- showHints: "No",
- createdOn: "2022-01-05T05:42:52.114+0000",
- objectType: "QuestionSet",
- primaryCategory: "Observation With Rubrics",
- contentDisposition: "inline",
- lastUpdatedOn: "2022-01-05T05:42:52.114+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323603578881212",
- lastStatusChangedOn: "2022-01-05T05:42:52.114+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 3,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372114",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 2,
- compatibilityLevel: 5,
- name: "General Science",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
- ],
- contentDisposition: "inline",
- lastUpdatedOn: "2022-07-08T05:05:35.113+0000",
- contentEncoding: "gzip",
- showSolutions: "No",
- allowAnonymousAccess: "Yes",
- identifier: "do_1134460323603906561218",
- lastStatusChangedOn: "2022-01-05T05:42:52.118+0000",
- requiresSubmit: "No",
- visibility: "Parent",
- showTimer: "No",
- index: 1,
- setType: "materialised",
- languageCode: ["en"],
- version: 1,
- versionKey: "1641361372118",
- showFeedback: "No",
- license: "CC BY 4.0",
- depth: 1,
- compatibilityLevel: 5,
- name: "Science",
- navigationMode: "non-linear",
- allowBranching: "Yes",
- shuffle: true,
- attributions: [],
- status: "Draft",
- },
-];
diff --git a/projects/collection-editor-library/src/lib/components/question/question.component.spec.ts b/projects/collection-editor-library/src/lib/components/question/question.component.spec.ts
deleted file mode 100644
index 2f8f05ea3..000000000
--- a/projects/collection-editor-library/src/lib/components/question/question.component.spec.ts
+++ /dev/null
@@ -1,1942 +0,0 @@
-import { QuestionService } from "./../../services/question/question.service";
-import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
-import { HttpClientTestingModule } from "@angular/common/http/testing";
-import { QuestionComponent } from "./question.component";
-import { Router } from "@angular/router";
-import { PlayerService } from "../../services/player/player.service";
-import { EditorTelemetryService } from "../../services/telemetry/telemetry.service";
-import { EditorService } from "../../services/editor/editor.service";
-import { ToasterService } from "../../services/toaster/toaster.service";
-import { EditorCursor } from "../../collection-editor-cursor.service";
-import { TreeService } from "../../services/tree/tree.service";
-import { SuiModule } from "ng2-semantic-ui-v9";
-import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
-import { TelemetryInteractDirective } from "../../directives/telemetry-interact/telemetry-interact.directive";
-import {
- collectionHierarchyMock,
- creationContextMock,
- mockData,
- readQuestionMock,
- mockTreeService,
- leafFormConfigMock,
- sourcingSettingsMock,
- childMetaData,
- HierarchyMockData,
- BranchingLogic,
- mockEditorCursor,
- interactionChoiceEditorState,
- RubricData
-} from "./question.component.spec.data";
-import { of, throwError } from "rxjs";
-import * as urlConfig from "../../services/config/url.config.json";
-import * as labelConfig from "../../services/config/label.config.json";
-import * as categoryConfig from "../../services/config/category.config.json";
-import { ConfigService } from "../../services/config/config.service";
-import { treeNodeData } from "../editor/editor.component.spec.data";
-import * as _ from 'lodash-es';
-const mockEditorService = {
- editorConfig: {
- config: {
- renderTaxonomy:false,
- hierarchy: {
- level1: {
- name: "Module",
- type: "Unit",
- mimeType: "application/vnd.ekstep.content-collection",
- contentType: "Course Unit",
- iconClass: "fa fa-folder-o",
- children: {},
- },
- },
- },
- },
- parentIdentifier: "",
- optionsLength: 4,
- selectedChildren: {
- primaryCategory: "Multiselect Multiple Choice Question",
- label: "Multiple Choice Question",
- interactionType: "choice",
- },
- getToolbarConfig: () => {},
- getHierarchyObj: () => {},
- fetchCollectionHierarchy: (questionSetId) => {
- subscribe: (fn) => fn(collectionHierarchyMock);
- },
- updateCollection: (questionSetId, event) => {
- subscribe: (fn) => fn({});
- },
- addResourceToQuestionset: (questionSetId, unitId, questionId) => {
- subscribe: (fn) => fn({});
- },
- apiErrorHandling: () => {},
- editorMode:'review',
- submitRequestChanges :() =>{},
- setIsReviewModificationAllowed: (value: boolean) => {
- subscribe: (fn) => fn({});
- }
-};
-
-describe("QuestionComponent", () => {
- const configStub = {
- urlConFig: (urlConfig as any).default,
- labelConfig: (labelConfig as any).default,
- categoryConfig: (categoryConfig as any).default,
- };
-
- let component: QuestionComponent;
- let fixture: ComponentFixture;
- let treeService,
- editorService,
- telemetryService,
- questionService,
- configService,
- toasterService;
- class RouterStub {
- navigate = jasmine.createSpy("navigate");
- }
- beforeEach(waitForAsync(() => {
- TestBed.configureTestingModule({
- declarations: [QuestionComponent, TelemetryInteractDirective],
- imports: [HttpClientTestingModule, SuiModule],
- providers: [
- EditorTelemetryService,
- QuestionService,
- ToasterService,
- PlayerService,
- { provide: ConfigService, useValue: configStub },
- { provide: EditorService, useValue: mockEditorService },
- { provide: Router, useClass: RouterStub },
- EditorCursor,
- { provide: TreeService, useValue: mockTreeService },
- { provide: EditorCursor, useValue: mockEditorCursor },
- ],
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
- }).compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(QuestionComponent);
- component = fixture.componentInstance;
- component.questionInput = {
- questionSetId: "do_11330102570702438417",
- questionId: "do_1134357224765685761203",
- setChildQueston: undefined,
- };
- component.questionId = "do_1134357224765685761203";
- component.questionInteractionType = "choice";
- editorService = TestBed.inject(EditorService);
- configService = TestBed.inject(ConfigService);
- telemetryService = TestBed.inject(EditorTelemetryService);
- treeService = TestBed.inject(TreeService);
- questionService = TestBed.inject(QuestionService);
- toasterService = TestBed.inject(ToasterService);
- spyOn(telemetryService, "impression").and.callFake(() => {});
- editorService.selectedChildren.label = "Slider";
- component.toolbarConfig.showPreview = false;
- component.creationContext = creationContextMock;
- component.leafFormConfig = leafFormConfigMock;
- editorService.optionsLength = 4;
- editorService.selectedChildren.label = "MCQ";
- component.questionInput = {
- questionSetId: "do_11330102570702438417",
- questionId: "do_11330103476396851218",
- type: undefined,
- category: "MTF",
- config: {},
- creationContext: creationContextMock,
- setChildQueston: undefined,
- };
- component.showTranslation = false;
- spyOn(treeService, "getNodeById").and.callFake(()=>{
- return treeNodeData;
- })
-
- // fixture.detectChanges();
- });
-
- it("should create", () => {
- spyOn(editorService, "getToolbarConfig").and.returnValue({
- title: "abcd",
- showDialcode: "No",
- showPreview: "true",
- });
- expect(component).toBeTruthy();
- });
- it("#saveQuestions call on click save button", () => {
- spyOn(component, "saveQuestions");
- const metaData = mockData.textQuestionNetaData.result.question;
- spyOn(questionService, "updateHierarchyQuestionCreate").and.callFake(() => {
- return of({
- result: {
- identifiers: {
- "1245": "do_123",
- },
- },
- });
- });
- component.saveQuestions(metaData, "create");
- expect(component.saveQuestion);
- });
-
- it("Unit test for #ngOnInit()", () => {
- component.toolbarConfig = editorService.toolbarConfig;
- component.leafFormConfig=leafFormConfigMock;
- component.initialLeafFormConfig=leafFormConfigMock;
- component.questionFormConfig = leafFormConfigMock;
- component.questionInput = {
- questionSetId: "do_11330102570702438417",
- questionId: "do_11330103476396851218",
- type: 'choice',
- category: "MTF",
- config: {},
- creationContext: creationContextMock,
- setChildQueston: undefined,
- };
- component.creationContext.objectType = "question";
- spyOn(treeService, "getFirstChild").and.callFake(() => {
- return { data: { metadata: { identifier: "0123",allowScoring:'Yes' } } };
- });
- spyOn(editorService, "getToolbarConfig").and.returnValue({
- title: "abcd",
- showDialcode: "No",
- showPreview: "",
- });
- spyOn(editorService, "fetchCollectionHierarchy").and.callFake(() => {
- return of(collectionHierarchyMock);
- });
- spyOn(questionService, "readQuestion").and.returnValue(
- of(mockData.mcqQuestionMetaData)
- );
- component.ngOnInit();
- component.previewFormData(true);
- expect(component.questionInteractionType).toEqual("choice");
- expect(component.questionCategory).toEqual("MTF");
- expect(component.questionId).toEqual("do_11330103476396851218");
- expect(component.questionSetId).toEqual("do_11330102570702438417");
- expect(component.creationContext).toEqual(creationContextMock);
- expect(component.unitId).toEqual(creationContextMock.unitIdentifier);
- expect(component.isReadOnlyMode).toEqual(
- creationContextMock.isReadOnlyMode
- );
- expect(component.toolbarConfig).toBeDefined();
- expect(component.toolbarConfig.showPreview).toBeTruthy();
- expect(component.questionInput.setChildQueston).toBeFalsy();
- });
-
- it("Unit test for #ngOnInit() fetchCollectionHierarchy api fail case", () => {
- spyOn(component, "ngOnInit").and.callThrough();
- component.toolbarConfig = editorService.toolbarConfig;
- component.questionFormConfig = leafFormConfigMock;
- component.questionInput = {
- questionSetId: "do_11330102570702438417",
- questionId: "do_11330103476396851218",
- type: "default",
- category: "MTF",
- config: {},
- creationContext: creationContextMock,
- setChildQueston: true,
- };
- component.creationContext.objectType = "question";
- spyOn(editorService, "getToolbarConfig").and.returnValue({
- title: "abcd",
- showDialcode: "No",
- showPreview: "",
- });
- spyOn(editorService, "fetchCollectionHierarchy").and.returnValue(
- throwError("error")
- );
- spyOn(questionService, "readQuestion").and.returnValue(
- of(mockData.mcqQuestionMetaData)
- );
- component.ngOnInit();
- expect(component.ngOnInit).toHaveBeenCalled();
- expect(component.questionMetadataFormStatus).toBeTruthy();
- expect(component.questionInput.setChildQueston).toBeTruthy();
- });
-
- it("#initialize should call when question page for question mcq", () => {
- component.initialLeafFormConfig = leafFormConfigMock;
- component.leafFormConfig = leafFormConfigMock;
- component.questionFormConfig=leafFormConfigMock;
- spyOn(component, "initialize").and.callThrough();
- component.questionId = "do_11330103476396851218";
- editorService.parentIdentifier = undefined;
- component.questionPrimaryCategory = undefined;
- spyOn(editorService, "getToolbarConfig").and.returnValue({
- title: "abcd",
- showDialcode: "No",
- showPreview: "false",
- });
- component.toolbarConfig.showPreview = false;
- spyOn(editorService, "fetchCollectionHierarchy").and.callFake(() => {
- return of(collectionHierarchyMock);
- });
- component.questionId = "do_123";
- component.questionSetHierarchy = collectionHierarchyMock.result.questionSet;
- spyOn(questionService, "readQuestion").and.returnValue(
- of(mockData.mcqQuestionMetaData)
- );
- component.questionMetaData = mockData.mcqQuestionMetaData.result.question;
- component.questionInteractionType = "choice";
- component.scoreMapping =
- mockData.mcqQuestionMetaData.result.question.responseDeclaration.response1.mapping;
- component.sourcingSettings = sourcingSettingsMock;
- component.questionInput.setChildQuestion = false;
- component.editorState.solutions=[{
- id:'1',
- type:'vedio'
- }]
- component.initialize();
- component.previewFormData(true);
- expect(component.initialize).toHaveBeenCalled();
- });
-
- it("#initialize should call when question page for question mcq api fail", () => {
- spyOn(component, "initialize").and.callThrough();
- component.questionId = "do_11330103476396851218";
- editorService.parentIdentifier = undefined;
- component.questionFormConfig = leafFormConfigMock;
- component.leafFormConfig = leafFormConfigMock;
- spyOn(editorService, "getToolbarConfig").and.returnValue({
- title: "abcd",
- showDialcode: "No",
- showPreview: "false",
- });
- component.toolbarConfig.showPreview = false;
- spyOn(editorService, "fetchCollectionHierarchy").and.callFake(() => {
- return throwError("error");
- });
- component.questionId = "do_123";
- spyOn(editorService, "apiErrorHandling").and.callFake(() => {});
- component.initialize();
- expect(component.initialize).toHaveBeenCalled();
- });
-
- it("#initialize should call when question page for question slider", () => {
- spyOn(component, "initialize").and.callThrough();
- component.questionId = "do_11330103476396851218";
- component.questionInteractionType = "slider";
- editorService.parentIdentifier = undefined;
- component.questionPrimaryCategory = "Slider";
- component.questionFormConfig = leafFormConfigMock;
- component.leafFormConfig = leafFormConfigMock;
- spyOn(editorService, "getToolbarConfig").and.returnValue({
- title: "abcd",
- showDialcode: "No",
- showPreview: "false",
- });
- component.toolbarConfig.showPreview = false;
- spyOn(editorService, "fetchCollectionHierarchy").and.callFake(() => {
- return of(collectionHierarchyMock);
- });
- component.questionSetHierarchy = collectionHierarchyMock.result.questionSet;
- component.questionId = "do_1234";
- spyOn(questionService, "readQuestion").and.returnValue(
- of(mockData.sliderQuestionMetaData)
- );
- component.questionMetaData =
- mockData.sliderQuestionMetaData.result.question;
- component.editorState =
- mockData.sliderQuestionMetaData.result.question.editorState;
- component.initialize();
- expect(component.initialize).toHaveBeenCalled();
- });
-
- it("#initialize should call when question page for question text", () => {
- spyOn(component, "initialize").and.callThrough();
- component.leafFormConfig=leafFormConfigMock;
- component.initialLeafFormConfig=leafFormConfigMock;
- component.childFormData = childMetaData;
- component.questionInteractionType = "text";
- component.questionId = "do_11330103476396851218";
- editorService.parentIdentifier = undefined;
- spyOn(editorService, "getToolbarConfig").and.returnValue({
- title: "abcd",
- showDialcode: "No",
- showPreview: "false",
- });
- component.toolbarConfig.showPreview = false;
- spyOn(editorService, "fetchCollectionHierarchy").and.callFake(() => {
- return of(collectionHierarchyMock);
- });
- component.questionSetHierarchy = collectionHierarchyMock.result.questionSet;
- component.questionId = "do_1235";
- spyOn(questionService, "readQuestion").and.returnValue(
- of(mockData.textQuestionNetaData)
- );
- component.questionMetaData = mockData.textQuestionNetaData.result.question;
- component.editorState =
- mockData.textQuestionNetaData.result.question.editorState;
- component.initialize();
- component.previewFormData(false);
- expect(component.initialize).toHaveBeenCalled();
- });
-
- it("#initialize should call when question page for question date", () => {
- spyOn(component, "initialize").and.callThrough();
- component.questionInteractionType = "date";
- component.leafFormConfig=leafFormConfigMock;
- component.initialLeafFormConfig=leafFormConfigMock;
- component.childFormData = childMetaData;
- component.questionId = "do_11330103476396851218";
- editorService.parentIdentifier = undefined;
- spyOn(editorService, "getToolbarConfig").and.returnValue({
- title: "abcd",
- showDialcode: "No",
- showPreview: "false",
- });
- component.toolbarConfig.showPreview = false;
- spyOn(editorService, "fetchCollectionHierarchy").and.callFake(() => {
- return of(collectionHierarchyMock);
- });
- component.questionId = "do_126";
- component.questionPrimaryCategory = undefined;
- component.questionSetHierarchy = collectionHierarchyMock.result.questionSet;
- spyOn(questionService, "readQuestion").and.returnValue(
- of(mockData.dateQuestionMetaDate)
- );
- component.questionMetaData = mockData.dateQuestionMetaDate.result.question;
- component.editorState =
- mockData.dateQuestionMetaDate.result.question.editorState;
- component.initialize();
- expect(component.initialize).toHaveBeenCalled();
- });
-
- it("#initialize should call when question page for question default", () => {
- spyOn(component, "initialize").and.callThrough();
- component.questionId = "do_11330103476396851218";
- editorService.parentIdentifier = undefined;
- component.leafFormConfig=leafFormConfigMock;
- component.initialLeafFormConfig=leafFormConfigMock;
- component.childFormData = childMetaData;
- spyOn(editorService, "getToolbarConfig").and.returnValue({
- title: "abcd",
- showDialcode: "No",
- showPreview: "false",
- });
- component.toolbarConfig.showPreview = false;
- spyOn(editorService, "fetchCollectionHierarchy").and.callFake(() => {
- return of(collectionHierarchyMock);
- });
- component.questionSetHierarchy = collectionHierarchyMock.result.questionSet;
- spyOn(questionService, "readQuestion").and.returnValue(
- of(mockData.defaultQuestionMetaData)
- );
- component.questionMetaData =
- mockData.defaultQuestionMetaData.result.question;
- component.questionInteractionType = "default";
- component.initialize();
- expect(component.initialize).toHaveBeenCalled();
- });
-
- it("#initialize should call when question page for question mcq with interactionTypes", () => {
- component.questionSetId = "do_12345";
- spyOn(editorService, "fetchCollectionHierarchy").and.callFake(() => {
- return of(collectionHierarchyMock);
- });
- editorService.parentIdentifier = undefined;
- component.questionId = "do_11330103476396851218";
- component.leafFormConfig = leafFormConfigMock;
- spyOn(questionService, "readQuestion").and.returnValue(
- of(mockData.mcqQuestionMetaData)
- );
- spyOn(component, 'setQuestionTitle').and.callFake(() => {});
- spyOn(component, 'populateFormData').and.callFake(() => {});
- component.leafFormConfig = leafFormConfigMock;
- spyOn(component, "initialize").and.callThrough();
- component.initialize();
- expect(component.initialize).toHaveBeenCalled();
- expect(component.questionPrimaryCategory).toBeDefined();
- expect(component.questionInteractionType).toBeDefined();
- expect(component.populateFormData).toHaveBeenCalled();
- expect(component.setQuestionTitle).toHaveBeenCalled();
- });
-
- it("#initialize should call when question page for question mcq without interactionTypes", () => {
- let questionMetadata = mockData.mcqQuestionMetaData.result.question;
- questionMetadata = _.omit(questionMetadata, ['interactionTypes', 'primaryCategory'])
- component.questionSetId = "do_12345";
- spyOn(editorService, "fetchCollectionHierarchy").and.callFake(() => {
- return of(collectionHierarchyMock);
- });
- editorService.parentIdentifier = undefined;
- component.questionId = "do_11330103476396851218";
- component.leafFormConfig = leafFormConfigMock;
- spyOn(questionService, "readQuestion").and.returnValue(
- of({result: {question: {questionMetadata}}})
- );
- spyOn(component, 'setQuestionTitle').and.callFake(() => {});
- spyOn(component, 'populateFormData').and.callFake(() => {});
- component.leafFormConfig = leafFormConfigMock;
- spyOn(component, "initialize").and.callThrough();
- component.initialize();
- expect(component.initialize).toHaveBeenCalled();
- expect(component.questionPrimaryCategory).toBeUndefined();
- expect(component.questionInteractionType).toEqual("default");
- expect(component.populateFormData).toHaveBeenCalled();
- expect(component.setQuestionTitle).toHaveBeenCalled();
- });
-
- it("#initialize should call when question page for question slider", () => {
- spyOn(component, "initialize").and.callThrough();
- component.initialLeafFormConfig = leafFormConfigMock;
- component.leafFormConfig = leafFormConfigMock;
- component.questionId = "do_11330103476396851218";
- editorService.parentIdentifier = undefined;
- spyOn(editorService, "getToolbarConfig").and.returnValue({
- title: "abcd",
- showDialcode: "No",
- showPreview: "false",
- });
- component.toolbarConfig.showPreview = false;
- component.questionSetHierarchy = collectionHierarchyMock.result.questionSet;
- spyOn(editorService, "fetchCollectionHierarchy").and.callFake(() => {
- return of(collectionHierarchyMock);
- });
- component.questionId = undefined;
- spyOn(questionService, "readQuestion").and.returnValue(
- of(mockData.sliderQuestionMetaData)
- );
- component.questionMetaData = mockData.sliderQuestionMetaData;
- component.questionInteractionType = "slider";
- component.initialize();
- expect(component.initialize).toHaveBeenCalled();
- });
-
- it("#initialize should call when question page for question text", () => {
- spyOn(component, "initialize").and.callThrough();
- component.initialLeafFormConfig = leafFormConfigMock;
- component.leafFormConfig = leafFormConfigMock;
- component.questionFormConfig = leafFormConfigMock;
- component.questionId = "do_11330103476396851218";
- editorService.parentIdentifier = undefined;
- spyOn(editorService, "getToolbarConfig").and.returnValue({
- title: "abcd",
- showDialcode: "No",
- showPreview: "false",
- });
- component.toolbarConfig.showPreview = false;
- component.questionSetHierarchy = collectionHierarchyMock.result.questionSet;
- spyOn(editorService, "fetchCollectionHierarchy").and.callFake(() => {
- return of(collectionHierarchyMock);
- });
- component.questionId = undefined;
- spyOn(questionService, "readQuestion").and.returnValue(
- of(mockData.textQuestionNetaData)
- );
- component.questionMetaData = mockData.textQuestionNetaData;
- component.questionInteractionType = "text";
- component.initialize();
- expect(component.initialize).toHaveBeenCalled();
- });
-
- it("#initialize should call when question page for question date", () => {
- spyOn(component, "initialize").and.callThrough();
- component.initialLeafFormConfig = leafFormConfigMock;
- component.leafFormConfig = leafFormConfigMock;
- component.questionFormConfig = leafFormConfigMock;
- component.questionId = "do_11330103476396851218";
- editorService.parentIdentifier = undefined;
- spyOn(editorService, "getToolbarConfig").and.returnValue({
- title: "abcd",
- showDialcode: "No",
- showPreview: "false",
- });
- component.toolbarConfig.showPreview = false;
- spyOn(editorService, "fetchCollectionHierarchy").and.callFake(() => {
- return of(collectionHierarchyMock);
- });
- component.questionSetHierarchy = collectionHierarchyMock.result.questionSet;
- spyOn(questionService, "readQuestion").and.returnValue(
- of(mockData.dateQuestionMetaDate)
- );
- component.questionInteractionType = "date";
- component.initialize();
- expect(component.initialize).toHaveBeenCalled();
- });
-
- it('#contentPolicyUrl() should return content policy url', () => {
- editorService.contentPolicyUrl = 'https://preprod.ntp.net.in/term-of-use.html';
- spyOn(component, 'contentPolicyUrl').and.callThrough();
- const contentPolicyURL = component.contentPolicyUrl;
- expect(contentPolicyURL).toBeDefined();
- });
-
- it("#toolbarEventListener() should call toolbarEventListener for saveContent", () => {
- const event = { button: "saveContent" };
- spyOn(component, 'toolbarEventListener').and.callThrough();
- component.actionType = event.button;
- spyOn(component, "saveContent");
- component.toolbarEventListener(event);
- expect(component.toolbarEventListener).toHaveBeenCalledWith;
- });
-
- it("#toolbarEventListener() should call toolbarEventListener for showTranslation", () => {
- spyOn(component, "toolbarEventListener").and.callThrough();
- const event = { button: "showTranslation" };
- component.actionType = event.button;
- component.toolbarEventListener(event);
- expect(component.toolbarEventListener).toHaveBeenCalledWith(event);
- expect(component.showTranslation).toBe(true);
- });
-
- it("#toolbarEventListener() should call toolbarEventListener for cancelContent", () => {
- const data = { button: "cancelContent" };
- spyOn(component, "handleRedirectToQuestionset");
- component.toolbarEventListener(data);
- expect(component.handleRedirectToQuestionset).toHaveBeenCalled();
- });
- it("#toolbarEventListener() should call toolbarEventListener for backContent", () => {
- const data = { button: "backContent" };
- spyOn(component, "handleRedirectToQuestionset");
- component.toolbarEventListener(data);
- expect(component.handleRedirectToQuestionset).toHaveBeenCalled();
- });
- it("#toolbarEventListener() should call toolbarEventListener for previewContent", () => {
- const data = { button: "previewContent" };
- spyOn(component, "previewContent");
- component.toolbarEventListener(data);
- expect(component.previewContent).toHaveBeenCalled();
- });
- it("#toolbarEventListener() should call toolbarEventListener for editContent", () => {
- const data = { button: "editContent" };
- spyOn(component, "previewFormData");
- component.toolbarEventListener(data);
- expect(component.previewFormData).toHaveBeenCalledWith(true);
- expect(component.showPreview).toBeFalsy();
- expect(component.toolbarConfig.showPreview).toBeFalsy();
- });
- it("#toolbarEventListener() should call toolbarEventListener for submitQuestion", () => {
- const data = { button: "submitQuestion" };
- spyOn(component, "submitHandler");
- component.toolbarEventListener(data);
- expect(component.submitHandler).toHaveBeenCalledWith();
- });
- it("#toolbarEventListener() should call toolbarEventListener for rejectQuestion", () => {
- const data = { button: "rejectQuestion", comment: "test comment" };
- spyOn(component, "rejectQuestion");
- component.toolbarEventListener(data);
- expect(component.rejectQuestion).toHaveBeenCalledWith(data.comment);
- });
- it("#toolbarEventListener() should call toolbarEventListener for publishQuestion", () => {
- const data = { button: "publishQuestion" };
- spyOn(component, "publishQuestion");
- component.toolbarEventListener(data);
- expect(component.publishQuestion).toHaveBeenCalledWith(data);
- });
- it("#toolbarEventListener() should call toolbarEventListener for sourcingApproveQuestion", () => {
- const data = { button: "sourcingApproveQuestion" };
- spyOn(component, "sourcingUpdate");
- component.toolbarEventListener(data);
- expect(component.sourcingUpdate).toHaveBeenCalledWith(data);
- });
- it("#toolbarEventListener() should call toolbarEventListener for sourcingRejectQuestion", () => {
- const data = { button: "sourcingRejectQuestion" };
- spyOn(component, "sourcingUpdate");
- component.toolbarEventListener(data);
- expect(component.sourcingUpdate).toHaveBeenCalledWith(data);
- });
- it("#toolbarEventListener() should call toolbarEventListener for showReviewcomments", () => {
- const data = { button: "showReviewcomments" };
- component.showReviewModal = true;
- component.toolbarEventListener(data);
- expect(component.showReviewModal).toBeFalsy();
- });
- it("#toolbarEventListener() should call toolbarEventListener for sendForCorrectionsQuestion", () => {
- const data = { button: "sendForCorrectionsQuestion" };
- spyOn(component, "sendBackQuestion");
- component.toolbarEventListener(data);
- expect(component.sendBackQuestion).toHaveBeenCalledWith(data);
- });
- it("#toolbarEventListener() should call toolbarEventListener for default case", () => {
- const data = { button: "" };
- spyOn(component, "toolbarEventListener");
- component.toolbarEventListener(data);
- expect(component.toolbarEventListener).toHaveBeenCalledWith(data);
- });
-
- it("Unit test for #populateFormData question markAsNotMandatory reqired yes", () => {
- spyOn(component,'populateFormData').and.callThrough();
- component.childFormData = {};
- component.isReadOnlyMode=false;
- component.questionInteractionType="choice";
- component.questionMetaData=mockData.mcqQuestionMetaData.result.question;
- component.leafFormConfig = leafFormConfigMock;
- component.questionId = "do_123";
- component.questionSetHierarchy = collectionHierarchyMock.result.questionSet;
- spyOn(component,'fetchFrameWorkDetails').and.callFake(()=>{});
- spyOn(component,'previewFormData').and.callFake(()=>{})
- component.populateFormData();
- expect(component.previewFormData).toHaveBeenCalled();
- });
-
- it("Unit test for #populateFormData without Question Id", () => {
- component.childFormData = {};
- component.questionId = undefined;
- component.questionInteractionType="choice";
- component.isReadOnlyMode=false;
- component.leafFormConfig = leafFormConfigMock;
- component.initialLeafFormConfig = leafFormConfigMock;
- component.questionFormConfig = leafFormConfigMock;
- component.questionMetaData=mockData.mcqQuestionMetaData.result.question;
- component.questionSetHierarchy = collectionHierarchyMock.result.questionSet;
- spyOn(component,'fetchFrameWorkDetails').and.callFake(()=>{});
- component.populateFormData();
- });
-
- it("Unit test for #populateFormData readonly mode true ", () => {
- spyOn(component,'populateFormData').and.callThrough();
- component.childFormData = {};
- component.isReadOnlyMode=true;
- component.questionInteractionType="choice";
- component.questionMetaData=mockData.mcqQuestionMetaData.result.question;
- component.leafFormConfig = leafFormConfigMock;
- component.initialLeafFormConfig = leafFormConfigMock;
- component.questionFormConfig = leafFormConfigMock;
- component.questionId = "do_123";
- component.questionSetHierarchy = collectionHierarchyMock.result.questionSet;
- spyOn(component,'previewFormData').and.callFake(()=>{})
- component.populateFormData();
- expect(component.previewFormData).toHaveBeenCalled();
- });
-
- it("should call previewFormData ", () => {
- spyOn(component, "previewFormData").and.callThrough();
- component.leafFormConfig = mockData.childMetadata.properties;
- component.initialLeafFormConfig = mockData.childMetadata.properties;
- component.childFormData = childMetaData;
- component.questionFormConfig = mockData.childMetadata.properties;
- component.previewFormData(true);
- expect(component.leafFormConfig).toEqual(mockData.childMetadata.properties);
- expect(component.previewFormData).toHaveBeenCalled();
- });
- it("should call valueChanges", () => {
- component.valueChanges(childMetaData);
- expect(component.childFormData).toEqual(childMetaData);
- });
- it("should call validateFormFields", () => {
- component.leafFormConfig = mockData.childMetadata;
- component.childFormData = childMetaData;
- const toasterService = TestBed.inject(ToasterService);
- spyOn(toasterService, "error").and.callThrough();
- component.validateFormFields();
- expect(component.showFormError).toBeFalsy();
- });
-
- it("#populateFrameworkData() should call populateFrameworkData and set leafFormConfig values ", () => {
- component.frameworkDetails.frameworkData =
- mockData.frameWorkDetails.frameworkData;
- component.questionFormConfig = leafFormConfigMock;
- component.leafFormConfig = leafFormConfigMock;
- component.populateFrameworkData();
- expect(component.leafFormConfig).toBeDefined();
- });
- it("#outputData() should call outputData", () => {
- spyOn(component, "output").and.callThrough();
- component.output({});
- expect(component.output).toHaveBeenCalled();
- });
- it("#onStatusChanges() should call onStatusChanges", () => {
- spyOn(component, "onStatusChanges");
- component.onStatusChanges("");
- expect(component.onStatusChanges).toHaveBeenCalled();
- });
-
- it("call #getMcqQuestionHtmlBody() to verify questionBody", () => {
- const question = '';
- const templateId = "mcq-vertical";
- component.getMcqQuestionHtmlBody(question, templateId);
- });
-
- it("Unit test for #sendForReview", () => {
- spyOn(component, "upsertQuestion");
- component.sendForReview();
- expect(component.upsertQuestion).toHaveBeenCalled();
- });
-
- it('Unit test for requestForChanges success', () => {
- component.questionId = 'do_12345';
- spyOn(component, 'requestForChanges').and.callThrough();
- editorService = TestBed.inject(EditorService);
- spyOn(editorService, 'submitRequestChanges').and.returnValue(of({}))
- spyOn(toasterService, 'success').and.callFake(() => {})
- spyOn(component, 'redirectToChapterList').and.callFake(() => {});
- component.requestForChanges('test');
- expect(toasterService.success).toHaveBeenCalled();
- expect(component.redirectToChapterList).toHaveBeenCalled();
- });
-
- it('Unit test for requestForChanges error', () => {
- component.questionId = 'do_12345';
- spyOn(component, 'requestForChanges').and.callThrough();
- editorService = TestBed.inject(EditorService);
- spyOn(editorService, 'submitRequestChanges').and.returnValue(throwError({}))
- spyOn(toasterService, 'error').and.callFake(() => {})
- spyOn(component, 'redirectToChapterList').and.callFake(() => {});
- component.requestForChanges('test');
- expect(component.redirectToChapterList).not.toHaveBeenCalled();
- expect(toasterService.error).toHaveBeenCalled();
- });
-
- it("Unit test for #setQuestionId", () => {
- spyOn(component, "setQuestionTitle");
- component.setQuestionId("do_11330103476396851218");
- expect(component.questionId).toEqual("do_11330103476396851218");
- expect(component.setQuestionTitle);
- });
- it("#rejectQuestion() should call #requestForChanges", () => {
- const comment = "test comment";
- spyOn(component, "requestForChanges");
- component.showFormError = false;
- component.rejectQuestion(comment);
- expect(component.requestForChanges).toHaveBeenCalledWith(comment);
- });
- it("#handleRedirectToQuestionset() should call handleRedirectToQuestionset and redirectToQuestionset to be called ", () => {
- component.showConfirmPopup = false;
- component.questionId = "do_11326368076523929611";
- spyOn(component, "redirectToQuestionset").and.callFake(() => {});
- spyOn(component, "handleRedirectToQuestionset").and.callThrough();
- component.handleRedirectToQuestionset();
- expect(component.showConfirmPopup).toBeFalsy();
- expect(component.redirectToQuestionset).toHaveBeenCalled();
- });
- it("redirectToQuestionset should call handleRedirectToQuestionset and set showConfirmPopup", () => {
- component.showConfirmPopup = false;
- component.questionId = undefined;
- component.creationMode = 'edit';
- spyOn(component, "redirectToQuestionset").and.callFake(() => {});
- spyOn(component, "handleRedirectToQuestionset").and.callThrough();
- component.handleRedirectToQuestionset();
- expect(component.showConfirmPopup).toBeTruthy();
- expect(component.redirectToQuestionset).not.toHaveBeenCalled();
- });
- it("Unit test for #showHideSpinnerLoader", () => {
- spyOn(component, 'showHideSpinnerLoader').and.callThrough();
- component.showHideSpinnerLoader(true, "review");
- expect(component.buttonLoaders.saveButtonLoader).toEqual(true);
- expect(component.buttonLoaders.review).toEqual(true);
- });
- it("Unit test for #previewContent", () => {
- spyOn(component, 'validateQuestionData').and.callFake(() => {});
- spyOn(component, 'previewFormData').and.callFake(() => {});
- component.showFormError = false;
- component.questionMetadataFormStatus = true;
- component.questionId = 'do_12345';
- component.tempQuestionId = 'do_12345';
- component.questionSetHierarchy = {
- childNodes: ''
- };
- spyOn(component, 'setQumlPlayerData').and.callFake(() => {});
- component.toolbarConfig = {
- showPreview: true
- }
- spyOn(treeService , 'getActiveNode').and.returnValue({
- parent:{ data:{ metadata:{shuffle: true, showSolutions: 'Yes', showFeedback: 'Yes'}}}
- });
- spyOn(component, 'setParentConfig').and.callFake(() => {});
- spyOn(component, 'previewContent').and.callThrough();
- component.previewContent();
- expect(component.validateQuestionData).toHaveBeenCalled();
- expect(component.showFormError).toBeFalsy();
- expect(component.questionMetadataFormStatus).toBeTruthy();
- });
- it("#previewContent should call toasterService.error", () => {
- spyOn(component, 'validateQuestionData').and.callFake(() => {});
- component.showFormError = true;
- component.questionMetadataFormStatus = false;
- // tslint:disable-next-line:no-shadowed-variable
- const toasterService = TestBed.inject(ToasterService);
- spyOn(toasterService, 'error').and.callFake(() => {});
- spyOn(component, 'previewContent').and.callThrough();
- component.previewContent();
- expect(toasterService.error).toHaveBeenCalled();
- });
-
- it('#setParentConfig should set questionset behaviour with truthy parentConfig', () => {
- component.questionSetHierarchy = {
- shuffle: false, showSolutions: 'No', showFeedback: 'No'
- }
- spyOn(component, 'setParentConfig').and.callThrough();
- component.setParentConfig({shuffle: true, showSolutions: 'Yes', showFeedback: 'Yes'});
- expect(component.questionSetHierarchy.shuffle).toBeTruthy();
- expect(component.questionSetHierarchy.showSolutions).toEqual('Yes');
- expect(component.questionSetHierarchy.showFeedback).toEqual('Yes');
- });
-
- it('#setParentConfig should set questionset behaviour with falsy parentConfig', () => {
- component.questionSetHierarchy = {
- shuffle: true, showSolutions: 'Yes', showFeedback: 'Yes'
- }
- spyOn(component, 'setParentConfig').and.callThrough();
- component.setParentConfig({shuffle: false, showSolutions: 'No', showFeedback: 'No'});
- expect(component.questionSetHierarchy.shuffle).toBeFalsy();
- expect(component.questionSetHierarchy.showSolutions).toEqual('No');
- expect(component.questionSetHierarchy.showFeedback).toEqual('No');
- });
-
- it('#setParentConfig should set questionset behaviour without parentConfig', () => {
- component.questionSetHierarchy = {
- shuffle: false, showSolutions: 'Yes', showFeedback: 'Yes'
- }
- spyOn(component, 'setParentConfig').and.callThrough();
- component.setParentConfig({});
- expect(component.questionSetHierarchy.shuffle).toBeTruthy();
- expect(component.questionSetHierarchy.showSolutions).toEqual('No');
- expect(component.questionSetHierarchy.showFeedback).toEqual('No');
- });
-
- it("Unit test for #setQumlPlayerData", () => {
- // spyOn(component, 'editorCursor.setQuestionMap').and.callFake(()=> {});
- spyOn(component, 'getQuestionMetadata').and.returnValue(mockData.mcqQuestionMetaData.result.question);
- component.questionSetHierarchy = {
- children: [],
- maxScore: '1'
- };
- spyOn(component, 'setQumlPlayerData').and.callThrough();
- component.setQumlPlayerData('do_12345');
- expect(component.getQuestionMetadata).toHaveBeenCalled();
- expect(component.questionSetHierarchy.maxScore).toBeDefined();
- });
- it("Unit test for #isEditable without queston id", () => {
- component.creationContext = creationContextMock;
- component.questionId=undefined;
- expect(component.isEditable("bloomsLevel")).toBeTruthy();
- });
- it("Unit test for #isEditable with queston id", () => {
- component.creationContext = creationContextMock;
- expect(component.isEditable("bloomsLevel")).toBeFalsy();
- });
- it("Unit test for #prepareQuestionBody", () => {
- component.questionId = undefined;
- spyOn(component, 'getQuestionMetadata').and.returnValue({});
- spyOn(component, "prepareQuestionBody").and.callThrough();
- const response = component.prepareQuestionBody();
- expect(component.prepareQuestionBody).toHaveBeenCalled();
- expect(response).toBeDefined();
- });
- it("#submitHandler() should set showSubmitConfirmPopup true", () => {
- component.showSubmitConfirmPopup = false;
- spyOn(component, 'submitHandler').and.callThrough();
- spyOn(component, 'validateQuestionData').and.callFake(() => {
- component.showFormError = false;
- });
- spyOn(component, 'validateFormFields').and.callFake(() => {return true});
- component.submitHandler();
- expect(component.submitHandler).toHaveBeenCalled();
- expect(component.validateQuestionData).toHaveBeenCalled();
- expect(component.validateFormFields).toHaveBeenCalled();
- expect(component.showSubmitConfirmPopup).toBeTruthy();
- });
- it("#submitHandler() should not set showSubmitConfirmPopup true", () => {
- component.showSubmitConfirmPopup = false;
- spyOn(component, 'submitHandler').and.callThrough();
- spyOn(component, 'validateQuestionData').and.callFake(() => {
- component.showFormError = true;
- });
- spyOn(component, 'validateFormFields').and.callFake(() => {return false});
- component.submitHandler();
- expect(component.submitHandler).toHaveBeenCalled();
- expect(component.validateQuestionData).toHaveBeenCalled();
- expect(component.validateFormFields).toHaveBeenCalled();
- expect(component.showSubmitConfirmPopup).toBeFalsy();
- });
- it("#saveContent() should call saveContent and set showFormError ", () => {
- spyOn(component, "validateQuestionData").and.callFake(() => {});
- spyOn(component, "saveQuestion").and.callFake(() => {});
- component.showFormError = false;
- component.questionMetadataFormStatus = true;
- spyOn(component, 'saveContent').and.callThrough();
- component.saveContent();
- expect(component.validateQuestionData).toHaveBeenCalled();
- expect(component.showFormError).toBeFalsy();
- expect(component.questionMetadataFormStatus).toBeTruthy();
- expect(component.saveQuestion).toHaveBeenCalled();
- });
- it("#saveContent() should call toasterService.error ", () => {
- spyOn(component, "validateQuestionData").and.callFake(() => {});
- spyOn(component, "saveQuestion").and.callFake(() => {});
- component.showFormError = true;
- component.questionMetadataFormStatus = false;
- spyOn(toasterService, 'error').and.callFake(() => {});
- spyOn(component, 'saveContent').and.callThrough();
- component.saveContent();
- expect(component.validateQuestionData).toHaveBeenCalled();
- expect(component.saveQuestion).not.toHaveBeenCalled();
- expect(toasterService.error).toHaveBeenCalled();
- });
- it("#redirectToQuestionset() should call redirectToQuestionset and set showConfirmPopup", () => {
- spyOn(component.questionEmitter, "emit");
- component.redirectToQuestionset();
- expect(component.showConfirmPopup).toBeFalsy();
- });
- it("#editorDataHandler() should call editorDataHandler for not any type", () => {
- component.editorState = mockData.editorState;
- component.editorDataHandler(mockData.eventData);
- expect(component.editorState).toBeDefined();
- });
- it("#editorDataHandler() should call editorDataHandler for question", () => {
- component.editorState = mockData.editorState;
- component.editorDataHandler(mockData.eventData, "question");
- expect(component.editorState).toBeDefined();
- });
- it("#editorDataHandler() should call editorDataHandler for solution", () => {
- component.editorState = mockData.editorState;
- component.editorDataHandler(mockData.eventData, "solution");
- expect(component.editorState).toBeDefined();
- });
- it("#editorDataHandler() should call editorDataHandler for media", () => {
- component.editorState = mockData.editorState;
- mockData.eventData.mediaobj = { id: "1234" };
- spyOn(component, "setMedia");
- component.editorDataHandler(mockData.eventData);
- expect(component.editorState).toBeDefined();
- expect(component.setMedia).toHaveBeenCalledWith(
- mockData.eventData.mediaobj
- );
- });
- it("#setMedia should call setMedia and set media arry", () => {
- component.editorState = mockData.editorState;
- component.mediaArr = [{ id: "6789" }];
- component.setMedia({ id: "1234" });
- expect(component.mediaArr).toBeDefined();
- });
-
- it('#getQuestionMetadata shpuld call when queston body is prepared',()=>{
- spyOn(component,'getQuestionMetadata').and.callThrough();
- component.editorState=mockData.sliderQuestionMetaData.result.question;
- component.selectedSolutionType="2432432"
- component.questionInteractionType='slider';
- component.getResponseDeclaration('slider')
- component.getQuestionMetadata();
- expect(component.getQuestionMetadata).toHaveBeenCalled();
- })
-
- it('#getQuestionMetadata() should return question metata when interactionType is choice', () => {
- component.mediaArr = [];
- component.editorState = interactionChoiceEditorState;
- component.selectedSolutionType = undefined;
- component.creationContext = undefined;
- component.questionInteractionType = 'choice';
- component.childFormData = {
- name: 'MCQ',
- bloomsLevel: null,
- board: 'CBSE',
- maxScore: 1
- };
- component.maxScore = 1;
- spyOn(component, 'getDefaultSessionContext').and.returnValue({
- creator: 'Vaibahv Bhuva',
- createdBy: '5a587cc1-e018-4859-a0a8-e842650b9d64'
- }
- );
- spyOn(component, 'getQuestionMetadata').and.callThrough();
- const metadata = component.getQuestionMetadata();
- expect(metadata.responseDeclaration.response1.maxScore).toEqual(1);
- expect(metadata.responseDeclaration.response1.correctResponse.outcomes.SCORE).toEqual(1);
- });
-
- it("#saveQuestion() should call saveQuestion for updateQuestion objectType not a question", () => {
- component.editorState = mockData.editorState;
- component.questionId = "do_11326368076523929611";
- spyOn(component, "updateQuestion");
- creationContextMock.objectType = "questionSet";
- component.creationContext = creationContextMock;
- spyOn(treeService, "getFirstChild").and.callFake(() => {
- return { data: { metadata: { identifier: "0123" } } };
- });
- spyOn(treeService, "getActiveNode").and.callFake(() => {
- return { data: { root: true } };
- });
- spyOn(questionService, "upsertQuestion").and.returnValue(
- of({
- result: {
- identifiers: {
- "1234": "do_123",
- },
- },
- })
- );
- component.saveQuestion();
- expect(component.updateQuestion);
- });
-
- it("#saveQuestion() should call saveQuestion for updateQuestion api error when there is question id", () => {
- component.editorState = mockData.editorState;
- component.questionId = "do_11326368076523929611";
- spyOn(component, "updateQuestion");
- creationContextMock.objectType = "QuestionSet";
- component.creationContext = creationContextMock;
- spyOn(questionService, "upsertQuestion").and.returnValue(
- throwError("error")
- );
- component.saveQuestion();
- expect(component.updateQuestion);
- });
- it("#saveQuestion() should call saveQuestion for updateQuestion api error when new question", () => {
- component.editorState = mockData.mcqQuestionMetaData.result.question;
- component.questionId = undefined;
- spyOn(component, "updateQuestion");
- creationContextMock.objectType = "QuestionSet";
- component.creationContext = creationContextMock;
- component.childFormData = childMetaData;
- component.setQuestionTypeValues(
- mockData.mcqQuestionMetaData.result.question
- );
- spyOn(questionService, "updateHierarchyQuestionCreate").and.returnValue(
- throwError("error")
- );
- component.saveQuestion();
- expect(component.updateQuestion);
- });
-
- it("#saveQuestion() should call saveQuestion for updateQuestion save successfully", () => {
- component.editorState = mockData.mcqQuestionMetaData.result.question;
- component.questionId = undefined;
- spyOn(component, "updateQuestion");
- creationContextMock.objectType = "QuestionSet";
- component.creationContext = creationContextMock;
- component.childFormData = childMetaData;
- component.setQuestionTypeValues(
- mockData.mcqQuestionMetaData.result.question
- );
- spyOn(questionService, "updateHierarchyQuestionCreate").and.callFake(() => {
- return of({
- result: {
- identifiers: {
- "1245": "do_123",
- },
- },
- });
- });
- component.saveQuestion();
- expect(component.updateQuestion);
- });
-
- it("#createQuestion() should call when child question", () => {
- spyOn(component, "createQuestion");
- component.editorState = mockData.mcqQuestionMetaData.result.question;
- component.questionId = "do_11326368076523929611";
- component.showOptions = true;
- component.questionId = "do_1134355571590184961168";
- component.selectedSectionId = "do_1134347209749299201119";
- component.showFormError = false;
- component.questionMetadataFormStatus = true;
- component.showOptions = true;
- component.isChildQuestion = true;
- component.condition = "eq";
- component.selectedOptions = 1;
- spyOn(questionService, "updateHierarchyQuestionCreate").and.callFake(() => {
- return of({
- result: {
- identifiers: {
- "1245": "do_123",
- },
- },
- });
- });
- // component.saveContent();
- component.updateQuestion();
- component.buildCondition("create");
- component.updateTreeCache(
- "Mid-day Meals",
- BranchingLogic,
- component.selectedSectionId
- );
- component.createQuestion();
- expect(component.createQuestion);
- });
-
-
- it("#createQuestion() should call when child question", () => {
- component.questionId = "do_11326368076523929611";
- component.editorState = mockData.mcqQuestionMetaData.result.question;
- component.childFormData = childMetaData;
- component.subMenus = mockData.subMenus;
- component.questionInteractionType = "choice";
- component.showOptions = false;
- spyOn(questionService, "updateHierarchyQuestionCreate").and.returnValue(
- throwError("error")
- );
- component.createQuestion();
- });
-
- it("#createQuestion() should call when child question api success", () => {
- component.questionId = "1234";
- component.editorState = mockData.mcqQuestionMetaData.result.question;
- component.childFormData = childMetaData;
- component.subMenus = mockData.subMenus;
- component.questionInteractionType = "choice";
- component.showOptions = false;
- spyOn(questionService, "updateHierarchyQuestionCreate").and.callFake(() => {
- return of({
- result: {
- identifiers: {
- "1245": "do_123",
- },
- },
- });
- });
- component.createQuestion();
- });
-
- it("#deleteSolution() should call deleteSolution and set showSolutionDropDown value", () => {
- component.editorState = mockData.editorState;
- component.deleteSolution();
- expect(component.showSolutionDropDown).toBeTruthy();
- });
- it("#deleteSolution() should call deleteSolution and define mediaArr for video type", () => {
- component.editorState = mockData.editorState;
- component.selectedSolutionType = "video";
- component.deleteSolution();
- expect(component.mediaArr).toBeDefined();
- });
- it("#validateQuestionData() should call validateQuestionData and question is undefined", () => {
- component.editorState = mockData.editorState;
- component.editorState.question = undefined;
- component.validateQuestionData();
- expect(component.showFormError).toBeTruthy();
- });
- it("#validateQuestionData() should call validateQuestionData and questionInteractionType is default", () => {
- component.sourcingSettings = sourcingSettingsMock;
- component.editorState = mockData.defaultQuestionMetaData.result.question;
- component.editorState.question = " Hi how are you
";
- component.questionInteractionType = "default";
- component.editorState.answer = "0";
- component.validateQuestionData();
- expect(component.showFormError).toBeFalsy();
- });
-
- it("#validateQuestionData() should call validateQuestionData and questionInteractionType is default", () => {
- component.sourcingSettings = sourcingSettingsMock;
- component.editorState = mockData.defaultQuestionMetaData.result.question;
- component.questionInteractionType = "default";
- component.editorState.question = " Hi how are you
";
- component.editorState.answer = "";
- component.validateQuestionData();
- expect(component.showFormError).toBeTruthy();
- });
- it("#validateQuestionData() should call validateQuestionData and questionInteractionType is mcq", () => {
- component.sourcingSettings = sourcingSettingsMock;
- spyOn(treeService, "getFirstChild").and.callFake(() => {
- return { data: { metadata: { identifier: "0123",allowScoring:'Yes' } } };
- });
- component.editorState = mockData.mcqQuestionMetaData.result.question;
- editorService = TestBed.inject(EditorService);
- editorService.editorConfig.renderTaxonomy=false;
- component.editorState.question = " Hi how are you
";
- component.editorState.answer = "";
- component.questionInteractionType = "choice";
- component.validateQuestionData();
- });
-
- it("#validateQuestionData() should call validateQuestionData and questionInteractionType is mcq when scoring is added", () => {
- component.sourcingSettings = sourcingSettingsMock;
- spyOn(treeService, "getFirstChild").and.callFake(() => {
- return { data: { metadata: { identifier: "0123",allowScoring:'Yes' } } };
- });
- component.editorState = mockData.mcqQuestionMetaData.result.question;
- editorService = TestBed.inject(EditorService);
- editorService.editorConfig.renderTaxonomy=false;
- component.editorState.question = " Hi how are you
";
- component.editorState.answer = "";
- component.questionInteractionType = "choice";
- component.validateQuestionData();
- expect(component.showFormError).toBeFalsy();
- });
-
- it("#validateQuestionData() should call validateQuestionData and questionInteractionType is text", () => {
- component.sourcingSettings = sourcingSettingsMock;
- component.editorState = mockData.textQuestionNetaData.result.question;
- component.editorState.question = " Hi how are you
";
- component.questionInteractionType = "text";
- component.validateQuestionData();
- expect(component.showFormError).toBeFalsy();
- });
-
- it("#validateQuestionData() should call validateQuestionData and questionInteractionType is date", () => {
- component.sourcingSettings = sourcingSettingsMock;
- component.editorState = mockData.dateQuestionMetaDate.result.question;
- component.editorState.question = " Hi how are you
";
- component.questionInteractionType = "date";
- component.validateQuestionData();
- expect(component.showFormError).toBeFalsy();
- });
-
- it("#validateQuestionData() should call validateQuestionData and questionInteractionType is slider", () => {
- component.sourcingSettings = sourcingSettingsMock;
- component.editorState = mockData.sliderQuestionMetaData.result.question;
- component.editorState.question = " Hi how are you
";
- component.questionInteractionType = "slider";
- component.sliderDatas =
- mockData.sliderQuestionMetaData.result.question.interactions.response1;
- component.validateQuestionData();
- expect(component.showFormError).toBeFalsy();
- });
-
- it("#validateQuestionData() should call validateQuestionData and questionInteractionType is slider empty data", () => {
- component.sourcingSettings = sourcingSettingsMock;
- component.editorState = mockData.editorState;
- component.editorState.question = " Hi how are you
";
- component.questionInteractionType = "slider";
- component.sliderDatas = {};
- component.configService = configService;
- component.validateQuestionData();
- expect(component.showFormError).toBeTruthy();
- });
-
- it("call #sourcingUpdate() for sourcingRejectQuestion to verify inputs for #editorService.updateCollection", () => {
- component.creationContext = creationContextMock;
- spyOn(editorService, "fetchCollectionHierarchy").and.callFake(() => {
- return of(collectionHierarchyMock);
- });
- spyOn(editorService, "updateCollection").and.returnValue(of({}));
- const questionSet = collectionHierarchyMock.result["questionSet"];
- component.questionId = "do_11326368076523929611";
- component.actionType = "sourcingRejectQuestion";
- const data = {
- button: "sourcingRejectQuestion",
- comment: "test comment for rejection",
- };
- const requestBody = {
- request: {
- questionset: {
- rejectedContributions: [
- ...questionSet.rejectedContributions,
- component.questionId,
- ],
- rejectedContributionComments: {
- ...questionSet.rejectedContributionComments,
- do_11326368076523929611: data.comment,
- },
- },
- },
- };
- const toasterService = TestBed.inject(ToasterService);
- spyOn(toasterService, 'success').and.callFake(() => { });
- component.sourcingUpdate(data);
- });
-
- it("call #sourcingUpdate() for sourcingApproveQuestion to verify inputs for #editorService.updateCollection", () => {
- component.creationContext = creationContextMock;
- spyOn(editorService, "fetchCollectionHierarchy").and.returnValue(of());
- spyOn(questionService, "readQuestion").and.returnValue(
- of(readQuestionMock)
- );
- spyOn(editorService, "updateCollection").and.returnValue(of({}));
- const questionSet = collectionHierarchyMock.result["questionSet"];
- component.questionId = "do_11326368076523929611";
- component.actionType = "sourcingApproveQuestion";
- const data = { button: "sourcingApproveQuestion" };
- const requestBody = {
- request: {
- questionset: {
- acceptedContributions: [
- ...questionSet.acceptedContributions,
- component.questionId,
- ],
- },
- },
- };
- const toasterService = TestBed.inject(ToasterService);
- spyOn(toasterService, 'success').and.callFake(() => { });
- component.sourcingUpdate(data);
- // expect(editorService.updateCollection).toHaveBeenCalledWith('do_11330102570702438417', { ...data, requestBody });
- });
- it("#sourcingUpdate() should call #redirectToChapterList() for sourcingApproveQuestion", () => {
- spyOn(component, "redirectToChapterList");
- spyOn(editorService, "fetchCollectionHierarchy").and.returnValue(of());
- spyOn(questionService, "readQuestion").and.returnValue(
- of(readQuestionMock)
- );
- spyOn(editorService, "updateCollection").and.returnValue(of({}));
- component.creationContext = creationContextMock;
- component.questionId = "do_11326368076523929611";
- component.actionType = "sourcingApproveQuestion";
- const data = { button: "sourcingApproveQuestion" };
- const toasterService = TestBed.inject(ToasterService);
- spyOn(toasterService, 'success').and.callFake(() => { });
- component.sourcingUpdate(data);
- expect(component.redirectToChapterList);
- });
- it("#sourcingUpdate() should call #redirectToChapterList() for sourcingRejectQuestion api error", () => {
- spyOn(editorService, "fetchCollectionHierarchy").and.callFake(() => {
- return of(collectionHierarchyMock);
- });
- spyOn(editorService, "updateCollection").and.returnValue(of({}));
- component.creationContext = creationContextMock;
- component.questionId = "do_11326368076523929611";
- component.actionType = "sourcingRejectQuestion";
- const data = {
- button: "sourcingRejectQuestion",
- comment: "test comment for rejection",
- };
- spyOn(editorService, "addResourceToQuestionset").and.returnValue(
- throwError({})
- );
- component.sourcingUpdate(data);
- component.addResourceToQuestionset();
- });
-
- it("#sourcingUpdate() should call #redirectToChapterList() for sourcingRejectQuestion", () => {
- spyOn(editorService, "fetchCollectionHierarchy").and.callFake(() => {
- return of(collectionHierarchyMock);
- });
- spyOn(editorService, "updateCollection").and.returnValue(of({}));
- component.creationContext = creationContextMock;
- component.questionId = "do_11326368076523929611";
- component.actionType = "sourcingRejectQuestion";
- const data = {
- button: "sourcingRejectQuestion",
- comment: "test comment for rejection",
- };
- spyOn(editorService, "addResourceToQuestionset").and.returnValue(of({}));
- component.sourcingUpdate(data);
- component.addResourceToQuestionset();
- });
-
- it("#videoDataOutput() should call videoDataOutput and event data is empty", () => {
- const event = "";
- spyOn(component, "deleteSolution");
- component.videoDataOutput(event);
- expect(component.deleteSolution).toHaveBeenCalled();
- });
- it("#videoDataOutput() should call videoDataOutput and event data is not empty", () => {
- const event = { name: "event name", identifier: "1234" };
- component.videoDataOutput(event);
- expect(component.videoSolutionData).toBeDefined();
- });
- it("#videoDataOutput() should call videoDataOutput for thumbnail", () => {
- const event = {
- name: "event name",
- identifier: "1234",
- thumbnail: "sample data",
- };
- component.videoDataOutput(event);
- expect(component.videoSolutionData).toBeDefined();
- });
- it("#videoDataOutput() should call videoDataOutput for thumbnail", () => {
- const event = {
- name: "event name",
- identifier: "1234",
- thumbnail: "sample data",
- };
- component.videoDataOutput(event);
- expect(component.videoSolutionData).toBeDefined();
- });
- it("#subMenuChange() should set the sub-menu value ", () => {
- spyOn(component,'subMenuChange').and.callThrough();
- component.subMenus = mockData.subMenus;
- component.showFormError=false;
- spyOn(component, 'saveContent').and.callFake(() => {});
- component.subMenuChange({ index: 1, value: "test" });
- expect(component.subMenus[1].value).toBe("test");
- });
- it("#subMenuChange() should set the sub-menu value for dependent question forerror is true ", () => {
- spyOn(component,'subMenuChange').and.callThrough();
- component.subMenus = mockData.subMenus;
- component.showFormError=false;
- spyOn(component, 'saveContent').and.callFake(() => {});
- component.subMenuChange({ index: 2, value: [{ id: 1 }] });
- expect(component.subMenus[2].value).toEqual([{ id: 1 }]);
- expect(component.showAddSecondaryQuestionCat).toBeTruthy();
- });
- it("#dependentQuestions() should return dependentQuestions ", () => {
- spyOn(component, 'subMenuChange').and.callThrough();
- spyOn(component, 'saveContent').and.callFake(() => {});
- component.subMenus = mockData.subMenus;
- component.subMenuChange({ index: 2, value: "test" });
- // expect(component.dependentQuestions.length).toBe(1);
- expect(component.showAddSecondaryQuestionCat).toBeTruthy();
- });
-
- it("#saveContent() should call saveContent when questionId exits ", () => {
- spyOn(component, "validateQuestionData");
- spyOn(component, "validateFormFields");
- spyOn(component, "saveQuestion");
- spyOn(component, "updateQuestion");
- spyOn(component, "buildCondition");
- component.creationContext.objectType='questionSet';
- component.creationContext.mode='submit'
- component.questionId = "do_1134355571590184961168";
- component.selectedSectionId = "do_1134347209749299201119";
- component.showFormError = false;
- component.showOptions = true;
- component.isChildQuestion = true;
- component.condition = "eq";
- component.selectedOptions = 1;
- component.updateQuestion();
- component.buildCondition("update");
- component.updateTreeCache(
- "Mid-day Meals",
- BranchingLogic,
- component.selectedSectionId
- );
- component.saveContent();
- expect(component.saveQuestion).toHaveBeenCalled();
- expect(component.updateQuestion).toHaveBeenCalled();
- expect(component.buildCondition).toHaveBeenCalled();
- });
-
- it("#buildCondition() should call when it is a child question save", () => {
- spyOn(component, "buildCondition");
- component.questionId = "do_1134355571590184961168";
- component.selectedSectionId = "do_1134347209749299201119";
- component.condition = "eq";
- component.selectedOptions = 1;
- component.branchingLogic = BranchingLogic;
- component.showAddSecondaryQuestionCat = true;
- spyOn(component, "saveQuestions").and.callThrough();
- component.buildCondition("update");
- component.updateTreeCache(
- "Mid-day Meals",
- BranchingLogic,
- component.selectedSectionId
- );
- expect(component.buildCondition).toHaveBeenCalled();
- });
-
- it("#saveQuestions call on click save button", () => {
- spyOn(component, "saveQuestions");
- spyOn(questionService, "updateHierarchyQuestionCreate").and.callFake(() => {
- return of({
- result: {
- identifiers: {
- "1245": "do_123",
- },
- },
- });
- });
- component.saveQuestions(
- mockData.mcqQuestionMetaData.result.question,
- "create"
- );
- expect(component.saveQuestion);
- });
-
- it("#saveQuestions call on click save button for update api success", () => {
- spyOn(questionService, "updateHierarchyQuestionCreate").and.callFake(() => {
- return of({
- result: {
- identifiers: {
- "1245": "do_123",
- },
- },
- });
- });
- component.saveQuestions(
- mockData.mcqQuestionMetaData.result.question,
- "update"
- );
- });
-
- it("#saveQuestions call on click save button for update api success", () => {
- spyOn(questionService, "updateHierarchyQuestionCreate").and.returnValue(
- throwError("error")
- );
- component.saveQuestions(
- mockData.mcqQuestionMetaData.result.question,
- "update"
- );
- });
-
- it("#updateTarget() should call when buildcondition is called ", () => {
- spyOn(component, "updateTarget").and.callThrough();
- component.questionId = "do_1134355571590184961168";
- component.branchingLogic = BranchingLogic;
- component.updateTarget(component.questionId);
- expect(component.updateTarget).toHaveBeenCalledWith(component.questionId);
- });
-
- it("#getOptions() should call when child question is edited when option exits", () => {
- spyOn(component, "getOptions").and.callThrough();
- editorService.optionsLength = 4;
- component.getOptions();
- expect(component.getOptions).toHaveBeenCalled();
- });
- it("#getOptions() should call when child question is edited when option not exits", () => {
- spyOn(component, "getOptions").and.callThrough();
- editorService.optionsLength = undefined;
- component.getOptions();
- expect(component.getOptions).toHaveBeenCalled();
- });
-
- it("#getParentQuestionOptions() should call when add dependent question clicked", () => {
- spyOn(component, "getParentQuestionOptions").and.callThrough();
- spyOn(questionService, "readQuestion").and.returnValue(
- of(readQuestionMock)
- );
- component.questionId = "do_1134355571590184961168";
- editorService.parentIdentifier = component.questionId;
- component.getParentQuestionOptions(component.questionId);
- expect(component.getParentQuestionOptions).toHaveBeenCalled();
- });
-
- it("#updateTreeCache() should call when buildcondition is called ", () => {
- component.selectedSectionId='do_1234'
- component.updateTreeCache(
- "Mid-day Meals",
- BranchingLogic,
- component.selectedSectionId
- );
- });
-
- it("#setCondition() should call when buildcondition is called ", () => {
- spyOn(component, "setCondition").and.callThrough();
- component.questionId = "do_1134355571590184961168";
- let data = {
- branchingLogic: BranchingLogic,
- };
- component.setCondition(data);
- expect(component.setCondition).toHaveBeenCalledWith(data);
- });
-
- it("#subMenuConfig() should call when question page render setChildQuestion is true", () => {
- component.questionMetaData = mockData.mcqQuestionMetaData.result.question;
- sourcingSettingsMock.showAddSecondaryQuestion = true;
- component.questionMetaData.hints = {
- en: [],
- };
- sourcingSettingsMock.showAddHints = false;
- component.sourcingSettings = sourcingSettingsMock;
- component.questionInput.setChildQuestion = true;
- component.subMenuConfig();
- });
-
- it("#subMenuConfig() should call when question page render setChildQuestion is false", () => {
- component.questionMetaData = mockData.mcqQuestionMetaData.result.question;
- component.sourcingSettings = sourcingSettingsMock;
- component.questionInput.setChildQuestion = false;
- component.subMenuConfig();
- });
-
- it("#sliderData() should call when slider question is called", () => {
- spyOn(component, "sliderData").and.callThrough();
- const event = {
- leftAnchor: 0,
- rightAnchor: 10,
- step: 1,
- };
- component.sliderData(event);
- expect(component.sliderData).toHaveBeenCalledWith(event);
- });
-
- it("#getResponseDeclaration() should call for question save", () => {
- component.maxScore = 1;
- spyOn(component, "getResponseDeclaration").and.callThrough();
- const responseDecleration = component.getResponseDeclaration("slider");
- expect(component.getResponseDeclaration).toHaveBeenCalled();
- expect(responseDecleration.response1['maxScore']).toEqual(1);
- });
-
- it("#saveUpdateQuestions call on click save button api fail case", () => {
- component.questionId = "1245";
- component.showAddSecondaryQuestionCat = true;
-
- component.editorState = mockData.mcqQuestionMetaData.result.question;
- const metaData = mockData.mcqQuestionMetaData.result.question;
- component.childFormData = childMetaData;
- component.subMenus = mockData.subMenus;
- component.questionInteractionType = "choice";
- component.getQuestionMetadata();
- component.setQuestionTypeValues(metaData);
- spyOn(questionService, "updateHierarchyQuestionUpdate").and.returnValue(
- throwError("error")
- );
- component.saveUpdateQuestions();
- });
-
- it("#saveUpdateQuestions call on click save button api success", () => {
- component.questionId = "1245";
- component.showAddSecondaryQuestionCat = true;
-
- component.editorState = mockData.mcqQuestionMetaData.result.question;
- const metaData = mockData.mcqQuestionMetaData.result.question;
- component.childFormData = childMetaData;
- component.subMenus = mockData.subMenus;
- component.questionInteractionType = "choice";
- component.getQuestionMetadata();
- component.setQuestionTypeValues(metaData);
- spyOn(questionService, "updateHierarchyQuestionUpdate").and.callFake(() => {
- return of({
- result: {
- identifiers: {
- "1245": "do_123",
- },
- },
- });
- });
- component.saveUpdateQuestions();
- });
-
- it("#setQuestionTypeValues call when question showEvidence is yes", () => {
- const metaData = mockData.mcqQuestionMetaData.result.question;
- childMetaData.allowMultiSelect = "No";
- component.childFormData = childMetaData;
- component.subMenus = mockData.subMenus;
- component.questionInteractionType = "choice";
- component.setQuestionTypeValues(metaData);
- });
-
- it("#setQuestionTypeValues call when question howEvidence is no", () => {
- let metaData = mockData.mcqQuestionMetaData.result.question;
- childMetaData.showEvidence = "No";
- childMetaData.showRemarks = "Yes";
- component.childFormData = childMetaData;
- component.subMenus = mockData.subMenus;
- component.questionInteractionType = "choice";
- component.setQuestionTypeValues(metaData);
- });
-
- it("#setQuestionTypeValues call when question for slider", () => {
- const metaData = mockData.sliderQuestionMetaData.result.question;
- component.childFormData = childMetaData;
- component.subMenus = mockData.subMenus;
- component.sliderDatas =
- mockData.sliderQuestionMetaData.result.question.interactions.response1;
- component.questionInteractionType = "slider";
- component.setQuestionTypeValues(metaData);
- });
-
- it("#setQuestionTypeValues call when question for mcq", () => {
- const metaData = mockData.mcqQuestionMetaData.result.question;
- component.childFormData = childMetaData;
- component.subMenus = mockData.subMenus;
- component.questionInteractionType = "choice";
- component.setQuestionTypeValues(metaData);
- });
-
- it("#setQuestionTypeValues call when question for text", () => {
- const metaData = mockData.textQuestionNetaData.result.question;
- component.questionPrimaryCategory = metaData.primaryCategory;
- component.childFormData = childMetaData;
- component.subMenus = mockData.subMenus;
- component.questionInteractionType = "text";
- component.setQuestionTypeValues(metaData);
- });
-
- it("#saveQuestions call on click save button", () => {
- spyOn(component, "saveQuestions");
- const metaData = mockData.textQuestionNetaData.result.question;
- spyOn(questionService, "updateHierarchyQuestionCreate").and.callFake(() => {
- return of({
- result: {
- identifiers: {
- "1245": "do_123",
- },
- },
- });
- });
- component.saveQuestions(metaData, "create");
- expect(component.saveQuestion);
- });
-
- it("#saveQuestions call on click save button api fail", () => {
- spyOn(component, "saveQuestions");
- const metaData = mockData.textQuestionNetaData.result.question;
- spyOn(questionService, "updateHierarchyQuestionCreate").and.returnValue(
- throwError("error")
- );
- component.saveQuestions(metaData, "update");
- expect(component.saveQuestion);
- });
-
- it("#prepareRequestBody call when question save called slider", () => {
- spyOn(treeService, "getFirstChild").and.callFake(() => {
- return { data: { metadata: { identifier: "0123",allowScoring:'Yes' } } };
- });
- spyOn(treeService, "getActiveNode").and.callFake(() => {
- return { data: { root: true } };
- });
- const metaData = mockData.sliderQuestionMetaData.result.question;
- component.questionPrimaryCategory = metaData.primaryCategory;
- component.childFormData = childMetaData;
- component.subMenus = mockData.subMenus;
- component.questionInteractionType = "slider";
- component.setQuestionTypeValues(metaData);
- component.prepareQuestionBody();
- });
-
- it("#prepareRequestBody call when question save called text", () => {
- spyOn(treeService, "getFirstChild").and.callFake(() => {
- return { data: { metadata: { identifier: "0123",allowScoring:'Yes' } } };
- });
- spyOn(treeService, "getActiveNode").and.callFake(() => {
- return { data: { root: true } };
- });
- const metaData = mockData.textQuestionNetaData.result.question;
- component.questionPrimaryCategory = metaData.primaryCategory;
- component.childFormData = childMetaData;
- component.subMenus = mockData.subMenus;
- component.questionInteractionType = "text";
- component.getQuestionMetadata();
- component.setQuestionTypeValues(metaData);
- component.prepareQuestionBody();
- });
-
- it("#setQuestionTitle() should set #toolbarConfig.title for question", () => {
- creationContextMock.objectType = "questionSet";
- component.questionId = "do_123";
- component.creationContext = creationContextMock;
- component.questionPrimaryCategory = "";
- component.setQuestionTitle();
- expect(component.questionId).toEqual("do_123");
- });
-
- it("#upsertQuestion() should call on question save api false case", () => {
- spyOn(treeService, "getFirstChild").and.callFake(() => {
- return { data: { metadata: { identifier: "0123",allowScoring:'Yes' } } };
- });
- const metaData = mockData.textQuestionNetaData.result.question;
- component.questionPrimaryCategory = metaData.primaryCategory;
- component.childFormData = childMetaData;
- component.subMenus = mockData.subMenus;
- component.questionInteractionType = "text";
- component.getQuestionMetadata();
- component.setQuestionTypeValues(metaData);
- component.prepareQuestionBody();
- const event = { button: "saveContent" };
- component.actionType = event.button;
- spyOn(questionService, "upsertQuestion").and.returnValue(
- of({
- result: {
- identifiers: {
- "1234": "do_123",
- },
- },
- })
- );
- component.upsertQuestion("");
- });
-
- it("#upsertQuestion() should call on question save api false case", () => {
- spyOn(treeService, "getFirstChild").and.callFake(() => {
- return { data: { metadata: { identifier: "0123",allowScoring:'Yes' } } };
- });
- const metaData = mockData.textQuestionNetaData.result.question;
- component.questionPrimaryCategory = metaData.primaryCategory;
- component.childFormData = childMetaData;
- component.subMenus = mockData.subMenus;
- component.questionInteractionType = "text";
- component.getQuestionMetadata();
- component.setQuestionTypeValues(metaData);
- component.prepareQuestionBody();
- spyOn(questionService, "upsertQuestion").and.returnValue(
- throwError("error")
- );
- spyOn(editorService, "apiErrorHandling").and.callFake(() => {});
- component.upsertQuestion("");
- });
-
- it("#updateQuestion() should call on question save isChildQuestion is true", () => {
- component.editorState = mockData.mcqQuestionMetaData.result.question;
- component.questionId = "do_11326368076523929611";
- component.showOptions = true;
- component.questionId = "do_1134355571590184961168";
- component.selectedSectionId = "do_1134347209749299201119";
- component.showFormError = false;
- component.showOptions = true;
- component.isChildQuestion = true;
- component.condition = "eq";
- component.selectedOptions = 1;
- component.sourcingSettings=sourcingSettingsMock;
- component.childFormData=childMetaData;
- component.saveContent();
- component.updateQuestion();
- component.buildCondition("update");
- component.updateTreeCache(
- "Mid-day Meals",
- BranchingLogic,
- component.selectedSectionId
- );
- spyOn(questionService, "updateHierarchyQuestionUpdate").and.callFake(() => {
- return of({
- result: {
- identifiers: {
- "1245": "do_123",
- },
- },
- });
- });
- component.saveUpdateQuestions();
- component.updateQuestion();
- });
-
- it("#updateQuestion() should call on question save isChildQuestion is false", () => {
- spyOn(component,'updateQuestion').and.callThrough();
- component.sourcingSettings=sourcingSettingsMock;
- component.childFormData=childMetaData;
- component.isChildQuestion=false;
- component.questionId='1245'
- component.showAddSecondaryQuestionCat=true;
- spyOn(questionService, "updateHierarchyQuestionUpdate").and.callFake(() => {
- return of({
- result: {
- identifiers: {
- "1245": "do_123",
- },
- },
- });
- });
- spyOn(component, 'saveUpdateQuestions').and.callFake(()=>{});
- component.updateQuestion();
- expect(component.saveUpdateQuestions).toHaveBeenCalled();
- });
-
- xit("#updateQuestion() should call on question save isChildQuestion is false api fail", () => {
- spyOn(component,'updateQuestion').and.callThrough();
- component.sourcingSettings=sourcingSettingsMock;
- component.childFormData=childMetaData;
- component.isChildQuestion=false;
- component.questionId='1245'
- component.showAddSecondaryQuestionCat=true;
- spyOn(questionService, "updateHierarchyQuestionUpdate").and.returnValue(throwError('error'))
- component.saveUpdateQuestions();
- component.updateQuestion();
- });
-
- it('#getBranchingLogic should call for branchingLogic', () => {
- spyOn(component, 'getBranchingLogic').and.callThrough();
- component.getBranchingLogic(RubricData);
- expect(RubricData[0].allowBranching).toBe('Yes');
- })
-
- it("#toolbarEventListener() should call toolbarEventListener for saveQualityParameters", () => {
- const data = { button: "saveQualityParameters" };
- component.showQualityParameterPopup = true;
- component.toolbarEventListener(data);
- expect(component.showQualityParameterPopup).toBeTruthy();
- });
-
- it("#openRequestChangesPopup should be called", () => {
- spyOn(component, "openRequestChangesPopup").and.callThrough();
- component.requestChangesPopupAction = "rejectQuestion";
- component.openRequestChangesPopup();
- expect(component.requestChangesPopupAction).toBe("rejectQuestion");
- });
-
- it("#calculateMinMaxScore should be called", () => {
- const metaData = mockData.mcqQuestionMetaData.result.question;
- childMetaData.allowMultiSelect = "No";
- component.childFormData = childMetaData;
- component.subMenus = mockData.subMenus;
- component.questionInteractionType = "choice";
- spyOn(component, "setQuestionTypeValues").and.callThrough();
- spyOn(component, "calculateMinMaxScore").and.callThrough();
- component.setQuestionTypeValues(metaData);
- expect(component.calculateMinMaxScore).toHaveBeenCalledWith(metaData);
- });
-
- it("buildCondition should call #setQuestionTypeValues()", () => {
- spyOn(component, "buildCondition").and.callThrough();
- spyOn(component, "setQuestionTypeValues");
- const metaData = mockData.mcqQuestionMetaData.result.question;
- childMetaData.allowMultiSelect = "No";
- component.childFormData = childMetaData;
- component.subMenus = mockData.subMenus;
- component.questionInteractionType = "choice";
- component.buildCondition("create");
- component.setQuestionTypeValues(metaData);
- expect(component.setQuestionTypeValues).toHaveBeenCalledWith(metaData);
- });
-
-});
diff --git a/projects/collection-editor-library/src/lib/components/question/question.component.ts b/projects/collection-editor-library/src/lib/components/question/question.component.ts
deleted file mode 100644
index 8fafd5957..000000000
--- a/projects/collection-editor-library/src/lib/components/question/question.component.ts
+++ /dev/null
@@ -1,1553 +0,0 @@
-import { Component, EventEmitter, Input, OnInit, Output, AfterViewInit, ViewEncapsulation, OnDestroy } from '@angular/core';
-import * as _ from 'lodash-es';
-import { v4 as uuidv4 } from 'uuid';
-import { McqForm } from '../../interfaces/McqForm';
-import { ServerResponse } from '../../interfaces/serverResponse';
-import { QuestionService } from '../../services/question/question.service';
-import { PlayerService } from '../../services/player/player.service';
-import { EditorTelemetryService } from '../../services/telemetry/telemetry.service';
-import { EditorService } from '../../services/editor/editor.service';
-import { ToasterService } from '../../services/toaster/toaster.service';
-import { throwError, Subject} from 'rxjs';
-import { Router } from '@angular/router';
-import { ConfigService } from '../../services/config/config.service';
-import { FrameworkService } from '../../services/framework/framework.service';
-import { TreeService } from '../../services/tree/tree.service';
-import { EditorCursor } from '../../collection-editor-cursor.service';
-import { filter, finalize, take, takeUntil } from 'rxjs/operators';
-import { SubMenu } from '../question-option-sub-menu/question-option-sub-menu.component';
-import { ICreationContext } from '../../interfaces/CreationContext';
-
-const evidenceMimeType='';
-const evidenceSizeLimit='20480';
-
-@Component({
- selector: 'lib-question',
- templateUrl: './question.component.html',
- styleUrls: ['./question.component.scss'],
- encapsulation: ViewEncapsulation.None,
-})
-export class QuestionComponent implements OnInit, AfterViewInit, OnDestroy {
- QumlPlayerConfig: any = {};
- @Input() questionInput: any;
- @Input() leafFormConfig: any;
- @Input() sourcingSettings: any;
- public initialLeafFormConfig: any;
- public childFormData: any;
- @Output() questionEmitter = new EventEmitter();
- private onComponentDestroy$ = new Subject();
- toolbarConfig: any = {};
- public terms = false;
- public editorState: any = {};
- public showPreview = false;
- public mediaArr: any = [];
- public videoShow = false;
- public showFormError = false;
- public actionType: string;
- selectedSolutionType: string;
- selectedSolutionTypeIndex: string;
- showSolutionDropDown = true;
- showSolution = false;
- videoSolutionName: string;
- videoSolutionData: any;
- videoThumbnail: string;
- solutionUUID: string;
- solutionValue: string;
- solutionTypes: any = [{
- type: 'html',
- value: 'Text+Image'
- },
- {
- type: 'video',
- value: 'video'
- }];
- questionMetaData: any;
- questionInteractionType;
- questionCategory;
- questionId;
- creationContext: ICreationContext;
- creationMode;
- tempQuestionId;
- questionSetId;
- unitId;
- public setCharacterLimit = 160;
- public showLoader = true;
- public isReadOnlyMode = false;
- public contentComment : string;
- public showReviewModal: boolean = false;
- questionSetHierarchy: any;
- showConfirmPopup = false;
- showSubmitConfirmPopup = false;
- validQuestionData = false;
- questionPrimaryCategory: string;
- pageId = 'question';
- pageStartTime: any;
- public framework;
- public frameworkDetails: any = {};
- public questionMetadataFormStatus = true;
- public buttonLoaders = {
- saveButtonLoader: false,
- review: false
- };
- public showTranslation = false;
- subMenus: SubMenu[];
- showAddSecondaryQuestionCat: boolean;
- sliderDatas: any = {};
- sliderOptions: any = {};
- hints: any;
- categoryLabel: any = {};
- scoreMapping: any;
- condition = 'default';
- targetOption: any;
- responseVariable = 'response1';
- newQuestionID: any;
- showOptions: boolean;
- selectedOptions: any;
- options = [];
- isChildQuestion = false;
- branchingLogic: any;
- selectedSectionId: any;
- sectionPrimaryCategory: any;
- maxScore = 1;
- public questionFormConfig: any;
- treeNodeData:any;
- showQualityParameterPopup: boolean =false;
- public qualityFormConfig: any;
- requestChangesPopupAction: string;
- constructor(
- private questionService: QuestionService, public editorService: EditorService, public telemetryService: EditorTelemetryService,
- public playerService: PlayerService, private toasterService: ToasterService, private treeService: TreeService,
- private frameworkService: FrameworkService, private router: Router, public configService: ConfigService,
- private editorCursor: EditorCursor) {
- const { primaryCategory, label } = this.editorService.selectedChildren;
- this.questionPrimaryCategory = primaryCategory;
- this.pageStartTime = Date.now();
- this.categoryLabel = [];
- this.getOptions();
- if (!_.isUndefined(label)) {
- this.categoryLabel[primaryCategory] = label;
- }
- }
-
- ngOnInit() {
- const { questionSetId, questionId, type, category, creationContext, creationMode } = this.questionInput;
- this.questionInteractionType = type;
- this.questionCategory = category;
- this.questionId = questionId;
- this.questionSetId = questionSetId;
- this.creationContext = creationContext;
- this.creationMode = creationMode;
- this.unitId = this.creationContext?.unitIdentifier;
- this.isReadOnlyMode = this.creationContext?.isReadOnlyMode;
- this.toolbarConfig = this.editorService.getToolbarConfig();
- this.toolbarConfig.showPreview = this.editorService.editorMode !== 'edit';
- this.toolbarConfig.add_translation = true;
- this.treeNodeData = this.treeService.getFirstChild();
- if (_.get(this.creationContext, 'objectType') === 'question') { this.toolbarConfig.questionContribution = true; }
- this.solutionUUID = uuidv4();
- this.telemetryService.telemetryPageId = this.pageId;
- this.initialLeafFormConfig = _.cloneDeep(this.leafFormConfig);
- this.initialize();
- this.framework = _.get(this.editorService.editorConfig, 'context.framework');
- this.qualityFormConfig = this.editorService.qualityFormConfig;
- }
-
- fetchFrameWorkDetails() {
- this.frameworkService.frameworkData$.pipe(takeUntil(this.onComponentDestroy$),
- filter(data => _.get(data, `frameworkdata.${this.framework}`)), take(1)).subscribe((frameworkDetails: any) => {
- if (frameworkDetails && !frameworkDetails.err) {
- const frameworkData = frameworkDetails.frameworkdata[this.framework].categories;
- this.frameworkDetails.frameworkData = frameworkData;
- this.frameworkDetails.topicList = _.get(_.find(frameworkData, { code: 'topic' }), 'terms');
- this.populateFrameworkData();
- }
- });
- }
-
- populateFrameworkData() {
- const categoryMasterList = this.frameworkDetails.frameworkData;
- _.forEach(categoryMasterList, (category) => {
- _.forEach(this.leafFormConfig, (formFieldCategory) => {
- if (category.code === formFieldCategory.code) {
- formFieldCategory.terms = category.terms;
- }
- });
- });
- this.questionFormConfig = _.cloneDeep(this.leafFormConfig);
- }
-
- ngAfterViewInit() {
- this.telemetryService.impression({
- type: 'edit', pageid: this.telemetryService.telemetryPageId, uri: this.router.url,
- duration: (Date.now() - this.pageStartTime) / 1000
- });
- }
-
- initialize() {
- this.editorService.fetchCollectionHierarchy(this.questionSetId).subscribe((response) => {
- this.questionSetHierarchy = _.get(response, 'result.questionSet');
- const parentId = this.editorService.parentIdentifier ? this.editorService.parentIdentifier : this.questionId;
- //only for observation,survey,observation with rubrics
- if (!_.isUndefined(parentId) && !_.isUndefined(this.editorService.editorConfig.config.renderTaxonomy)) {
- this.getParentQuestionOptions(parentId);
- const sectionData = this.treeService.getNodeById(parentId);
- const children = _.get(response, 'result.questionSet.children');
- this.sectionPrimaryCategory = _.get(response, 'result.questionSet.primaryCategory');
- this.selectedSectionId = _.get(sectionData, 'data.metadata.parent');
- this.getBranchingLogic(children);
- }
- this.questionFormConfig = _.cloneDeep(this.leafFormConfig);
- let leafFormConfigFields = _.join(_.map(this.leafFormConfig, value => (value.code)), ',');
- leafFormConfigFields += ',isReviewModificationAllowed';
- if (!_.isUndefined(this.questionId)) {
- this.questionService.readQuestion(this.questionId, leafFormConfigFields)
- .subscribe((res) => {
- if (_.get(res, 'result')) {
- this.questionMetaData = _.get(res, 'result.question');
- this.questionPrimaryCategory = _.get(this.questionMetaData,'primaryCategory');
- // tslint:disable-next-line:max-line-length
- this.questionInteractionType = _.get(this.questionMetaData,'interactionTypes') ? _.get(this.questionMetaData,'interactionTypes[0]') : 'default';
- this.editorService.setIsReviewModificationAllowed(_.get(this.questionMetaData, 'isReviewModificationAllowed', false));
- this.populateFormData();
- if (this.questionInteractionType === 'default') {
- if (this.questionMetaData.editorState) {
- this.editorState = this.questionMetaData.editorState;
- }
- }
-
- if (this.questionInteractionType === 'slider') {
- if (this.questionMetaData.editorState) {
- this.editorState = this.questionMetaData.editorState;
- this.sliderOptions = this.questionMetaData.interactions.response1;
- this.sliderDatas = this.questionMetaData.interactions.response1;
- this.hints = this.questionMetaData.hints;
- }
- }
-
- if (this.questionInteractionType === 'text') {
- if (this.questionMetaData.editorState) {
- this.editorState = this.questionMetaData.editorState;
- }
- }
-
- if (this.questionInteractionType === 'date') {
- if (this.questionMetaData.editorState) {
- this.editorState = this.questionMetaData.editorState;
- }
- }
-
- if (this.questionInteractionType === 'choice') {
- const responseDeclaration = this.questionMetaData.responseDeclaration;
- this.scoreMapping = _.get(responseDeclaration, 'response1.mapping');
- const templateId = this.questionMetaData.templateId;
- const numberOfOptions = this.questionMetaData?.editorState?.options?.length || 0;
- const maximumOptions = _.get(this.questionInput, 'config.maximumOptions');
- this.editorService.optionsLength = numberOfOptions;
- const options = _.map(this.questionMetaData?.editorState?.options, option => ({ body: option.value.body }));
- const question = this.questionMetaData?.editorState?.question;
- const interactions = this.questionMetaData?.interactions;
- this.editorState = new McqForm({
- question, options, answer: _.get(responseDeclaration, 'response1.correctResponse.value')
- }, { templateId, numberOfOptions,maximumOptions });
- this.editorState.solutions = this.questionMetaData?.editorState?.solutions;
- this.editorState.interactions = interactions;
- if (_.has(this.questionMetaData, 'responseDeclaration')) {
- this.editorState.responseDeclaration = _.get(this.questionMetaData, 'responseDeclaration');
- }
- }
- if (_.has(this.questionMetaData, 'primaryCategory')) {
- this.editorState.primaryCategory = _.get(this.questionMetaData, 'primaryCategory');
- }
- this.setQuestionTitle(this.questionId);
- if (!_.isEmpty(this.editorState.solutions)) {
- this.selectedSolutionType = this.editorState.solutions[0].type;
- this.solutionUUID = this.editorState.solutions[0].id;
- this.showSolutionDropDown = false;
- this.showSolution = true;
- if (this.selectedSolutionType === 'video') {
- const index = _.findIndex(this.questionMetaData.media, (o) => {
- return o.type === 'video' && o.id === this.editorState.solutions[0].value;
- });
- this.videoSolutionName = this.questionMetaData.media[index].name;
- this.videoThumbnail = this.questionMetaData.media[index].thumbnail;
- }
- if (this.selectedSolutionType === 'html') {
- this.editorState.solutions = this.editorState.solutions[0].value;
- }
- }
- if (this.questionMetaData.media) {
- this.mediaArr = this.questionMetaData.media;
- }
- /** for observation and survey to show hint,tip,dependent question option. */
- if(!_.isUndefined(this.editorService?.editorConfig?.config?.renderTaxonomy)){
- this.subMenuConfig();
- }
- this.contentComment = _.get(this.creationContext, 'correctionComments');
- if (this.showPreview) {
- this.previewContent();
- }
- this.showLoader = false;
- }
- }, (err: ServerResponse) => {
- const errInfo = {
- errorMsg: 'Fetching question details failed. Please try again...',
- };
- return throwError(this.editorService.apiErrorHandling(err, errInfo));
- });
- }
- if (_.isUndefined(this.questionId)) {
- this.tempQuestionId = uuidv4();
- this.populateFormData();
- this.setQuestionTitle();
- let editorState = {}
- if (this.questionInteractionType === 'default') {
- if (this.questionCategory) {
- editorState = _.get(this.configService, `editorConfig.defaultStates.nonInteractiveQuestions.${this.questionCategory}`);
- } else {
- this.editorState = { question: '', answer: '', solutions: '' };
- }
- this.editorState = { ...editorState };
- }
- else if (this.questionInteractionType === 'choice') {
- this.editorState = new McqForm({ question: '', options: [] }, { numberOfOptions: _.get(this.questionInput, 'config.numberOfOptions'), maximumOptions: _.get(this.questionInput, 'config.maximumOptions') });
- }
- /** for observation and survey to show hint,tip,dependent question option. */
- if(!_.isUndefined(this.editorService?.editorConfig?.config?.renderTaxonomy)){
- this.subMenuConfig();
- }
- this.showLoader = false;
- }
- }, (err: ServerResponse) => {
- const errInfo = {
- errorMsg: 'Fetching question set details failed. Please try again...',
- };
- this.editorService.apiErrorHandling(err, errInfo);
- });
- }
-
- get contentPolicyUrl() {
- return this.editorService.contentPolicyUrl;
- }
-
- toolbarEventListener(event) {
- this.actionType = event.button;
- switch (event.button) {
- case 'saveContent':
- this.showAddSecondaryQuestionCat = false;
- this.saveContent();
- break;
- case 'showTranslation':
- this.showTranslation = true;
- break;
- case 'submitQuestion':
- this.submitHandler();
- break;
- case 'cancelContent':
- this.handleRedirectToQuestionset();
- break;
- case 'rejectQuestion':
- this.rejectQuestion(event.comment);
- break;
- case 'publishQuestion':
- this.publishQuestion(event);
- break;
- case 'sourcingApproveQuestion':
- this.sourcingUpdate(event);
- break;
- case 'sourcingRejectQuestion':
- this.sourcingUpdate(event);
- break;
- case 'sendForCorrectionsQuestion':
- this.sendBackQuestion(event);
- break;
- case 'backContent':
- this.handleRedirectToQuestionset();
- break;
- case 'previewContent':
- this.previewContent();
- break;
- case 'editContent':
- this.isReadOnlyMode = false;
- this.showPreview = false;
- this.toolbarConfig.showPreview = false;
- this.previewFormData(!this.toolbarConfig.showPreview);
- break;
- case 'showReviewcomments':
- this.showReviewModal = !this.showReviewModal;
- break;
- case 'saveQualityParameters' :
- this.showQualityParameterPopup = true;
- break;
- default:
- break;
- }
- }
-
- handleRedirectToQuestionset() {
- if (_.isUndefined(this.questionId) || this.creationMode === 'edit') {
- this.showConfirmPopup = true;
- } else {
- this.redirectToQuestionset();
- }
- }
-
-
- submitHandler() {
- this.validateQuestionData();
- this.validateFormFields();
- if (this.showFormError === false) {
- this.showSubmitConfirmPopup = true;
- }
- }
-
- saveContent() {
- this.validateQuestionData();
- if (this.showFormError === false && this.questionMetadataFormStatus === true) {
- this.saveQuestion();
- } else {
- this.toasterService.error(_.get(this.configService, 'labelConfig.messages.error.044'));
- }
- }
-
- onConsentSubmit(event) {
- this.showSubmitConfirmPopup = false;
- if (event) {
- this.questionMetaData = _.assign(this.questionMetaData, {isReviewModificationAllowed: event.editingConsent});
- this.sendForReview();
- }
- }
-
- sendForReview() {
- if (!_.get(this.editorService.editorConfig, 'config.skipTwoLevelReview')) {
- let callback = function () {
- this.editorService.reviewContent(this.questionId).subscribe(data => {
- this.toasterService.success(_.get(this.configService, 'labelConfig.messages.success.002'));
- this.redirectToChapterList();
- }, err => {
- this.toasterService.error(_.get(this.configService, 'labelConfig.messages.error.002'));
- });
- };
- if (!this.questionId) {
- callback = function () {
- this.editorService.reviewContent(this.questionId).subscribe(data => {
- this.toasterService.success(_.get(this.configService, 'labelConfig.messages.success.002'));
- this.addResourceToQuestionset();
- }, err => {
- this.toasterService.error(_.get(this.configService, 'labelConfig.messages.error.002'));
- });
- };
- }
- callback = callback.bind(this);
- this.upsertQuestion(callback);
- } else {
- const publishCallback = this.sendQuestionForPublish.bind(this);
- const callback = this.addResourceToQuestionset.bind(this, publishCallback);
- this.upsertQuestion(callback);
- }
- }
-
- requestForChanges(comment) {
- this.editorService.submitRequestChanges(this.questionId, comment).subscribe(res => {
- this.toasterService.success(_.get(this.configService, 'labelConfig.messages.success.003'));
- this.redirectToChapterList();
- }, err => {
- this.toasterService.error(_.get(this.configService, 'labelConfig.messages.error.003'));
- });
- }
-
- sendQuestionForPublish(event) {
- this.editorService.publishContent(this.questionId, event).subscribe(res => {
- if (!(this.creationMode === 'sourcingReview' && this.editorService.isReviewModificationAllowed)) {
- this.toasterService.success(_.get(this.configService, 'labelConfig.messages.success.037'));
- }
- this.redirectToChapterList();
- }, err => {
- this.toasterService.error(_.get(this.configService, 'labelConfig.messages.error.038'));
- });
- }
-
- rejectQuestion(comment) {
- const editableFields = _.get(this.creationContext, 'editableFields');
- if (this.creationMode === 'orgreview' && editableFields && !_.isEmpty(editableFields[this.creationMode])) {
- this.validateFormFields();
- if(this.showFormError === true) {
- this.toasterService.error(_.get(this.configService, 'labelConfig.messages.error.029'));
- return false;
- }
- let callback = this.requestForChanges.bind(this, [comment]);
- this.upsertQuestion(callback);
- } else {
- this.requestForChanges(comment);
- }
- }
-
- publishQuestion(event) {
- const editableFields = _.get(this.creationContext, 'editableFields');
- if (this.creationMode === 'orgreview' && editableFields && !_.isEmpty(editableFields[this.creationMode])) {
- this.validateFormFields();
- if(this.showFormError === true) {
- this.toasterService.error(_.get(this.configService, 'labelConfig.messages.error.029'));
- return false;
- }
- let callback = this.sendQuestionForPublish.bind(this, [event]);
- this.upsertQuestion(callback);
- } else {
- this.sendQuestionForPublish(event);
- }
- }
-
- sourcingUpdate(event) {
- const editableFields = _.get(this.creationContext, 'editableFields');
- if (this.creationMode === 'sourcingreview' && editableFields && !_.isEmpty(editableFields[this.creationMode])) {
- this.validateFormFields();
- if(this.showFormError === true) {
- this.toasterService.error(_.get(this.configService, 'labelConfig.messages.error.029'));
- return false; }
- }
- let questionIds = [];
- //let comments = {};
- let comments = event.comment
- let successMessage = '';
- this.editorService.fetchCollectionHierarchy(this.questionSetId).subscribe(res => {
- const questionSet = res.result['questionSet'];
- switch (event.button) {
- case 'sourcingApproveQuestion':
- questionIds = questionSet.acceptedContributions || [];
- successMessage = _.get(this.configService, 'labelConfig.messages.success.038')
- break;
- case 'sourcingRejectQuestion':
- questionIds = questionSet.rejectedContributions || [];
- comments = questionSet.rejectedContributionComments || {};
- comments[this.questionId] = event.comment;
- successMessage = _.get(this.configService, 'labelConfig.messages.success.039')
- break;
- default:
- break;
- }
- questionIds.push(this.questionId);
- event['requestBody'] = this.prepareSourcingUpdateBody(questionIds, comments);
- this.editorService.updateCollection(this.questionSetId, event).subscribe(res => {
- this.toasterService.success(successMessage);
- this.redirectToChapterList();
- })
- })
- }
-
- sendBackQuestion(event) {
- this.questionService.readQuestion(this.questionId, 'status')
- .subscribe((res) => {
- const requestObj = {
- question: {
- prevStatus: _.get(res.result, `question.status`),
- status: 'Draft',
- requestChanges: event.comment
- }
- };
- this.questionService.updateQuestion(this.questionId, requestObj).subscribe(res => {
- this.toasterService.success(_.get(this.configService, 'labelConfig.messages.success.040'));
- this.redirectToChapterList();
- });
- }, (err: ServerResponse) => {
- const errInfo = {
- errorMsg: 'Cannot update question status. Please try again...',
- };
- this.editorService.apiErrorHandling(err, errInfo);
- });
- }
-
- validateQuestionData() {
-
- if ([undefined, ''].includes(this.editorState.question)) {
- this.showFormError = true;
- return;
- } else {
- this.showFormError = false;
- }
-
-
- // to handle when question type is subjective
- if (this.questionInteractionType === 'default') {
- if (this.editorState.answer !== '') {
- this.showFormError = false;
- } else {
- this.showFormError = true;
- return;
- }
- }
-
- // to handle when question type is mcq
- if (this.questionInteractionType === 'choice') {
- const data = _.get(this.treeNodeData, 'data.metadata');
- if (_.get(this.editorState, 'interactionTypes[0]') === 'choice' &&
- _.isEmpty(this.editorState?.responseDeclaration?.response1?.mapping) &&
- !_.isUndefined(this.editorService?.editorConfig?.config?.renderTaxonomy) &&
- _.get(data,'allowScoring') === 'Yes') {
- this.toasterService.error(_.get(this.configService, 'labelConfig.messages.error.005'));
- this.showFormError = true;
- return;
- } else {
- this.showFormError = false;
- }
- const optionValid = _.find(this.editorState.options, option =>
- (option.body === undefined || option.body === '' || option.length > this.setCharacterLimit));
- if (optionValid || (!this.editorState.answer && this.sourcingSettings?.enforceCorrectAnswer)) {
- this.showFormError = true;
- return;
- } else {
- this.showFormError = false;
- }
- }
-
- if (this.questionInteractionType === 'slider') {
- const min = _.get(this.sliderDatas, 'validation.range.min');
- const max = _.get(this.sliderDatas, 'validation.range.max');
- const step = _.get(this.sliderDatas, 'step');
- if (_.isEmpty(this.sliderDatas) || _.isEmpty(min) || _.isEmpty(max) || _.isEmpty(step)) {
- this.toasterService.error(_.get(this.configService, 'labelConfig.messages.error.005'));
- this.showFormError = true;
- } else {
- this.showFormError = false;
- }
- }
-
- }
-
- redirectToQuestionset() {
- this.showConfirmPopup = false;
- this.treeService.clearTreeCache();
- setTimeout(() => {
- if (this.showAddSecondaryQuestionCat) {
- this.questionEmitter.emit({
- type: "createNewContent",
- isChildQuestion: true,
- });
- } else {
- this.editorService.parentIdentifier = undefined;
- }
- this.showAddSecondaryQuestionCat = false;
- this.questionEmitter.emit({ status: false });
- }, 100);
- }
-
- redirectToChapterList() {
- this.showConfirmPopup = false;
- setTimeout(() => {
- this.questionEmitter.emit({ type: 'close', actionType: this.actionType, identifier: this.questionId });
- }, 100);
- }
-
- editorDataHandler(event, type?) {
- if (type === 'question') {
- this.editorState.question = event.body;
- } else if (type === 'solution') {
- this.editorState.solutions = event.body;
- } else {
- this.editorState = _.assign(this.editorState, event.body);
- }
-
- if (event.mediaobj) {
- const media = event.mediaobj;
- this.setMedia(media);
- }
- }
-
- setMedia(media) {
- if (media) {
- const value = _.find(this.mediaArr, ob => {
- return ob.id === media.id;
- });
- if (value === undefined) {
- this.mediaArr.push(media);
- }
- }
- }
-
- addResourceToQuestionset(callback = null) {
- this.editorService.addResourceToQuestionset(this.questionSetId, this.unitId, this.questionId).subscribe(res => {
- if (callback) {
- callback();
- } else {
- this.redirectToChapterList();
- }
- }, err => {
- const errInfo = {
- errorMsg: 'Adding question to questionset failed. Please try again.',
- };
- return throwError(this.editorService.apiErrorHandling(err, errInfo));
- })
- }
-
- saveQuestion() {
- if(_.get(this.creationContext, 'objectType') === 'question') {
- if(this.creationMode === 'edit') {
- const callback = this.addResourceToQuestionset.bind(this);
- this.upsertQuestion(callback);
- } else if (this.creationMode === 'sourcingReview') {
- const callback = this.sendQuestionForPublish.bind(this);
- this.upsertQuestion(callback);
- } else {
- this.upsertQuestion(undefined);
- }
- }
- else {
- if (_.isUndefined(this.questionId)) {
- this.createQuestion();
- }
- if (!_.isUndefined(this.questionId)) {
- this.updateQuestion();
- }
- }
- }
-
- videoDataOutput(event) {
- if (event) {
- this.videoSolutionData = event;
- this.videoSolutionName = event.name;
- this.editorState.solutions = event.identifier;
- this.videoThumbnail = event.thumbnail;
- const videoMedia: any = {};
- videoMedia.id = event.identifier;
- videoMedia.src = event.src;
- videoMedia.type = 'video';
- videoMedia.assetId = event.identifier;
- videoMedia.name = event.name;
- videoMedia.thumbnail = this.videoThumbnail;
- videoMedia.baseUrl = _.get(this.editorService.editorConfig, 'context.host') || document.location.origin;
- if (videoMedia.thumbnail) {
- const thumbnailMedia: any = {};
- thumbnailMedia.src = this.videoThumbnail;
- thumbnailMedia.type = 'image';
- thumbnailMedia.id = `video_${event.identifier}`;
- thumbnailMedia.baseUrl = _.get(this.editorService.editorConfig, 'context.host') || document.location.origin;
- this.mediaArr.push(thumbnailMedia);
- }
- this.mediaArr.push(videoMedia);
- this.showSolutionDropDown = false;
- this.showSolution = true;
- } else {
- this.deleteSolution();
- }
- this.videoShow = false;
- }
-
- selectSolutionType(data: any) {
- const index = _.findIndex(this.solutionTypes, (sol: any) => {
- return sol.value === data;
- });
- this.selectedSolutionType = this.solutionTypes[index].type;
- if (this.selectedSolutionType === 'video') {
- const showVideo = true;
- this.videoShow = showVideo;
- } else {
- this.showSolutionDropDown = false;
- }
- }
-
- deleteSolution() {
- if (this.selectedSolutionType === 'video') {
- this.mediaArr = _.filter(this.mediaArr, (item: any) => item.id !== this.editorState.solutions);
- }
- this.showSolutionDropDown = true;
- this.selectedSolutionType = '';
- this.videoSolutionName = '';
- this.editorState.solutions = '';
- this.videoThumbnail = '';
- this.showSolution = false;
- }
-
- getSolutionObj(solutionUUID, selectedSolutionType, editorStateSolutions: any) {
- let solutionObj: any;
- solutionObj = {};
- solutionObj.id = solutionUUID;
- solutionObj.type = selectedSolutionType;
- if (_.isString(editorStateSolutions)) {
- solutionObj.value = editorStateSolutions;
- }
- if (_.isArray(editorStateSolutions)) {
- if (_.has(editorStateSolutions[0], 'value')) {
- solutionObj.value = editorStateSolutions[0].value;
- }
- }
- return solutionObj;
- }
-
- getQuestionMetadata() {
- let metadata: any = {
- mimeType: 'application/vnd.sunbird.question',
- media: this.mediaArr,
- editorState: {}
- };
- console.log('getQuestionMetadata');
- console.log(this.editorState);
- metadata = _.assign(metadata, this.editorState);
- metadata.editorState.question = metadata.question;
- metadata.body = metadata.question;
- const treeNodeData = _.get(this.treeNodeData, 'data.metadata');
-
- if (!(_.get(treeNodeData, "allowScoring") === "Yes")) {
- _.set(metadata, "responseDeclaration.response1.mapping", []);
- }
-
- if (this.questionInteractionType === 'choice') {
- metadata.body = this.getMcqQuestionHtmlBody(this.editorState.question, this.editorState.templateId);
- } else {
- metadata.responseDeclaration = this.getResponseDeclaration(this.questionInteractionType);
- }
-
- if (!_.isUndefined(this.selectedSolutionType) && !_.isEmpty(this.selectedSolutionType)) {
- const solutionObj = this.getSolutionObj(this.solutionUUID, this.selectedSolutionType, this.editorState.solutions);
- metadata.editorState.solutions = [solutionObj];
- metadata.solutions = [solutionObj];
- }
- if (_.isEmpty(this.editorState.solutions)) {
- metadata.solutions = [];
- }
- metadata = _.merge(metadata, this.getDefaultSessionContext());
- if(_.get(this.creationContext, 'objectType') === 'question') {
- metadata.programId = _.get(this.editorService, 'editorConfig.context.programId');
- metadata.collectionId = _.get(this.editorService, 'editorConfig.context.collectionIdentifier');
- metadata.organisationId = _.get(this.editorService, 'editorConfig.context.contributionOrgId');
- }
- if (this.questionInteractionType === 'choice') {
- metadata.responseDeclaration.response1.maxScore = this.maxScore;
- metadata.responseDeclaration.response1.correctResponse.outcomes.SCORE = this.maxScore;
- }
- metadata = _.merge(metadata, _.pickBy(this.childFormData, _.identity));
- if (_.get(this.creationContext, 'objectType') === 'question') {
- metadata.isReviewModificationAllowed = !!_.get(this.questionMetaData, 'isReviewModificationAllowed');
- }
- // tslint:disable-next-line:max-line-length
- return _.omit(metadata, ['question', 'numberOfOptions', 'options', 'allowMultiSelect', 'showEvidence', 'evidenceMimeType', 'showRemarks', 'markAsNotMandatory', 'leftAnchor', 'rightAnchor', 'step', 'numberOnly', 'characterLimit', 'dateFormat', 'autoCapture', 'remarksLimit', 'maximumOptions']);
- }
-
- getResponseDeclaration(type) {
- const responseDeclaration = {
- response1: {
- type: type === 'slider' ? 'integer' : 'string'
- }
- };
- if (type === 'text' || type === 'slider') {
- responseDeclaration.response1['maxScore'] = this.maxScore;
- }
- return responseDeclaration;
- }
-
-
-
- getMcqQuestionHtmlBody(question, templateId) {
- const mcqTemplateConfig = {
- // tslint:disable-next-line:max-line-length
- mcqBody: ''
- };
- const { mcqBody } = mcqTemplateConfig;
- const questionBody = mcqBody.replace('{templateClass}', templateId)
- .replace('{question}', question);
- return questionBody;
- }
-
- getDefaultSessionContext() {
- return _.omitBy(_.merge(
- {
- creator: _.get(this.editorService.editorConfig, 'context.user.fullName'),
- createdBy: _.get(this.editorService.editorConfig, 'context.user.id'),
- ..._.pick(_.get(this.editorService.editorConfig, 'context'), ['board', 'medium', 'gradeLevel', 'subject', 'topic'])
- },
- {
- ..._.pick(this.questionSetHierarchy, this.configService.sessionContext)
- }
- ), key => _.isEmpty(key));
- }
-
- setQuestionTypeValues(metaData) {
- metaData.showEvidence = this.childFormData.showEvidence;
- if (metaData.showEvidence === 'Yes') {
- metaData.evidence = {
- required: 'No',
- mimeType: this.childFormData.evidenceMimeType,
- minCount: 1,
- maxCount: 1,
- sizeLimit: evidenceSizeLimit,
- };
- }
- metaData.showRemarks = this.childFormData.showRemarks;
- if (metaData.showRemarks === 'Yes') {
- metaData.remarks = {
- maxLength: this.childFormData.remarksLimit,
- required: 'No'
- };
- }
- metaData.interactions = metaData.interactions || {};
-
- metaData.interactions.validation = { required: this.childFormData.markAsNotMandatory === 'Yes' ? 'No' : 'Yes'};
- if (this.childFormData.allowMultiSelect === 'Yes') {
- metaData.responseDeclaration.response1.cardinality = 'multiple';
- } else{
- metaData.responseDeclaration.response1.cardinality = 'single';
- }
-
- if (!_.isUndefined(this.editorService?.editorConfig?.config?.renderTaxonomy)){
- this.calculateMinMaxScore(metaData);
- }
-
- _.forEach(this.subMenus, (el: any) => {
- if (el.id === 'addHint') {
- metaData.hints = {
- en: [el.value]
- };
- }
- if (el.id === 'addTip') {
- metaData.instructions = {
- en: [el.value]
- };
- }
- });
-
- if (!_.isEmpty(this.sliderDatas) && this.questionInteractionType === 'slider') {
- metaData.interactionTypes = [this.questionInteractionType];
- metaData.primaryCategory = this.questionPrimaryCategory;
- metaData.interactions = {
- ...metaData.interactions,
- response1: {
- validation: this.sliderDatas.validation,
- step: this.sliderDatas.step
- }
- };
- }
-
- if (this.questionInteractionType === 'date') {
- metaData.interactionTypes = [this.questionInteractionType];
- metaData.primaryCategory = this.questionPrimaryCategory;
- metaData.interactions = {
- ...metaData.interactions,
- response1: {
- validation: {pattern: this.childFormData.dateFormat},
- autoCapture: this.childFormData.autoCapture
- }
- };
- }
-
- if (this.questionInteractionType === 'text') {
- metaData.interactionTypes = [this.questionInteractionType];
- metaData.primaryCategory = this.questionPrimaryCategory;
- metaData.interactions = {
- ...metaData.interactions,
- response1: {
- validation: {
- limit: {
- maxLength: this.childFormData.characterLimit,
- }
- },
- type: {
- number: this.childFormData.numberOnly
- }
- }
- };
- }
- // return metaData;
- }
-
- prepareRequestBody() {
- const questionId = this.questionId ? this.questionId : uuidv4();
- this.newQuestionID = questionId;
- const data = this.treeNodeData;
- const activeNode = this.treeService.getActiveNode();
- const selectedUnitId = _.get(activeNode, 'data.id');
- this.editorService.data = {};
- this.editorService.selectedSection = selectedUnitId;
- const metaData = this.getQuestionMetadata();
- this.setQuestionTypeValues(metaData);
- return {
- nodesModified: {
- [questionId]: {
- metadata: _.omit(metaData, ['creator']),
- objectType: 'Question',
- root: false,
- isNew: !this.questionId
- }
- },
- hierarchy: this.editorService.getHierarchyObj(data, questionId, selectedUnitId)
- };
- }
-
- prepareQuestionBody () {
- return this.questionId ?
- {
- question: _.omit(this.getQuestionMetadata(), ['mimeType', 'creator', 'createdBy', 'organisationId'])
- } :
- {
- question: {
- code: uuidv4(),
- ...this.getQuestionMetadata()
- }
- };
- }
-
- prepareSourcingUpdateBody (questionIds, comments?) {
- const sourcingUpdateAttribute = this.actionType === 'sourcingApproveQuestion' ? 'acceptedContributions'
- : 'rejectedContributions';
- const collectionObjectType = _.replace(_.lowerCase(this.creationContext['collectionObjectType']), ' ', '');
- const requestBody = {
- request: {
- [collectionObjectType]: {
- [sourcingUpdateAttribute]: questionIds
- }
- }
- };
- if (this.actionType === 'sourcingRejectQuestion') {
- requestBody.request[collectionObjectType]['rejectedContributionComments'] = comments;
- // requestBody.request[collectionObjectType]['rejectComment'] = comments;
- }
- return requestBody;
- }
-
- upsertQuestion(callback) {
- const requestBody = this.prepareQuestionBody();
- this.showHideSpinnerLoader(true);
- this.questionService.upsertQuestion(this.questionId, requestBody).pipe(
- finalize(() => {
- this.showHideSpinnerLoader(false);
- })).subscribe((response: ServerResponse) => {
- if (!_.includes(['submitQuestion'],this.actionType)) {
- this.toasterService.success(_.get(this.configService, 'labelConfig.messages.success.013'));
- }
- this.setQuestionId(_.get(response, 'result.identifier'));
- if (callback) callback();
- }, (err: ServerResponse) => {
- const errInfo = {
- errorMsg: 'Failed to save question. Please try again...',
- };
- this.editorService.apiErrorHandling(err, errInfo);
- });
- }
-
-
- createQuestion() {
- if (this.showOptions) {
- this.buildCondition('create');
- } else {
- const requestBody = this.prepareRequestBody();
- this.saveQuestions(requestBody, 'create');
- }
-}
-
-
- saveQuestions(requestBody, type) {
- this.showHideSpinnerLoader(true);
- this.questionService.updateHierarchyQuestionCreate(requestBody).pipe(
- finalize(() => {
- this.showHideSpinnerLoader(false);
- })).subscribe((response: ServerResponse) => {
- if (this.showAddSecondaryQuestionCat) {
- const result = _.get(response.result.identifiers, this.newQuestionID);
- this.editorService.parentIdentifier = result;
- }
-
- if (type === 'create') {
- this.toasterService.success(_.get(this.configService, 'labelConfig.messages.success.007'));
- } else {
- this.toasterService.success(_.get(this.configService, 'labelConfig.messages.success.008'));
- }
- this.redirectToQuestionset();
- }, (err: ServerResponse) => {
- const errInfo = {
- errorMsg: 'Question creating failed. Please try again...',
- };
- this.editorService.apiErrorHandling(err, errInfo);
- });
- }
-
-
- updateQuestion() {
- if (this.isChildQuestion) {
- this.buildCondition('update');
- } else {
- this.saveUpdateQuestions();
- }
- }
-
- saveUpdateQuestions() {
- const requestBody = this.prepareRequestBody();
- this.showHideSpinnerLoader(true);
- this.questionService.updateHierarchyQuestionUpdate(requestBody).pipe(
- finalize(() => {
- this.showHideSpinnerLoader(false);
- })).subscribe((response: ServerResponse) => {
- if (this.showAddSecondaryQuestionCat) {
- const result = _.get(response.result.identifiers, this.questionId);
- this.editorService.parentIdentifier = result;
- }
-
- this.toasterService.success(_.get(this.configService, 'labelConfig.messages.success.008'));
- this.redirectToQuestionset();
- }, (err: ServerResponse) => {
- const errInfo = {
- errorMsg: 'Question updating failed. Please try again...',
- };
- this.editorService.apiErrorHandling(err, errInfo);
- });
- }
-
- showHideSpinnerLoader(status: boolean, type?) {
- this.buttonLoaders.saveButtonLoader = status;
- if(type) {
- this.buttonLoaders[type] = status;
- }
- }
-
- previewContent() {
- this.validateQuestionData();
- if (this.showFormError === false && this.questionMetadataFormStatus === true) {
- this.previewFormData(false);
- const activeNode = this.treeService.getActiveNode();
- let questionId = '';
- if (_.isUndefined(this.questionId)) {
- questionId = this.tempQuestionId;
- this.setParentConfig(activeNode?.data?.metadata);
- } else {
- questionId = this.questionId;
- this.setParentConfig(activeNode?.parent?.data?.metadata);
- }
- this.questionSetHierarchy.childNodes = [questionId];
- this.setQumlPlayerData(questionId);
- this.showPreview = true;
- this.toolbarConfig.showPreview = true;
- } else {
- this.toasterService.error(_.get(this.configService, 'labelConfig.messages.error.044'));
- }
- }
-
- setParentConfig(parentConfig) {
- this.questionSetHierarchy.showSolutions = !_.isUndefined(parentConfig?.showSolutions) ?
- parentConfig.showSolutions : 'No';
- this.questionSetHierarchy.shuffle = !_.isUndefined(parentConfig?.shuffle) ?
- parentConfig.shuffle : true;
- this.questionSetHierarchy.showFeedback = !_.isUndefined(parentConfig?.showFeedback) ?
- parentConfig.showFeedback : 'No';
- }
-
- setQumlPlayerData(questionId: string) {
- const questionMetadata: any = _.cloneDeep(this.getQuestionMetadata());
- questionMetadata.identifier = questionId;
- this.questionSetHierarchy.children = [questionMetadata];
- if (this.questionSetHierarchy.shuffle === true) {
- // tslint:disable-next-line:no-string-literal
- this.questionSetHierarchy['maxScore'] = 1;
- } else {
- if (questionMetadata.qType === 'SA') {
- this.questionSetHierarchy = _.omit(this.questionSetHierarchy, 'maxScore');
- } else if (questionMetadata.maxScore) {
- // tslint:disable-next-line:no-string-literal
- this.questionSetHierarchy['maxScore'] = this.maxScore;
- }
- }
- this.editorCursor.setQuestionMap(questionId, questionMetadata);
- }
-
- getPlayerEvents(event) {
- console.log('get player events', JSON.stringify(event));
- }
-
- getTelemetryEvents(event) {
- console.log('event is for telemetry', JSON.stringify(event));
- }
-
- setQuestionId(questionId) {
- this.questionId = questionId;
- }
-
- setQuestionTitle(questionId?) {
- let index;
- let questionTitle = '';
- if (_.get(this.creationContext, 'objectType') === 'question') {
- if (!_.isUndefined(this.questionPrimaryCategory)) {
- questionTitle = this.questionPrimaryCategory;
- }
- } else {
- let hierarchyChildren = this.treeService.getChildren();
- if (!_.isUndefined(questionId)) {
- const parentNode = this.treeService.getActiveNode().getParent();
- hierarchyChildren = parentNode.getChildren();
- _.forEach(hierarchyChildren, (child) => {
- if (child.children) {
- index = _.findIndex(child.children, { identifier: questionId });
- const question = child.children[index];
- // tslint:disable-next-line:max-line-length
- questionTitle = `Q${(index + 1).toString()} | ` + (_.get(this.categoryLabel, `${question.primaryCategory}`) || question.primaryCategory);
- } else {
- index = _.findIndex(hierarchyChildren, (node) => node.data.id === questionId);
- const question = hierarchyChildren[index];
- // tslint:disable-next-line:max-line-length
- questionTitle = `Q${(index + 1).toString()} | ` + (_.get(this.categoryLabel, `${_.get(question, 'data.primaryCategory')}`) || _.get(question, 'data.primaryCategory'));
- }
- });
-
- } else {
- index = hierarchyChildren.length;
- questionTitle = `Q${(index + 1).toString()} | `;
- if (!_.isUndefined(this.questionPrimaryCategory)) {
- questionTitle = questionTitle + (_.get(this.categoryLabel, `${this.questionPrimaryCategory}`) || this.questionPrimaryCategory);
- }
- }
- }
- this.toolbarConfig.title = questionTitle;
- }
-
- output(event) { }
-
- onStatusChanges(event) {
- console.log(event);
- if (_.has(event, 'isValid')) {
- this.questionMetadataFormStatus = event.isValid;
- }
- }
-
- valueChanges(event) {
- if (_.has(event, 'maxScore')) {
- // tslint:disable-next-line:radix
- event.maxScore = !_.isNull(event.maxScore) ? parseInt(event.maxScore) : this.maxScore;
- this.maxScore = event.maxScore;
- }
- this.childFormData = event;
- }
-
- validateFormFields() {
- _.forEach(this.questionFormConfig, (formFieldCategory) => {
- if (formFieldCategory.required && !this.childFormData[formFieldCategory.code]) {
- this.showFormError = true;
- this.toasterService.error(_.get(this.configService, 'labelConfig.messages.error.008'));
- return false;
- }
- });
- return true;
- }
-
- previewFormData(status) {
- const formConfig = _.cloneDeep(this.leafFormConfig);
- this.questionFormConfig = null;
- _.forEach(formConfig, (formFieldCategory) => {
- if (_.has(formFieldCategory, 'editable') && !_.isUndefined(formFieldCategory.editable)) {
- formFieldCategory.editable = status ? _.find(this.leafFormConfig, { code: formFieldCategory.code }).editable : status;
- formFieldCategory.default = this.childFormData[formFieldCategory.code];
- }
- });
- this.questionFormConfig = formConfig;
- }
-
- isEditable(fieldCode) {
- if (this.creationMode === 'edit') {
- return true;
- }
- if (!this.questionId) {
- return true;
- }
- return false;
- }
-
- populateFormData() {
- this.childFormData = {};
- _.forEach(this.leafFormConfig, (formFieldCategory) => {
- if (!_.isUndefined(this.questionId)) {
- if (formFieldCategory.code === 'maxScore' && this.questionInteractionType === 'choice') {
- this.childFormData[formFieldCategory.code] = _.has(this.questionMetaData, 'responseDeclaration.response1.maxScore') ?
- _.get(this.questionMetaData, 'responseDeclaration.response1.maxScore') : this.maxScore;
- } else if (formFieldCategory.code === 'allowMultiSelect' && this.questionInteractionType === 'choice') {
- this.childFormData[formFieldCategory.code] = _.get(this.questionMetaData, 'responseDeclaration.response1.cardinality') === 'multiple' ? 'Yes' : 'No';
- }
- else if (this.questionMetaData && _.has(this.questionMetaData, formFieldCategory.code)) {
- formFieldCategory.default = this.questionMetaData[formFieldCategory.code];
- this.childFormData[formFieldCategory.code] = this.questionMetaData[formFieldCategory.code];
- }
- try {
- const availableAlias = {
- dateFormat: 'interactions.response1.validation.pattern',
- autoCapture: 'interactions.response1.autoCapture',
- markAsNotMandatory: 'interactions.validation.required',
- numberOnly: 'interactions.response1.type.number',
- characterLimit: 'interactions.response1.validation.limit.maxLength',
- remarksLimit: 'remarks.maxLength',
- evidenceMimeType: 'evidence.mimeType'
- };
- if (this.questionMetaData && _.has(availableAlias, formFieldCategory.code)) {
- let defaultValue = _.get(this.questionMetaData, availableAlias[formFieldCategory.code]);
- if (formFieldCategory.code === 'markAsNotMandatory') {
- defaultValue = defaultValue === 'Yes' ? 'No' : 'Yes';
- }
- formFieldCategory.default = defaultValue;
- this.childFormData[formFieldCategory.code] = defaultValue;
- }
- } catch (error) {
-
- }
- } else {
- // tslint:disable-next-line:max-line-length
- const questionSetDefaultValue = _.get(this.questionSetHierarchy, formFieldCategory.code) ? _.get(this.questionSetHierarchy, formFieldCategory.code) : '';
- const defaultEditStatus = _.find(this.initialLeafFormConfig, {code: formFieldCategory.code}).editable === true;
- formFieldCategory.default = defaultEditStatus ? '' : questionSetDefaultValue;
- this.childFormData[formFieldCategory.code] = formFieldCategory.default;
- if (formFieldCategory.code === 'maxScore' && this.questionInteractionType === 'choice') {
- this.childFormData[formFieldCategory.code] = this.maxScore;
- }
- }
- });
- this.fetchFrameWorkDetails();
- (this.isReadOnlyMode ===true && !_.isUndefined(this.editorService?.editorConfig?.config?.renderTaxonomy)) ? this.previewFormData(false) : this.previewFormData(true);
- }
-
- subMenuChange({ index, value }) {
- if (this.subMenus[index].id === 'addDependantQuestion') {
- this.showAddSecondaryQuestionCat = true;
- this.saveContent();
- if (this.showFormError) {
- this.showAddSecondaryQuestionCat = false;
- return;
- }
- }
- this.subMenus[index].value = value;
- }
-
- get dependentQuestions() {
- try {
- return this.subMenus.filter(menu => menu.id === 'addDependantQuestion')[0].value;
- } catch (error) {
- return null;
- }
- }
- subMenuConfig() {
- this.subMenus = [
- {
- id: 'addHint',
- name: 'Add Hint',
- value: _.get(this.questionMetaData, 'hints.en[0]'),
- label: 'Hint',
- enabled: _.get(this.questionMetaData, 'hints.en[0]') ? true : false,
- type: 'input',
- show: _.get(this.sourcingSettings, 'showAddHints')
- },
- {
- id: 'addTip',
- name: 'Add Tip',
- value: _.get(this.questionMetaData, 'instructions.en[0]'),
- label: 'Tip',
- enabled: _.get(this.questionMetaData, 'instructions.en[0]') ? true : false,
- type: 'input',
- show: _.get(this.sourcingSettings, 'showAddTips')
- },
- {
- id: 'addDependantQuestion',
- name: 'Add Dependant Question',
- label: '',
- value: [],
- enabled: false,
- type: '',
- show: _.get(this.sourcingSettings, 'showAddSecondaryQuestion') && !this.questionInput.setChildQueston
- },
- ];
- if (!_.get(this.sourcingSettings, 'showAddSecondaryQuestion') && !this.questionInput.setChildQueston) {
- this.showOptions = false;
- } else {
- this.showOptions = (this.questionInput.setChildQueston === true) ? true : false;
- }
- }
- ngOnDestroy() {
- this.onComponentDestroy$.next();
- this.onComponentDestroy$.complete();
- this.editorCursor.clearQuestionMap();
- }
-
- sliderData($event) {
- const val = $event;
- const obj = {
- validation: {
- range: {
- min: '',
- max: ''
- }
- },
- step: ''
- };
- if (val.leftAnchor) {
- obj.validation.range.min = val.leftAnchor;
- }
- if (val.rightAnchor) {
- obj.validation.range.max = val.rightAnchor;
- }
- if (val.step) {
- obj.step = val.step;
- }
- this.sliderDatas = obj;
- }
-
- optionHandler(e) {
- this.targetOption = e.target.value;
- }
-
-
- buildCondition(type) {
- if(this.condition ==='default' || _.isEmpty(this.selectedOptions) ){
- this.toasterService.error(_.get(this.configService, 'labelConfig.messages.error.038'));
- return;
- }
- const questionId = this.questionId ? this.questionId : uuidv4();
- const data = this.treeNodeData;
- const hierarchyData = this.editorService.getHierarchyObj(data, '', this.selectedSectionId);
- const sectionData = _.get(hierarchyData, `${this.selectedSectionId}`);
- const sectionName = sectionData.name;
- const branchingLogic = {
- ...this.branchingLogic,
- [this.editorService.parentIdentifier]: {
- target: this.updateTarget(questionId),
- preCondition: {},
- source: []
- },
- [questionId]: {
- target: [],
- source: [this.editorService.parentIdentifier],
- preCondition: {
- and: [
- {
- [this.condition]: [
- {
- var: `${this.editorService.parentIdentifier}.${this.responseVariable}.value`,
- type: 'responseDeclaration',
- },
- this.selectedOptions,
- ],
- },
- ],
- },
- },
- };
- this.updateTreeCache(sectionName, branchingLogic, this.selectedSectionId);
- const metaData = this.getQuestionMetadata();
- this.setQuestionTypeValues(metaData);
- const finalResult = {
- nodesModified: {
- [questionId]: {
- metadata: metaData,
- objectType: 'Question',
- root: false,
- isNew: this.questionId ? false : true
- },
- [this.selectedSectionId]: {
- ...this.treeService.treeCache.nodesModified[this.selectedSectionId]
- }
- },
- hierarchy: this.editorService.getHierarchyObj(data, questionId, this.selectedSectionId,this.editorService.parentIdentifier)
- };
- this.saveQuestions(finalResult, type);
- }
-
- updateTarget(questionId) {
- if (!_.isEmpty(this.branchingLogic) && _.get(this.branchingLogic, `${this.editorService.parentIdentifier}.target`)) {
- if (this.branchingLogic[this.editorService.parentIdentifier].target.includes(questionId)) {
- return [...this.branchingLogic[this.editorService.parentIdentifier].target];
- }
- return [...this.branchingLogic[this.editorService.parentIdentifier].target, `${questionId}`];
- }
- return [`${questionId}`];
- }
-
- getOptions() {
- if (this.editorService.optionsLength) {
- this.options = [];
- Array.from({length: this.editorService.optionsLength}, (x, i) => {
- this.options.push({value: i, label: i});
- });
- }
- }
-
- getParentQuestionOptions(questionId) {
- this.editorService.parentIdentifier = questionId;
- this.questionService.readQuestion(questionId)
- .subscribe((res) => {
- if (res.responseCode === 'OK') {
- const result = res.result.question;
- if (result.interactionTypes[0] === 'choice') {
- const numberOfOptions = result.editorState.options.length;
- this.editorService.optionsLength = numberOfOptions;
- this.getOptions();
- }
- }
- });
- }
-
- updateTreeCache(sectionName, branchingLogic, selectedSection) {
- const metadata = {
- name: sectionName,
- primaryCategory: this.sectionPrimaryCategory,
- allowBranching: 'Yes',
- branchingLogic
- };
- this.treeService.updateNode(metadata, selectedSection, this.sectionPrimaryCategory);
- }
-
- setCondition(data) {
- const Condition = _.get(data?.branchingLogic, `${this.questionId}.preCondition.and[0]`);
- const getCondition = Object.keys(Condition);
- this.condition = getCondition[0];
- this.selectedOptions = Condition[getCondition][1];
- }
-
- getBranchingLogic(children) {
- _.forEach(children, (data) => {
- if (data.identifier === this.selectedSectionId) {
- this.branchingLogic = data?.branchingLogic ? data?.branchingLogic : {};
- if (_.get(data?.branchingLogic, `${this.questionId}.source[0]`)) {
- this.isChildQuestion = true;
- this.getParentQuestionOptions(data.branchingLogic[this.questionId].source[0]);
- this.setCondition(data);
- }
- }
- if (data?.children) {
- this.getBranchingLogic(data?.children);
- }
- });
- }
-
- onQualityFormSubmit(event) {
- switch (event.action) {
- case 'submit':
- this.saveQualityParameters(event.data, this.sendQuestionForPublish.bind(this, {}));
- break;
- case 'requestChange':
- this.requestChangesPopupAction = null;
- this.saveQualityParameters(event.data, this.openRequestChangesPopup.bind(this, {}));
- break;
- default:
- this.showQualityParameterPopup = false;
- }
- }
-
- saveQualityParameters(qualityParameters, callback) {
- const requestObj = {
- question: {
- reviewerQualityChecks: qualityParameters
- }
- };
- this.questionService.updateQuestion(this.questionId, requestObj).subscribe(res => {
- this.showQualityParameterPopup = false;
- if (callback) {
- callback();
- }
- });
- }
-
- openRequestChangesPopup() {
- this.requestChangesPopupAction = 'rejectQuestion';
- }
-
- calculateMinMaxScore(metaData){
- const scores = [];
- if (!_.isEmpty(metaData.responseDeclaration.response1.mapping)) {
- metaData.responseDeclaration.response1.mapping.forEach(item => scores.push(item.outcomes.score));
- metaData.responseDeclaration.response1.minScore = Math.min(...scores);
- if (_.get(metaData, 'responseDeclaration.response1.cardinality') === 'multiple'){
- let sum = 0;
- metaData.responseDeclaration.response1.mapping.forEach(item => sum += +(item.outcomes.score));
- metaData.responseDeclaration.response1.maxScore = sum;
- }else{
- metaData.responseDeclaration.response1.maxScore = Math.max(...scores);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/slider/slider.component.html b/projects/collection-editor-library/src/lib/components/slider/slider.component.html
deleted file mode 100644
index bddc2c260..000000000
--- a/projects/collection-editor-library/src/lib/components/slider/slider.component.html
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/slider/slider.component.scss b/projects/collection-editor-library/src/lib/components/slider/slider.component.scss
deleted file mode 100644
index e57a28be9..000000000
--- a/projects/collection-editor-library/src/lib/components/slider/slider.component.scss
+++ /dev/null
@@ -1,38 +0,0 @@
-.slider-align {
- margin-top: 15px;
-}
-::placeholder {
- padding: 0.25rem;
- opacity: 0.99;
- color: #999999;
- font-family: "Noto Sans";
- font-size: 12px;
- font-weight: bold;
-}
-
-.sb-input {
- margin: 1rem 0;
-}
-
-label {
- display: block;
- font-size: 1rem;
- margin: 0;
-}
-
-.flex-container {
- display: flex;
- margin-top: 15px;
-}
-
-.textbox {
- width: 90%;
- border: 1px solid rgba(34,36,38,.15)!important;
- box-sizing: border-box;
- background-color: #fff;
- margin-right: 40px;
- height: 45px;
- border-radius: 5px;
- font-size: 13px;
- padding: 12px;
-}
diff --git a/projects/collection-editor-library/src/lib/components/slider/slider.component.spec.data.ts b/projects/collection-editor-library/src/lib/components/slider/slider.component.spec.data.ts
deleted file mode 100644
index 44f0a5099..000000000
--- a/projects/collection-editor-library/src/lib/components/slider/slider.component.spec.data.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-export const mockData = {
- editorDataInput: {
- step: 1,
- validation: {
- range: {
- min: 0,
- max: 10,
- },
- },
- },
- changeEvent: {
- event: {
- isTrusted: true,
- target:{
- value:10
- },
- },
- },
-};
-
-export const mockConfigService={
- labelConfig:{
- lbl:{
- left:"Left",
- stepSize:"Step size",
- right:"Right",
- sliderValue:'Slider Value'
- }
- }
-}
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/slider/slider.component.spec.ts b/projects/collection-editor-library/src/lib/components/slider/slider.component.spec.ts
deleted file mode 100644
index 66e5f06fd..000000000
--- a/projects/collection-editor-library/src/lib/components/slider/slider.component.spec.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
-import { mockConfigService, mockData } from "./slider.component.spec.data";
-import { SliderComponent } from "./slider.component";
-import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
-import { ConfigService } from '../../services/config/config.service';
-import { HttpClientTestingModule } from "@angular/common/http/testing";
-
-describe("SliderComponent", () => {
- let component: SliderComponent;
- let fixture: ComponentFixture;
-
- beforeEach(waitForAsync(() => {
- TestBed.configureTestingModule({
- imports:[HttpClientTestingModule],
- declarations: [SliderComponent],
- providers:[
- { provide: ConfigService, useValue: mockConfigService }
- ],
- schemas: [CUSTOM_ELEMENTS_SCHEMA]
- }).compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(SliderComponent);
- component = fixture.componentInstance;
- component.sliderValue = {};
- component.editorDataInput = mockData.editorDataInput;
- // fixture.detectChanges();
- });
-
- it("should create", () => {
- expect(component).toBeTruthy();
- });
-
- it("should call the ngOnInit", () => {
- component.editorDataInput = mockData.editorDataInput;
- spyOn(component, "ngOnInit").and.callThrough();
- component.ngOnInit();
- expect(component.ngOnInit).toHaveBeenCalled();
- });
-
- it("should call the ngOnInit when editorDataInput is undefined", () => {
- component.sliderValue = {};
- component.editorDataInput = {};
- spyOn(component, "ngOnInit").and.callThrough();
- component.ngOnInit();
- expect(component.ngOnInit).toHaveBeenCalled();
- });
-
- it("#onValueChange() should emit onChange with data for rightAnchor", () => {
- component.sliderValue['rightAnchor'] = {};
- spyOn(component,'onValueChange').and.callThrough();
- spyOn(component.onChange, "emit").and.callFake(() => {});
- component.onValueChange(mockData.changeEvent.event, "rightAnchor");
- expect(component.onValueChange).toHaveBeenCalled();
- expect(component.onChange.emit).toHaveBeenCalled();
- expect(component.sliderValue.rightAnchor).toBe(10);
- });
-
-});
diff --git a/projects/collection-editor-library/src/lib/components/slider/slider.component.ts b/projects/collection-editor-library/src/lib/components/slider/slider.component.ts
deleted file mode 100644
index de6bd69af..000000000
--- a/projects/collection-editor-library/src/lib/components/slider/slider.component.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
-import { ConfigService } from '../../services/config/config.service';
-import { EditorService } from '../../services/editor/editor.service';
-import * as _ from 'lodash-es';
-
-export class SilderEvent {
- leftAnchor: number;
- step: number;
- rightAnchor: number;
-}
-
-@Component({
- selector: 'lib-slider',
- templateUrl: './slider.component.html',
- styleUrls: ['./slider.component.scss']
-})
-export class SliderComponent implements OnInit {
- sliderValue:any = {};
- @Input() editorDataInput;
- leftAnchor: any;
- rightAnchor: any;
- step: any;
- @Output() onChange: EventEmitter = new EventEmitter();
- constructor(public configService: ConfigService,public editorService: EditorService) { }
-
- ngOnInit(){
- if (_.get(this.editorDataInput,"step")) {
- this.step = this.editorDataInput.step;
- this.sliderValue['step']= this.editorDataInput.step;
- }
- if (_.get(this.editorDataInput,"validation.range.min")) {
- this.leftAnchor = this.editorDataInput.validation.range.min;
- this.sliderValue['leftAnchor']=this.leftAnchor;
- }
- if (_.get(this.editorDataInput,"validation.range.max")) {
- this.rightAnchor = this.editorDataInput.validation.range.max;
- this.sliderValue['rightAnchor']=this.rightAnchor;
- }
- }
-
- onValueChange(event,key){
- this.sliderValue[key]=event.target.value
- this.onChange.emit(this.sliderValue);
- }
-
-}
diff --git a/projects/collection-editor-library/src/lib/components/template/template.component.html b/projects/collection-editor-library/src/lib/components/template/template.component.html
deleted file mode 100644
index ade3272dc..000000000
--- a/projects/collection-editor-library/src/lib/components/template/template.component.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-

-
{{configService.labelConfig?.categoryLabels[template] || template}}
-
-
-
-
-
-
-
- {{configService.labelConfig?.button_labels?.next_btn_label}}
-
-
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/template/template.component.scss b/projects/collection-editor-library/src/lib/components/template/template.component.scss
deleted file mode 100644
index 291533c7e..000000000
--- a/projects/collection-editor-library/src/lib/components/template/template.component.scss
+++ /dev/null
@@ -1,55 +0,0 @@
-.common-contribution-card {
- box-sizing: border-box;
- border: 0.5px solid rgba(123, 134, 244, 0.39);
- border-radius: 4px;
- background-color: white;
- box-shadow: none;
- width: 150px;
-}
-
-.common-contribution-card .content img {
- width: 64px;
- height: 64px;
-}
-
-.common-contribution-card .content .content-title {
- font-size: 12px;
- vertical-align: middle;
- line-height: 16px;
-}
-
-.common-contribution-card .content .icon.check {
- display: none;
- height: 18px;
- position: absolute;
- right: 8px;
- top: 8px;
- margin: 0;
- width: 20px;
- font-size: 18px;
- color: #00c786;
- font-size: 20px;
-}
-
-.common-contribution-card:hover .content .icon.check,
-.common-contribution-card.active .content .icon.check {
- display: block;
-}
-
-.common-contribution-card:hover,
-.common-contribution-card.active {
- cursor: pointer;
- z-index: 5;
- background: white;
- transform: translateY(-3px);
- box-shadow: 0 2px 8px 0 rgba(123, 134, 244, 0.31);
- border: 0.5px solid rgba(208, 208, 208, 0.48);
-}
-
-.common-contribution-card.active .content-title {
- font-weight: 700;
-}
-
-.fs-16{
- font-size: 16px !important;
-}
diff --git a/projects/collection-editor-library/src/lib/components/template/template.component.spec.ts b/projects/collection-editor-library/src/lib/components/template/template.component.spec.ts
deleted file mode 100644
index ce6d6491b..000000000
--- a/projects/collection-editor-library/src/lib/components/template/template.component.spec.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
-import { TemplateComponent } from './template.component';
-import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
-import { TelemetryInteractDirective } from '../../directives/telemetry-interact/telemetry-interact.directive';
-import { HttpClientTestingModule } from '@angular/common/http/testing';
-
-describe('TemplateComponent', () => {
- let component: TemplateComponent;
- let fixture: ComponentFixture;
- const templateList = [{ type: 'Multile Choice Question' }, { type: 'Subjective Question'}];
- beforeEach(waitForAsync(() => {
- TestBed.configureTestingModule({
- imports: [ HttpClientTestingModule ],
- declarations: [ TemplateComponent, TelemetryInteractDirective ],
- schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(TemplateComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-
- it('should disabled #next button initial', () => {
- expect(component.showButton).toBeFalsy();
- });
-
- it('should set #templateList value initial', () => {
- expect(component.templateList).toBeUndefined();
- component.templateList = templateList;
- expect(component.templateList).not.toBeUndefined();
- });
-
- it('should set #templateSelected value when template selected', () => {
- component.templateSelected = templateList[0];
- expect(component.templateSelected).toEqual(templateList[0]);
- });
-
- it('#next() should emit #templateSelection event when #next button cliked!', () => {
- spyOn(component.templateSelection, 'emit');
- component.templateSelected = templateList[0];
- component.next();
- expect(component.templateSelection.emit).toHaveBeenCalledWith(templateList[0]);
- });
- it('#onClosePopup() should call modal deny', () => {
- component['modal'] = {
- deny: jasmine.createSpy('deny')
- };
- spyOn(component.templateSelection, 'emit');
- component.onClosePopup();
- expect(component['modal'].deny).toHaveBeenCalled();
- expect(component.templateSelection.emit).toHaveBeenCalledWith({ type: 'close' });
- });
-});
diff --git a/projects/collection-editor-library/src/lib/components/template/template.component.ts b/projects/collection-editor-library/src/lib/components/template/template.component.ts
deleted file mode 100644
index f3c2e6c9a..000000000
--- a/projects/collection-editor-library/src/lib/components/template/template.component.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import { Component, OnInit, ViewChild, OnDestroy, Output, Input, EventEmitter } from '@angular/core';
-import * as _ from 'lodash-es';
-import { EditorTelemetryService } from '../../services/telemetry/telemetry.service';
-import { ConfigService } from '../../services/config/config.service';
-
-@Component({
- selector: 'lib-template',
- templateUrl: './template.component.html',
- styleUrls: ['./template.component.scss']
-})
-export class TemplateComponent implements OnInit, OnDestroy {
-
- @Input() templateList: any;
- @ViewChild('modal') private modal;
- @Output() templateSelection = new EventEmitter();
- public showButton = false;
- public templateSelected;
-
- constructor(public telemetryService: EditorTelemetryService, public configService: ConfigService) { }
-
- ngOnInit() { }
-
- next() {
- this.templateSelection.emit(this.templateSelected);
- }
-
- onClosePopup() {
- this.modal.deny();
- this.templateSelection.emit({ type: 'close' });
- }
-
- ngOnDestroy() {
- if (this.modal && this.modal.deny) {
- this.modal.deny();
- }
- }
-
-}
diff --git a/projects/collection-editor-library/src/lib/components/term-and-condition/term-and-condition.component.html b/projects/collection-editor-library/src/lib/components/term-and-condition/term-and-condition.component.html
deleted file mode 100644
index 8bd90f3a6..000000000
--- a/projects/collection-editor-library/src/lib/components/term-and-condition/term-and-condition.component.html
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{configService.labelConfig?.button_labels?.submit_btn_label}}
-
-
-
diff --git a/projects/collection-editor-library/src/lib/components/term-and-condition/term-and-condition.component.scss b/projects/collection-editor-library/src/lib/components/term-and-condition/term-and-condition.component.scss
deleted file mode 100644
index e69de29bb..000000000
diff --git a/projects/collection-editor-library/src/lib/components/term-and-condition/term-and-condition.component.ts b/projects/collection-editor-library/src/lib/components/term-and-condition/term-and-condition.component.ts
deleted file mode 100644
index 75d5eecd8..000000000
--- a/projects/collection-editor-library/src/lib/components/term-and-condition/term-and-condition.component.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
-import {ConfigService} from '../../services/config/config.service';
-import {EditorTelemetryService} from '../../services/telemetry/telemetry.service';
-import {EditorService} from '../../services/editor/editor.service';
-
-@Component({
- selector: 'lib-term-and-condition',
- templateUrl: './term-and-condition.component.html',
- styleUrls: ['./term-and-condition.component.scss']
-})
-export class TermAndConditionComponent implements OnInit {
- @Input() showEditingConsent = true;
- @Input() showSubmitConfirmPopup;
- @Output() sendForReviewOutput = new EventEmitter();
- allConsent = false;
- termsConsent = false;
- editingConsent = false;
-
- constructor(public editorService: EditorService, public configService: ConfigService,
- public telemetryService: EditorTelemetryService) {
- }
-
- ngOnInit() {
- }
-
- get contentPolicyUrl() {
- return this.editorService.contentPolicyUrl;
- }
-
- onConsentChange(event, consentType) {
- switch (consentType) {
- case 'ALL':
- this.termsConsent = event.target.checked;
- this.editingConsent = event.target.checked;
- break;
- case 'TERM':
- case 'EDITING':
- this.allConsent = this.termsConsent && this.editingConsent;
- break;
- }
- }
-
- sendForReview() {
- this.sendForReviewOutput.emit({
- termsConsent: this.termsConsent,
- editingConsent: this.editingConsent,
- });
- this.resetAll();
- }
-
- onModalClose() {
- this.sendForReviewOutput.emit();
- this.resetAll();
- }
-
- resetAll() {
- this.showSubmitConfirmPopup = false;
- this.termsConsent = false;
- this.editingConsent = false;
- this.allConsent = false;
- }
-}
diff --git a/projects/collection-editor-library/src/lib/components/translations/translations.component.html b/projects/collection-editor-library/src/lib/components/translations/translations.component.html
deleted file mode 100644
index ce5cff03b..000000000
--- a/projects/collection-editor-library/src/lib/components/translations/translations.component.html
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
{{sampleJson.body.en}}
-
-
-
-
-
-
-
-
{{options.label.en}}
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/translations/translations.component.scss b/projects/collection-editor-library/src/lib/components/translations/translations.component.scss
deleted file mode 100644
index 8d37cc1ae..000000000
--- a/projects/collection-editor-library/src/lib/components/translations/translations.component.scss
+++ /dev/null
@@ -1,14 +0,0 @@
-.tarnslation{
- margin-top: 15px;
- margin-bottom: 15px;
-}
-
-.mt-15{
- margin-top: 15px !important;
- margin-bottom: 5px;
- }
-
-.label-align{
- font-size: 15px;
- font-weight: 500;
-}
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/translations/translations.component.spec.data.ts b/projects/collection-editor-library/src/lib/components/translations/translations.component.spec.data.ts
deleted file mode 100644
index ad4922ebd..000000000
--- a/projects/collection-editor-library/src/lib/components/translations/translations.component.spec.data.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-export const mockData={
- editorState: {
- body: {
- "answer": ' Yes',
- "question": "Hi how are you ?
",
- "editorState": {
- "answer": ' Yes'
- },
- "name": "Subjective Question",
- "qType": "SA",
- "primaryCategory": "Subjective Question"
- },
- mediaobj: {}
- },
- eventData: {
- body: { answer: "dad
" },
- editorState: { answer: "dad
" },
- name: "Subjective Question",
- qType: "SA",
- primaryCategory: "Subjective Question",
- mediaobj: 'audio'
- }
-}
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/translations/translations.component.spec.ts b/projects/collection-editor-library/src/lib/components/translations/translations.component.spec.ts
deleted file mode 100644
index ebece49a9..000000000
--- a/projects/collection-editor-library/src/lib/components/translations/translations.component.spec.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
-
-import { TranslationsComponent } from './translations.component';
-import { mockData } from './translations.component.spec.data';
-
-describe('TranslationsComponent', () => {
- let component: TranslationsComponent;
- let fixture: ComponentFixture;
-
- beforeEach(waitForAsync(() => {
- TestBed.configureTestingModule({
- declarations: [ TranslationsComponent ]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(TranslationsComponent);
- component = fixture.componentInstance;
- component.editorState = {};
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-
- it('#editorDataHandler() should call editorDataHandler for solution', () => {
- spyOn(component,'editorDataHandler').and.callThrough();
- component.editorState.solutions=mockData.editorState;
- component.editorDataHandler(mockData.eventData, 'solution');
- expect(component.editorDataHandler).toHaveBeenCalledWith(mockData.eventData, 'solution');
- });
-
- it('#editorDataHandler() should call editorDataHandler for question', () => {
- spyOn(component,'editorDataHandler').and.callThrough();
- component.editorDataHandler(mockData.eventData, 'question');
- expect(component.editorDataHandler).toHaveBeenCalledWith(mockData.eventData, 'question');
- expect(component.editorState.question).toBe(mockData.eventData.body);
- });
-
- it('#editorDataHandler() should call editorDataHandler without type', () => {
- spyOn(component,'editorDataHandler').and.callThrough();
- component.editorDataHandler(mockData.eventData,'test');
- expect(component.editorDataHandler).toHaveBeenCalledWith(mockData.eventData, 'test');
- });
-
-});
\ No newline at end of file
diff --git a/projects/collection-editor-library/src/lib/components/translations/translations.component.ts b/projects/collection-editor-library/src/lib/components/translations/translations.component.ts
deleted file mode 100644
index 23de89e8b..000000000
--- a/projects/collection-editor-library/src/lib/components/translations/translations.component.ts
+++ /dev/null
@@ -1,129 +0,0 @@
-import { Component} from "@angular/core";
-import { ConfigService } from "../../services/config/config.service";
-import * as _ from 'lodash-es';
-
-@Component({
- selector: "lib-translations",
- templateUrl: "./translations.component.html",
- styleUrls: ["./translations.component.scss"],
-})
-export class TranslationsComponent {
- public editorState: any = {};
- sampleJson = {
- body: {
- en: "What is the shape of the earth?",
- },
- responseDeclaration: {
- response1: {
- maxScore: 1,
- cardinality: "single",
- type: "integer",
- mapping: [
- {
- response: 0,
- outcomes: {
- FEEDBACK: "feedback1",
- },
- },
- {
- response: 1,
- outcomes: {
- FEEDBACK: "feedback2",
- },
- },
- {
- response: 2,
- outcomes: {
- FEEDBACK: "feedback3",
- },
- },
- ],
- },
- },
- interactionTypes: ["choice"],
- hints: {
- en: ["hints in the specified language"],
- },
- instructions: {
- en: "instructions in the specified language",
- },
- interactions: {
- response1: {
- type: "choice",
- validation: {
- required: "Yes/No",
- },
- options: [
- {
- label: {
- en: ["Circular"],
- },
- hints: {
- en: ["hints in the specified language"],
- },
- value: 0,
- },
- {
- label: {
- en: ["Spherical"],
- },
- hints: {
- en: ["hints in the specified language"],
- },
- value: 1,
- },
- {
- label: {
- en: ["Rectangle"],
- },
- hints: {
- en: ["hints in the specified language"],
- },
- value: 1,
- },
- {
- label: {
- en: ["Square"],
- },
- hints: {
- en: ["hints in the specified language"],
- },
- value: 1,
- },
- ],
- },
- },
- solution: [],
- media: [],
- showEvidence: "Yes/No",
- evidence: {
- required: "Yes/No",
- mimeType: ["image/png", "audio/mp3", "video/mp4", "video/webm"],
- minCount: 1,
- maxCount: 1,
- sizeLimit: "20480",
- caption: "Yes/No",
- },
- showRemarks: "Yes/No",
- remarks: {
- maxLength: "",
- required: "Yes/No",
- },
- canBeNotApplicable: "Yes/No",
- };
- constructor(public configService: ConfigService) {}
-
-
- editorDataHandler(event, type?) {
- if (type === 'question') {
- this.editorState.question = event.body;
- } else if (type === 'solution') {
- this.editorState.solutions = event.body;
- }
-
- if (event.mediaobj) {
- const media = event.mediaobj;
- console.log(media);
- }
- }
-}