GitLab wird am Donnerstag, den 27. Januar, zwischen 08:00 und 12:00 Uhr wegen wichtigen Wartungsarbeiten nicht zur Verfügung stehen.

Commit 79053e9c authored by Christopher Mark Fullarton's avatar Christopher Mark Fullarton
Browse files

Sends the relevant questionindex always with the notification about changed responses

parent 4471bcfe
...@@ -139,15 +139,17 @@ export class MemberEntity extends AbstractEntity implements IMemberEntity { ...@@ -139,15 +139,17 @@ export class MemberEntity extends AbstractEntity implements IMemberEntity {
} }
public addResponseValue(data: Array<number> | string | number): void { public addResponseValue(data: Array<number> | string | number): void {
const responseTime = new Date().getTime() - this.getCurrentQuiz().currentStartTimestamp; const quiz = this.getCurrentQuiz();
const responseTime = new Date().getTime() - quiz.currentStartTimestamp;
this.responses[this.getCurrentQuiz().currentQuestionIndex].value = data; this.responses[quiz.currentQuestionIndex].value = data;
this.responses[this.getCurrentQuiz().currentQuestionIndex].responseTime = responseTime; this.responses[quiz.currentQuestionIndex].responseTime = responseTime;
DbDAO.updateOne(DbCollection.Members, { DbDAO.updateOne(DbCollection.Members, {
_id: this.id, _id: this.id,
}, { responses: this.responses }); }, { responses: this.responses });
this.getCurrentQuiz().updatedMemberResponse({ quiz.updatedMemberResponse({
nickname: this.name, nickname: this.name,
questionIndex: quiz.currentQuestionIndex,
update: { update: {
value: data, value: data,
responseTime, responseTime,
...@@ -156,23 +158,27 @@ export class MemberEntity extends AbstractEntity implements IMemberEntity { ...@@ -156,23 +158,27 @@ export class MemberEntity extends AbstractEntity implements IMemberEntity {
} }
public setConfidenceValue(confidence: number): void { public setConfidenceValue(confidence: number): void {
this.responses[this.getCurrentQuiz().currentQuestionIndex].confidence = confidence; const quiz = this.getCurrentQuiz();
this.responses[quiz.currentQuestionIndex].confidence = confidence;
DbDAO.updateOne(DbCollection.Members, { DbDAO.updateOne(DbCollection.Members, {
_id: this.id, _id: this.id,
}, { responses: this.responses }); }, { responses: this.responses });
this.getCurrentQuiz().updatedMemberResponse({ quiz.updatedMemberResponse({
nickname: this.name, nickname: this.name,
questionIndex: quiz.currentQuestionIndex,
update: { confidence: confidence }, update: { confidence: confidence },
}); });
} }
public setReadingConfirmation(): void { public setReadingConfirmation(): void {
this.responses[this.getCurrentQuiz().currentQuestionIndex].readingConfirmation = true; const quiz = this.getCurrentQuiz();
this.responses[quiz.currentQuestionIndex].readingConfirmation = true;
DbDAO.updateOne(DbCollection.Members, { DbDAO.updateOne(DbCollection.Members, {
_id: this.id, _id: this.id,
}, { responses: this.responses }); }, { responses: this.responses });
this.getCurrentQuiz().updatedMemberResponse({ quiz.updatedMemberResponse({
nickname: this.name, nickname: this.name,
questionIndex: quiz.currentQuestionIndex,
update: { readingConfirmation: true }, update: { readingConfirmation: true },
}); });
} }
......
Markdown is supported
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