diff --git a/src/app/components/fragments/content-choice-creator/content-choice-creator.component.ts b/src/app/components/fragments/content-choice-creator/content-choice-creator.component.ts index 168be54650f54aa886aa27a611ad0711a82fdc35..1dce374a043d779f6bbeaa745e2d779a127a3f00 100644 --- a/src/app/components/fragments/content-choice-creator/content-choice-creator.component.ts +++ b/src/app/components/fragments/content-choice-creator/content-choice-creator.component.ts @@ -28,7 +28,8 @@ export class DisplayAnswer { export class ContentChoiceCreatorComponent implements OnInit { singleChoice: boolean; multipleChoice: boolean; - content: ContentChoice = new ContentChoice('0', + content: ContentChoice = new ContentChoice( + '0', '1', '', '', @@ -36,8 +37,10 @@ export class ContentChoiceCreatorComponent implements OnInit { 1, [], [], + [], true, - ContentType.CHOICE); + ContentType.CHOICE + ); displayedColumns = ['label', 'points', 'actions']; @@ -260,16 +263,19 @@ export class ContentChoiceCreatorComponent implements OnInit { this.changesAllowed = true; return; } - this.contentService.addContent(new ContentChoice('', - '1', + this.contentService.addContent(new ContentChoice( + '', + '', this.roomId, subject, body, 1, [], - [], - true, - ContentType.CHOICE)).subscribe(); + this.content.options, + this.content.correctOptionIndexes, + this.content.multiple, + ContentType.CHOICE + )).subscribe(); this.resetAfterSubmit(); } diff --git a/src/app/components/fragments/content-choice-participant/content-choice-participant.component.ts b/src/app/components/fragments/content-choice-participant/content-choice-participant.component.ts index f9e882d90d1f86e209db3237a08d2c252d6edd90..e7c988b7d699362d45fb17dc847db20f963cce69 100644 --- a/src/app/components/fragments/content-choice-participant/content-choice-participant.component.ts +++ b/src/app/components/fragments/content-choice-participant/content-choice-participant.component.ts @@ -27,12 +27,14 @@ export class ContentChoiceParticipantComponent implements OnInit { selectedSingleAnswer: string; - dummyContent: ContentChoice = new ContentChoice('2', + dummyContent: ContentChoice = new ContentChoice( + '2', '1', '1', 'Choice Content 1', 'This is the body of Choice Content 1', 1, + [], [ new AnswerOption('Option 1', '0'), new AnswerOption('Option 2', '10'), @@ -41,7 +43,8 @@ export class ContentChoiceParticipantComponent implements OnInit { ], [2, 3, 4], false, - ContentType.BINARY); + ContentType.BINARY + ); checkedAnswers: CheckedAnswer[] = []; isAnswerSent = false; diff --git a/src/app/components/fragments/content-likert-creator/content-likert-creator.component.ts b/src/app/components/fragments/content-likert-creator/content-likert-creator.component.ts index 24c5a125cd81d64fc180fe15a34d8d52919eef71..394b3f9940a331c279c18a2882163d5c61c60e60 100644 --- a/src/app/components/fragments/content-likert-creator/content-likert-creator.component.ts +++ b/src/app/components/fragments/content-likert-creator/content-likert-creator.component.ts @@ -24,7 +24,8 @@ export class ContentLikertCreatorComponent implements OnInit { 'Strongly disagree' ]; - content: ContentChoice = new ContentChoice('0', + content: ContentChoice = new ContentChoice( + '0', '1', '', '', @@ -32,8 +33,10 @@ export class ContentLikertCreatorComponent implements OnInit { 1, [], [], + [], false, - ContentType.SCALE); + ContentType.SCALE + ); displayedColumns = ['label']; diff --git a/src/app/components/fragments/content-list/content-list.component.ts b/src/app/components/fragments/content-list/content-list.component.ts index 6829ffa1bf3910e4fabfa96ad74fe9ee448eed6a..c7c8327ef579f081147bfd0c773d4963aefbef2a 100644 --- a/src/app/components/fragments/content-list/content-list.component.ts +++ b/src/app/components/fragments/content-list/content-list.component.ts @@ -19,49 +19,7 @@ import { NotificationService } from '../../../services/util/notification.service }) export class ContentListComponent implements OnInit { - contents = [ - new ContentChoice('0', - '1', - 'roomId1', - 'MultipleChoice Subject', - 'MultipleChoice Body', - 1, - [new AnswerOption('yes', ''), new AnswerOption('no', '')], - [0], - true, - ContentType.CHOICE), - new ContentChoice('0', - '1', - 'roomId2', - 'SingleChoice Subject', - 'SingleChoice Body', - 1, - [new AnswerOption('may', ''), new AnswerOption('not', '')], - [1], - false, - ContentType.BINARY), - new ContentText('1', - '1', - 'roomId3', - 'TextContent Subject', - 'TextContent Body', - 1), - new ContentChoice('0', - '1', - 'roomId4', - 'LikertContent Subject', - 'LikertContent Body', - 1, - [ - new AnswerOption('Strongly agree', '0'), - new AnswerOption('Agree', '0'), - new AnswerOption('Neither agree nor disagree', '0'), - new AnswerOption('Disagree', '0'), - new AnswerOption('Strongly disagree', '0')], - [], - false, - ContentType.SCALE) - ]; + contents = []; contentBackup: Content; @@ -117,6 +75,7 @@ export class ContentListComponent implements OnInit { content.subject, content.body, content.round, + [], answerOptions, correctAnswers, content.multiple, @@ -131,7 +90,8 @@ export class ContentListComponent implements OnInit { content.roomId, content.subject, content.body, - content.round + content.round, + [], ); } diff --git a/src/app/components/fragments/content-text-creator/content-text-creator.component.ts b/src/app/components/fragments/content-text-creator/content-text-creator.component.ts index eab10cd0fbf381218cb0ef9b2870f03965055fcb..d8a1f1cc359b3ea88edf6d0c92150a8047227dca 100644 --- a/src/app/components/fragments/content-text-creator/content-text-creator.component.ts +++ b/src/app/components/fragments/content-text-creator/content-text-creator.component.ts @@ -16,12 +16,15 @@ export class ContentTextCreatorComponent implements OnInit { roomId: string; roomShortId: string; - content: ContentText = new ContentText('1', + content: ContentText = new ContentText( + '1', '1', '0', '', '', - 1); + 1, + [], + ); editDialogMode = false; @@ -46,7 +49,13 @@ export class ContentTextCreatorComponent implements OnInit { submitContent(subject: string, body: string) { this.contentService.addContent(new ContentText( - '1', '1', this.roomId, subject, body, 1 + '1', + '1', + this.roomId, + subject, + body, + 1, + [], )).subscribe(); if (this.content.body.valueOf() === '' || this.content.body.valueOf() === '') { this.notificationService.show('No empty fields allowed. Please check subject and body.'); diff --git a/src/app/components/fragments/content-text-participant/content-text-participant.component.ts b/src/app/components/fragments/content-text-participant/content-text-participant.component.ts index d577579f5f727b593183ee4ce0bd697c2c6c271b..c2130674da8732aeb3fdc64023ee78d5f61c4eca 100644 --- a/src/app/components/fragments/content-text-participant/content-text-participant.component.ts +++ b/src/app/components/fragments/content-text-participant/content-text-participant.component.ts @@ -12,12 +12,15 @@ import { NotificationService } from '../../../services/util/notification.service export class ContentTextParticipantComponent implements OnInit { @Input() content: ContentText; - dummyContent: ContentText = new ContentText('1', + dummyContent: ContentText = new ContentText( + '1', '1', '1', 'Text Content 1', 'This is the body of Text Content 1', - 1); + 1, + [] + ); textAnswer = ''; isAnswerSent = false; diff --git a/src/app/components/fragments/content-yes-no-creator/content-yes-no-creator.component.ts b/src/app/components/fragments/content-yes-no-creator/content-yes-no-creator.component.ts index 75857efdc9b6306065bb2208c25a34f6513695ca..afd0d9cde50fb0f51c4ce4c00d1289d394a9e1d7 100644 --- a/src/app/components/fragments/content-yes-no-creator/content-yes-no-creator.component.ts +++ b/src/app/components/fragments/content-yes-no-creator/content-yes-no-creator.component.ts @@ -20,7 +20,8 @@ export class ContentYesNoCreatorComponent implements OnInit { 'yes', 'no' ]; - content: ContentChoice = new ContentChoice('0', + content: ContentChoice = new ContentChoice( + '0', '1', '', '', @@ -28,6 +29,7 @@ export class ContentYesNoCreatorComponent implements OnInit { 1, [], [], + [], false, ContentType.BINARY ); diff --git a/src/app/components/pages/content-carousel-page/content-carousel-page.component.ts b/src/app/components/pages/content-carousel-page/content-carousel-page.component.ts index c5a4637829638ea60522a8bde767c39f11534f9a..7f356336e88c1d654d9e9637b9f223fc79c0f2b1 100644 --- a/src/app/components/pages/content-carousel-page/content-carousel-page.component.ts +++ b/src/app/components/pages/content-carousel-page/content-carousel-page.component.ts @@ -15,49 +15,7 @@ export class ContentCarouselPageComponent implements OnInit { ContentType: typeof ContentType = ContentType; // contents: Content[]; - contents = [ - new ContentChoice('0', - '1', - 'roomId1', - 'MultipleChoice Subject', - 'MultipleChoice Body', - 1, - [new AnswerOption('yes', ''), new AnswerOption('no', '')], - [], - true, - ContentType.CHOICE), - new ContentChoice('0', - '1', - 'roomId2', - 'SingleChoice Subject', - 'SingleChoice Body', - 1, - [new AnswerOption('may', ''), new AnswerOption('not', '')], - [], - false, - ContentType.BINARY), - new ContentText('1', - '1', - 'roomId3', - 'TextContent Subject', - 'TextContent Body', - 1), - new ContentChoice('0', - '1', - 'roomId4', - 'LikertContent Subject', - 'LikertContent Body', - 1, - [ - new AnswerOption('Strongly agree', '0'), - new AnswerOption('Agree', '0'), - new AnswerOption('Neither agree nor disagree', '0'), - new AnswerOption('Disagree', '0'), - new AnswerOption('Strongly disagree', '0')], - [], - false, - ContentType.SCALE) - ]; + contents = []; constructor(private contentService: ContentService, private route: ActivatedRoute) { diff --git a/src/app/models/content-choice.ts b/src/app/models/content-choice.ts index 6bca40dbb5dce9934821ad755d9a94d0e3d5e60f..a9752565624b0e68e7821f72072a9113af4a51bf 100644 --- a/src/app/models/content-choice.ts +++ b/src/app/models/content-choice.ts @@ -13,6 +13,7 @@ export class ContentChoice extends Content { subject: string, body: string, round: number, + groups: string[], options: AnswerOption[], correctOptionIndexes: number[], multiple: boolean, @@ -23,6 +24,7 @@ export class ContentChoice extends Content { subject, body, round, + groups, format, new Map()); this.options = options; diff --git a/src/app/models/content-text.ts b/src/app/models/content-text.ts index 3eb70709a4b8e8861637972122804edc48fd2f91..4a0a5db86f20038d5450c63a7db97f0c7a0ce77c 100644 --- a/src/app/models/content-text.ts +++ b/src/app/models/content-text.ts @@ -8,13 +8,15 @@ export class ContentText extends Content { roomId: string, subject: string, body: string, - round: number) { + round: number, + groups: string[]) { super(contentId, revision, roomId, subject, body, round, + groups, ContentType.TEXT, new Map()); } diff --git a/src/app/models/content.ts b/src/app/models/content.ts index eab9e95f0d1cc9664e4aaebb40e3dbf32746f221..812413580e559111f45c420c5ab34dfe6134a890 100644 --- a/src/app/models/content.ts +++ b/src/app/models/content.ts @@ -7,7 +7,7 @@ export class Content { subject: string; body: string; round: number; - groups: [string]; + groups: string[]; format: ContentType; formatAttributes: Map<string, string>; @@ -17,7 +17,7 @@ export class Content { subject: string, body: string, round: number, - groups: [string], + groups: string[], format: ContentType, formatAttributes: Map<string, string>) { this.contentId = contentId;