PUNKT-20 Tworzenie/edycja testów
This commit is contained in:
parent
0c93108991
commit
47934971ad
@ -16,7 +16,7 @@ export class FlashcardsAddCsvComponent implements OnInit {
|
|||||||
progress: { percentage: number } = { percentage: 0 };
|
progress: { percentage: number } = { percentage: 0 };
|
||||||
currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
||||||
user: string;
|
user: string;
|
||||||
permission: Boolean = true;
|
permission: Boolean = false;
|
||||||
constructor(private uploadService: FlashcardsService, private router: Router, public snackBar: MatSnackBar) { }
|
constructor(private uploadService: FlashcardsService, private router: Router, public snackBar: MatSnackBar) { }
|
||||||
|
|
||||||
ngOnInit() { this.isLoggedIn(); }
|
ngOnInit() { this.isLoggedIn(); }
|
||||||
|
@ -14,7 +14,7 @@ export class FlashcardsAddTableComponent implements OnInit {
|
|||||||
public fieldArray: Array<any> = [];
|
public fieldArray: Array<any> = [];
|
||||||
newAttribute: any = {};
|
newAttribute: any = {};
|
||||||
currentUser;
|
currentUser;
|
||||||
permission: Boolean = true;
|
permission: Boolean = false;
|
||||||
|
|
||||||
constructor(private flashcardsService: FlashcardsService, public snackBar: MatSnackBar) { }
|
constructor(private flashcardsService: FlashcardsService, public snackBar: MatSnackBar) { }
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ export class MaterialsAddComponent implements OnInit {
|
|||||||
currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
||||||
user: string;
|
user: string;
|
||||||
title: string;
|
title: string;
|
||||||
permission: Boolean = true;
|
permission: Boolean = false;
|
||||||
constructor(private uploadService: MaterialsService, private router: Router, public snackBar: MatSnackBar) { }
|
constructor(private uploadService: MaterialsService, private router: Router, public snackBar: MatSnackBar) { }
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
<p>Wprowadź treść pytania:</p>
|
<p>Wprowadź treść pytania:</p>
|
||||||
<input type="text" name="question" class="form-control" [(ngModel)]="question"/>
|
<input type="text" name="question" class="form-control" [(ngModel)]="question"/>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="block">
|
||||||
|
<p>Podaj czas na udzielenie odpowiedzi w sekundach (0 - brak limitu):</p>
|
||||||
|
<input type="number" step="1" min="0" name="time" class="form-control" [(ngModel)]="time" required/>
|
||||||
|
</label>
|
||||||
<br />
|
<br />
|
||||||
<p>Wpisz tekst widoczny i tekst luki (luka może mieć więcej niż 1 dobrą odpowiedź - każdą odpowiedź oddziel <b>średnikiem</b>).</p>
|
<p>Wpisz tekst widoczny i tekst luki (luka może mieć więcej niż 1 dobrą odpowiedź - każdą odpowiedź oddziel <b>średnikiem</b>).</p>
|
||||||
<div>
|
<div>
|
||||||
|
@ -20,6 +20,7 @@ export class GapsQuestionComponent implements OnInit {
|
|||||||
answersCorrect: Array<Object> = [];
|
answersCorrect: Array<Object> = [];
|
||||||
answers: Array<Object> = [];
|
answers: Array<Object> = [];
|
||||||
question: String = 'Uzupełnij luki w tekście:';
|
question: String = 'Uzupełnij luki w tekście:';
|
||||||
|
time = 0;
|
||||||
points: Number = 1;
|
points: Number = 1;
|
||||||
id: Number = null;
|
id: Number = null;
|
||||||
|
|
||||||
@ -31,6 +32,7 @@ export class GapsQuestionComponent implements OnInit {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.edit) {
|
if (this.edit) {
|
||||||
this.content['edit'] = true;
|
this.content['edit'] = true;
|
||||||
|
this.time = this.content['content']['time'];
|
||||||
this.question = this.content['content']['question'];
|
this.question = this.content['content']['question'];
|
||||||
const answ = this.content['content']['answers'];
|
const answ = this.content['content']['answers'];
|
||||||
this.id = this.content['content']['id'];
|
this.id = this.content['content']['id'];
|
||||||
@ -42,6 +44,7 @@ export class GapsQuestionComponent implements OnInit {
|
|||||||
id: null,
|
id: null,
|
||||||
type: 'gaps',
|
type: 'gaps',
|
||||||
question: 'Uzupełnij luki w tekście.',
|
question: 'Uzupełnij luki w tekście.',
|
||||||
|
time: 0,
|
||||||
answers: [],
|
answers: [],
|
||||||
points: 1
|
points: 1
|
||||||
};
|
};
|
||||||
@ -185,6 +188,7 @@ export class GapsQuestionComponent implements OnInit {
|
|||||||
this.content['content']['question'] = this.question;
|
this.content['content']['question'] = this.question;
|
||||||
this.content['content']['answers'] = this.answers;
|
this.content['content']['answers'] = this.answers;
|
||||||
this.content['content']['points'] = this.points;
|
this.content['content']['points'] = this.points;
|
||||||
|
this.content['content']['time'] = this.time;
|
||||||
this.content['content']['id'] = this.id;
|
this.content['content']['id'] = this.id;
|
||||||
if (this.edit) {
|
if (this.edit) {
|
||||||
this.editing.emit(this.content);
|
this.editing.emit(this.content);
|
||||||
@ -210,6 +214,7 @@ export class GapsQuestionComponent implements OnInit {
|
|||||||
this.content = {};
|
this.content = {};
|
||||||
this.edit = false;
|
this.edit = false;
|
||||||
this.question = '';
|
this.question = '';
|
||||||
|
this.time = 0;
|
||||||
this.answers = [];
|
this.answers = [];
|
||||||
this.noGapText = '';
|
this.noGapText = '';
|
||||||
this.gapText = '';
|
this.gapText = '';
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
<p>Wprowadź treść pytania:</p>
|
<p>Wprowadź treść pytania:</p>
|
||||||
<input type="text" name="question" class="form-control" [(ngModel)]="question"/>
|
<input type="text" name="question" class="form-control" [(ngModel)]="question"/>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="block">
|
||||||
|
<p>Podaj czas na udzielenie odpowiedzi w sekundach (0 - brak limitu):</p>
|
||||||
|
<input type="number" step="1" min="0" name="time" class="form-control" [(ngModel)]="time" required/>
|
||||||
|
</label>
|
||||||
<br />
|
<br />
|
||||||
<p>Wpisz możliwe odpowiedzi i zaznacz prawidłową:</p>
|
<p>Wpisz możliwe odpowiedzi i zaznacz prawidłową:</p>
|
||||||
<div>
|
<div>
|
||||||
|
@ -21,6 +21,7 @@ export class MultipleChoiceQuestionComponent implements OnInit {
|
|||||||
};
|
};
|
||||||
question: String = '';
|
question: String = '';
|
||||||
points: Number = 1;
|
points: Number = 1;
|
||||||
|
time = 0;
|
||||||
id: Number = null;
|
id: Number = null;
|
||||||
|
|
||||||
@Output() private add: EventEmitter<Object> = new EventEmitter();
|
@Output() private add: EventEmitter<Object> = new EventEmitter();
|
||||||
@ -32,6 +33,7 @@ export class MultipleChoiceQuestionComponent implements OnInit {
|
|||||||
if (this.edit) {
|
if (this.edit) {
|
||||||
this.content['edit'] = true;
|
this.content['edit'] = true;
|
||||||
this.question = this.content['content']['question'];
|
this.question = this.content['content']['question'];
|
||||||
|
this.time = this.content['content']['time'];
|
||||||
this.answers = [];
|
this.answers = [];
|
||||||
const answ = this.content['content']['answers'];
|
const answ = this.content['content']['answers'];
|
||||||
this.id = this.content['content']['id'];
|
this.id = this.content['content']['id'];
|
||||||
@ -49,6 +51,7 @@ export class MultipleChoiceQuestionComponent implements OnInit {
|
|||||||
id: this.id,
|
id: this.id,
|
||||||
type: 'multiple-choice',
|
type: 'multiple-choice',
|
||||||
question: '',
|
question: '',
|
||||||
|
time: 0,
|
||||||
answers: [],
|
answers: [],
|
||||||
points: 1
|
points: 1
|
||||||
};
|
};
|
||||||
@ -141,6 +144,7 @@ export class MultipleChoiceQuestionComponent implements OnInit {
|
|||||||
this.content['content']['question'] = this.question;
|
this.content['content']['question'] = this.question;
|
||||||
this.answers = this.answersCorrect;
|
this.answers = this.answersCorrect;
|
||||||
this.content['content']['answers'] = this.answers;
|
this.content['content']['answers'] = this.answers;
|
||||||
|
this.content['content']['time'] = this.time;
|
||||||
this.content['content']['points'] = this.points;
|
this.content['content']['points'] = this.points;
|
||||||
this.content['content']['id'] = this.id;
|
this.content['content']['id'] = this.id;
|
||||||
if (this.edit) {
|
if (this.edit) {
|
||||||
@ -169,6 +173,7 @@ export class MultipleChoiceQuestionComponent implements OnInit {
|
|||||||
this.edit = false;
|
this.edit = false;
|
||||||
this.isChecked = false;
|
this.isChecked = false;
|
||||||
this.question = '';
|
this.question = '';
|
||||||
|
this.time = 0;
|
||||||
this.answers = [];
|
this.answers = [];
|
||||||
this.answersCorrect = [];
|
this.answersCorrect = [];
|
||||||
this.newAttribute = {};
|
this.newAttribute = {};
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
<p>Wprowadź treść pytania:</p>
|
<p>Wprowadź treść pytania:</p>
|
||||||
<input type="text" name="question" class="form-control" [(ngModel)]="question"/>
|
<input type="text" name="question" class="form-control" [(ngModel)]="question"/>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="block">
|
||||||
|
<p>Podaj czas na udzielenie odpowiedzi w sekundach (0 - brak limitu):</p>
|
||||||
|
<input type="number" step="1" min="0" name="time" class="form-control" [(ngModel)]="time" required/>
|
||||||
|
</label>
|
||||||
<br />
|
<br />
|
||||||
<p>Wpisz wszystkie dopasowania:</p>
|
<p>Wpisz wszystkie dopasowania:</p>
|
||||||
<div>
|
<div>
|
||||||
|
@ -20,6 +20,7 @@ export class PairsQuestionComponent implements OnInit {
|
|||||||
};
|
};
|
||||||
question: String = 'Połącz w pary:';
|
question: String = 'Połącz w pary:';
|
||||||
points: Number = 1;
|
points: Number = 1;
|
||||||
|
time = 0;
|
||||||
id: Number = null;
|
id: Number = null;
|
||||||
|
|
||||||
@Output() add: EventEmitter<Object> = new EventEmitter();
|
@Output() add: EventEmitter<Object> = new EventEmitter();
|
||||||
@ -32,6 +33,7 @@ export class PairsQuestionComponent implements OnInit {
|
|||||||
this.answers = [];
|
this.answers = [];
|
||||||
this.content['edit'] = true;
|
this.content['edit'] = true;
|
||||||
this.question = this.content['content']['question'];
|
this.question = this.content['content']['question'];
|
||||||
|
this.time = this.content['content']['time'];
|
||||||
this.id = this.content['content']['id'];
|
this.id = this.content['content']['id'];
|
||||||
const answ = this.content['content']['answers'];
|
const answ = this.content['content']['answers'];
|
||||||
for (let i = 0; i < answ.length; i++) {
|
for (let i = 0; i < answ.length; i++) {
|
||||||
@ -48,6 +50,7 @@ export class PairsQuestionComponent implements OnInit {
|
|||||||
id: null,
|
id: null,
|
||||||
type: 'pairs',
|
type: 'pairs',
|
||||||
question: 'Połącz w pary.',
|
question: 'Połącz w pary.',
|
||||||
|
time: 0,
|
||||||
answers: [],
|
answers: [],
|
||||||
points: 1
|
points: 1
|
||||||
};
|
};
|
||||||
@ -131,6 +134,7 @@ export class PairsQuestionComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
|
this.content['content']['time'] = this.time;
|
||||||
this.content['content']['question'] = this.question;
|
this.content['content']['question'] = this.question;
|
||||||
this.answers = this.answersCorrect;
|
this.answers = this.answersCorrect;
|
||||||
this.content['content']['answers'] = this.answers;
|
this.content['content']['answers'] = this.answers;
|
||||||
@ -161,6 +165,7 @@ export class PairsQuestionComponent implements OnInit {
|
|||||||
this.content = {};
|
this.content = {};
|
||||||
this.edit = false;
|
this.edit = false;
|
||||||
this.question = '';
|
this.question = '';
|
||||||
|
this.time = 0;
|
||||||
this.answers = [];
|
this.answers = [];
|
||||||
this.answersCorrect = [];
|
this.answersCorrect = [];
|
||||||
this.newAttribute = {};
|
this.newAttribute = {};
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
<p>Wprowadź treść pytania:</p>
|
<p>Wprowadź treść pytania:</p>
|
||||||
<input type="text" name="question" class="form-control" [(ngModel)]="question"/>
|
<input type="text" name="question" class="form-control" [(ngModel)]="question"/>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="block">
|
||||||
|
<p>Podaj czas na udzielenie odpowiedzi w sekundach (0 - brak limitu):</p>
|
||||||
|
<input type="number" step="1" min="0" name="time" class="form-control" [(ngModel)]="time" required/>
|
||||||
|
</label>
|
||||||
<br />
|
<br />
|
||||||
<p>Wpisz <b>kolejno</b> wszystkie elementy rozsypanki:</p>
|
<p>Wpisz <b>kolejno</b> wszystkie elementy rozsypanki:</p>
|
||||||
<div>
|
<div>
|
||||||
|
@ -19,6 +19,7 @@ export class PuzzleQuestionComponent implements OnInit {
|
|||||||
};
|
};
|
||||||
question: String = 'Ułóż elementy w prawidłowej kolejności:';
|
question: String = 'Ułóż elementy w prawidłowej kolejności:';
|
||||||
points: Number = 1;
|
points: Number = 1;
|
||||||
|
time = 0;
|
||||||
id: Number = null;
|
id: Number = null;
|
||||||
idAnsw: Number = null;
|
idAnsw: Number = null;
|
||||||
|
|
||||||
@ -31,6 +32,7 @@ export class PuzzleQuestionComponent implements OnInit {
|
|||||||
if (this.edit) {
|
if (this.edit) {
|
||||||
this.content['edit'] = true;
|
this.content['edit'] = true;
|
||||||
this.question = this.content['content']['question'];
|
this.question = this.content['content']['question'];
|
||||||
|
this.time = this.content['content']['time'];
|
||||||
this.id = this.content['content']['id'];
|
this.id = this.content['content']['id'];
|
||||||
this.answers = [];
|
this.answers = [];
|
||||||
const answ = this.content['content']['answers'][0]['correct'];
|
const answ = this.content['content']['answers'][0]['correct'];
|
||||||
@ -47,6 +49,7 @@ export class PuzzleQuestionComponent implements OnInit {
|
|||||||
type: 'puzzle',
|
type: 'puzzle',
|
||||||
question: 'Ułóż elementy w prawidłowej kolejności.',
|
question: 'Ułóż elementy w prawidłowej kolejności.',
|
||||||
answers: [],
|
answers: [],
|
||||||
|
time: 0,
|
||||||
points: 1
|
points: 1
|
||||||
};
|
};
|
||||||
this.content['edit'] = false;
|
this.content['edit'] = false;
|
||||||
@ -120,6 +123,7 @@ export class PuzzleQuestionComponent implements OnInit {
|
|||||||
this.content['content']['question'] = this.question;
|
this.content['content']['question'] = this.question;
|
||||||
this.content['content']['answers'] = this.answers;
|
this.content['content']['answers'] = this.answers;
|
||||||
this.content['content']['points'] = this.points;
|
this.content['content']['points'] = this.points;
|
||||||
|
this.content['content']['time'] = this.time;
|
||||||
this.content['content']['id'] = this.id;
|
this.content['content']['id'] = this.id;
|
||||||
if (this.edit) {
|
if (this.edit) {
|
||||||
this.editing.emit(this.content);
|
this.editing.emit(this.content);
|
||||||
@ -157,6 +161,7 @@ export class PuzzleQuestionComponent implements OnInit {
|
|||||||
this.content = {};
|
this.content = {};
|
||||||
this.edit = false;
|
this.edit = false;
|
||||||
this.question = '';
|
this.question = '';
|
||||||
|
this.time = 0;
|
||||||
this.answers = [];
|
this.answers = [];
|
||||||
this.answersCorrect = [];
|
this.answersCorrect = [];
|
||||||
this.newAttribute = {};
|
this.newAttribute = {};
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
<p>Wprowadź treść pytania:</p>
|
<p>Wprowadź treść pytania:</p>
|
||||||
<input type="text" name="question" class="form-control" [(ngModel)]="question"/>
|
<input type="text" name="question" class="form-control" [(ngModel)]="question"/>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="block">
|
||||||
|
<p>Podaj czas na udzielenie odpowiedzi w sekundach (0 - brak limitu):</p>
|
||||||
|
<input type="number" step="1" min="0" name="time" class="form-control" [(ngModel)]="time" required/>
|
||||||
|
</label>
|
||||||
<br />
|
<br />
|
||||||
<p>Wpisz możliwe odpowiedzi i zaznacz prawidłową:</p>
|
<p>Wpisz możliwe odpowiedzi i zaznacz prawidłową:</p>
|
||||||
<div>
|
<div>
|
||||||
|
@ -21,6 +21,7 @@ export class SingleChoiceQuestionComponent implements OnInit {
|
|||||||
};
|
};
|
||||||
question: String = '';
|
question: String = '';
|
||||||
points: Number = 1;
|
points: Number = 1;
|
||||||
|
time = 0;
|
||||||
id: Number = null;
|
id: Number = null;
|
||||||
|
|
||||||
@Output() add: EventEmitter<Object> = new EventEmitter();
|
@Output() add: EventEmitter<Object> = new EventEmitter();
|
||||||
@ -34,6 +35,7 @@ export class SingleChoiceQuestionComponent implements OnInit {
|
|||||||
this.question = this.content['content']['question'];
|
this.question = this.content['content']['question'];
|
||||||
this.answers = [];
|
this.answers = [];
|
||||||
const answ = this.content['content']['answers'];
|
const answ = this.content['content']['answers'];
|
||||||
|
this.time = this.content['content']['time'];
|
||||||
this.id = this.content['content']['id'];
|
this.id = this.content['content']['id'];
|
||||||
for (let i = 0; i < answ.length; i++) {
|
for (let i = 0; i < answ.length; i++) {
|
||||||
this.answersCorrect.push({
|
this.answersCorrect.push({
|
||||||
@ -50,7 +52,8 @@ export class SingleChoiceQuestionComponent implements OnInit {
|
|||||||
type: 'single-choice',
|
type: 'single-choice',
|
||||||
question: '',
|
question: '',
|
||||||
answers: [],
|
answers: [],
|
||||||
points: 1
|
points: 1,
|
||||||
|
time: 0
|
||||||
};
|
};
|
||||||
this.content['edit'] = false;
|
this.content['edit'] = false;
|
||||||
}
|
}
|
||||||
@ -157,6 +160,7 @@ export class SingleChoiceQuestionComponent implements OnInit {
|
|||||||
this.answers = this.answersCorrect;
|
this.answers = this.answersCorrect;
|
||||||
this.content['content']['answers'] = this.answers;
|
this.content['content']['answers'] = this.answers;
|
||||||
this.content['content']['points'] = this.points;
|
this.content['content']['points'] = this.points;
|
||||||
|
this.content['content']['time'] = this.time;
|
||||||
if (this.edit) {
|
if (this.edit) {
|
||||||
this.editing.emit(this.content);
|
this.editing.emit(this.content);
|
||||||
} else {
|
} else {
|
||||||
@ -184,6 +188,7 @@ export class SingleChoiceQuestionComponent implements OnInit {
|
|||||||
this.edit = false;
|
this.edit = false;
|
||||||
this.isChecked = false;
|
this.isChecked = false;
|
||||||
this.question = '';
|
this.question = '';
|
||||||
|
this.time = 0;
|
||||||
this.answers = [];
|
this.answers = [];
|
||||||
this.answersCorrect = [];
|
this.answersCorrect = [];
|
||||||
this.newAttribute = {};
|
this.newAttribute = {};
|
||||||
|
@ -29,6 +29,10 @@ label {
|
|||||||
margin-left: 1rem;
|
margin-left: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
color: #FFF !important;
|
||||||
|
}
|
||||||
|
|
||||||
.table td {
|
.table td {
|
||||||
border-top-width: 0;
|
border-top-width: 0;
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ export class TestEditComponent implements OnInit, OnDestroy {
|
|||||||
id: d[i]['id'],
|
id: d[i]['id'],
|
||||||
type: d[i]['type'],
|
type: d[i]['type'],
|
||||||
question: d[i]['question'],
|
question: d[i]['question'],
|
||||||
|
time: d[i]['time'],
|
||||||
answers: d[i]['answers'],
|
answers: d[i]['answers'],
|
||||||
points: d[i]['points']
|
points: d[i]['points']
|
||||||
},
|
},
|
||||||
@ -213,6 +214,7 @@ export class TestEditComponent implements OnInit, OnDestroy {
|
|||||||
nr: this.test[i]['nr'],
|
nr: this.test[i]['nr'],
|
||||||
type: this.test[i]['content']['type'],
|
type: this.test[i]['content']['type'],
|
||||||
question: this.test[i]['content']['question'],
|
question: this.test[i]['content']['question'],
|
||||||
|
time: this.test[i]['content']['time'],
|
||||||
answers: this.test[i]['content']['answers'],
|
answers: this.test[i]['content']['answers'],
|
||||||
points: this.test[i]['content']['points'],
|
points: this.test[i]['content']['points'],
|
||||||
id: this.test[i]['content']['id']
|
id: this.test[i]['content']['id']
|
||||||
|
@ -29,6 +29,10 @@ label {
|
|||||||
margin-left: 1rem;
|
margin-left: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
color: #FFF !important;
|
||||||
|
}
|
||||||
|
|
||||||
.table td {
|
.table td {
|
||||||
border-top-width: 0;
|
border-top-width: 0;
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
<th>Lp.</th>
|
<th>Lp.</th>
|
||||||
<th>Typ</th>
|
<th>Typ</th>
|
||||||
<th class="mobile">Punkty</th>
|
<th class="mobile">Punkty</th>
|
||||||
|
<th class="mobile">Czas na odpowiedź</th>
|
||||||
<th class="mobile">Pytanie</th>
|
<th class="mobile">Pytanie</th>
|
||||||
<th>Usuń</th>
|
<th>Usuń</th>
|
||||||
<th class="mobile">Przenieś</th>
|
<th class="mobile">Przenieś</th>
|
||||||
@ -72,6 +73,8 @@
|
|||||||
*ngIf='question.content.type == "pairs"'>Łączenie w pary</td>
|
*ngIf='question.content.type == "pairs"'>Łączenie w pary</td>
|
||||||
<td (click)='showComponents(question.content.type, question.nr)'
|
<td (click)='showComponents(question.content.type, question.nr)'
|
||||||
class="mobile">{{ question.content.points }}</td>
|
class="mobile">{{ question.content.points }}</td>
|
||||||
|
<td (click)='showComponents(question.content.type, question.nr)'
|
||||||
|
class="mobile">{{ question.content.time }}</td>
|
||||||
<td (click)='showComponents(question.content.type, question.nr)'
|
<td (click)='showComponents(question.content.type, question.nr)'
|
||||||
class="mobile">{{ question.shortcut }}</td>
|
class="mobile">{{ question.shortcut }}</td>
|
||||||
<td><button class="btn btn-study-cave" (click)="delete(question.nr)"><i class="fas fa-trash-alt"></i> Usuń</button></td>
|
<td><button class="btn btn-study-cave" (click)="delete(question.nr)"><i class="fas fa-trash-alt"></i> Usuń</button></td>
|
||||||
|
@ -11,7 +11,7 @@ export class TestMakerComponent implements OnInit {
|
|||||||
|
|
||||||
owner: Number = 0;
|
owner: Number = 0;
|
||||||
title: String = '';
|
title: String = '';
|
||||||
permission: Boolean = true;
|
permission: Boolean = false;
|
||||||
|
|
||||||
test: Array<Object> = [];
|
test: Array<Object> = [];
|
||||||
shown: Boolean = false;
|
shown: Boolean = false;
|
||||||
@ -159,6 +159,7 @@ export class TestMakerComponent implements OnInit {
|
|||||||
nr: this.test[i]['nr'],
|
nr: this.test[i]['nr'],
|
||||||
type: this.test[i]['content']['type'],
|
type: this.test[i]['content']['type'],
|
||||||
question: this.test[i]['content']['question'],
|
question: this.test[i]['content']['question'],
|
||||||
|
time: this.test[i]['content']['time'],
|
||||||
answers: this.test[i]['content']['answers'],
|
answers: this.test[i]['content']['answers'],
|
||||||
points: this.test[i]['content']['points'],
|
points: this.test[i]['content']['points'],
|
||||||
id: this.test[i]['content']['id']
|
id: this.test[i]['content']['id']
|
||||||
|
@ -18,6 +18,7 @@ export class TestResource {
|
|||||||
public id: number;
|
public id: number;
|
||||||
public points: number;
|
public points: number;
|
||||||
public question: string;
|
public question: string;
|
||||||
|
public time: string;
|
||||||
public nr: number;
|
public nr: number;
|
||||||
public answers: Answer[];
|
public answers: Answer[];
|
||||||
|
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
<p>Wprowadź treść pytania:</p>
|
<p>Wprowadź treść pytania:</p>
|
||||||
<input type="text" name="question" class="form-control" [(ngModel)]="content['content']['question']" required />
|
<input type="text" name="question" class="form-control" [(ngModel)]="content['content']['question']" required />
|
||||||
</label>
|
</label>
|
||||||
|
<label class="block">
|
||||||
|
<p>Podaj czas na udzielenie odpowiedzi w sekundach (0 - brak limitu):</p>
|
||||||
|
<input type="number" step="1" min="0" name="time" class="form-control" [(ngModel)]="content['content']['time']" required/>
|
||||||
|
</label>
|
||||||
<br />
|
<br />
|
||||||
<p>Zaznacz prawidłową odpowiedź:</p>
|
<p>Zaznacz prawidłową odpowiedź:</p>
|
||||||
<label>
|
<label>
|
||||||
|
@ -16,18 +16,22 @@ export class TrueFalseQuestionComponent implements OnInit {
|
|||||||
@Output() add: EventEmitter<Object> = new EventEmitter();
|
@Output() add: EventEmitter<Object> = new EventEmitter();
|
||||||
@Output() editing: EventEmitter<Object> = new EventEmitter();
|
@Output() editing: EventEmitter<Object> = new EventEmitter();
|
||||||
|
|
||||||
|
time = 0;
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.edit) {
|
if (this.edit) {
|
||||||
this.content['edit'] = true;
|
this.content['edit'] = true;
|
||||||
this.id = this.content['content']['id'];
|
this.id = this.content['content']['id'];
|
||||||
|
this.time = this.content['content']['time'];
|
||||||
} else {
|
} else {
|
||||||
this.content = {};
|
this.content = {};
|
||||||
this.content['content'] = {
|
this.content['content'] = {
|
||||||
id: null,
|
id: null,
|
||||||
type: 'true-false',
|
type: 'true-false',
|
||||||
question: '',
|
question: '',
|
||||||
|
time: 0,
|
||||||
answers: [
|
answers: [
|
||||||
{id: null, content: 'Prawda', is_good: false},
|
{id: null, content: 'Prawda', is_good: false},
|
||||||
{id: null, content: 'Fałsz', is_good: false}
|
{id: null, content: 'Fałsz', is_good: false}
|
||||||
@ -50,6 +54,7 @@ export class TrueFalseQuestionComponent implements OnInit {
|
|||||||
id: this.id,
|
id: this.id,
|
||||||
type: 'true-false',
|
type: 'true-false',
|
||||||
question: value['question'],
|
question: value['question'],
|
||||||
|
time: value['time'],
|
||||||
answers: [
|
answers: [
|
||||||
{id: this.content['content']['answers'][0]['id'], content: 'Prawda', is_good: true},
|
{id: this.content['content']['answers'][0]['id'], content: 'Prawda', is_good: true},
|
||||||
{id: this.content['content']['answers'][1]['id'], content: 'Fałsz', is_good: false}
|
{id: this.content['content']['answers'][1]['id'], content: 'Fałsz', is_good: false}
|
||||||
@ -61,6 +66,7 @@ export class TrueFalseQuestionComponent implements OnInit {
|
|||||||
id: this.id,
|
id: this.id,
|
||||||
type: 'true-false',
|
type: 'true-false',
|
||||||
question: value['question'],
|
question: value['question'],
|
||||||
|
time: value['time'],
|
||||||
answers: [
|
answers: [
|
||||||
{id: this.content['content']['answers'][0]['id'], content: 'Prawda', is_good: false},
|
{id: this.content['content']['answers'][0]['id'], content: 'Prawda', is_good: false},
|
||||||
{id: this.content['content']['answers'][1]['id'], content: 'Fałsz', is_good: true}
|
{id: this.content['content']['answers'][1]['id'], content: 'Fałsz', is_good: true}
|
||||||
@ -68,6 +74,7 @@ export class TrueFalseQuestionComponent implements OnInit {
|
|||||||
points: value['points']
|
points: value['points']
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
console.log(this.content);
|
||||||
if (this.edit) {
|
if (this.edit) {
|
||||||
this.editing.emit(this.content);
|
this.editing.emit(this.content);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user