Skip to content
Snippets Groups Projects
Commit c21ef10b authored by Tom Käsler's avatar Tom Käsler
Browse files

Merge branch '210-fix-content-creation' into 'master'

Resolve "Fix content creation"

Closes #210

See merge request arsnova/arsnova-lite!186
parents b5cd51f9 8f73e8d4
No related merge requests found
...@@ -138,6 +138,11 @@ export class ContentChoiceCreatorComponent implements OnInit { ...@@ -138,6 +138,11 @@ export class ContentChoiceCreatorComponent implements OnInit {
} }
saveChanges(index: number, answer: DisplayAnswer, matDialogOutput: boolean) { saveChanges(index: number, answer: DisplayAnswer, matDialogOutput: boolean) {
if (this.singleChoice) {
for (const option of this.content.options) {
option.points = -10;
}
}
this.content.options[index].label = answer.answerOption.label; this.content.options[index].label = answer.answerOption.label;
this.content.options[index].points = (answer.correct) ? 10 : -10; this.content.options[index].points = (answer.correct) ? 10 : -10;
const indexInCorrectOptionIndexes = this.content.correctOptionIndexes.indexOf(index); const indexInCorrectOptionIndexes = this.content.correctOptionIndexes.indexOf(index);
...@@ -238,13 +243,8 @@ export class ContentChoiceCreatorComponent implements OnInit { ...@@ -238,13 +243,8 @@ export class ContentChoiceCreatorComponent implements OnInit {
}); });
return; return;
} }
if (this.singleChoice) { this.content.multiple = !this.singleChoice;
this.content.multiple = false; this.content.format = ContentType.BINARY;
this.content.format = ContentType.BINARY;
} else {
this.content.multiple = true;
this.content.format = ContentType.CHOICE;
}
let contentGroup: string; let contentGroup: string;
if (this.contentCol === 'Default') { if (this.contentCol === 'Default') {
contentGroup = ''; contentGroup = '';
......
...@@ -79,8 +79,12 @@ export class ContentYesNoCreatorComponent implements OnInit { ...@@ -79,8 +79,12 @@ export class ContentYesNoCreatorComponent implements OnInit {
return; return;
} }
if (this.yesno) { if (this.yesno) {
this.content.options[0].points = 10;
this.content.options[1].points = -10;
this.content.correctOptionIndexes = [0]; this.content.correctOptionIndexes = [0];
} else { } else {
this.content.options[0].points = -10;
this.content.options[1].points = 10;
this.content.correctOptionIndexes = [1]; this.content.correctOptionIndexes = [1];
} }
let contentGroup: string; let contentGroup: string;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment