Handle anon participants
This commit is contained in:
parent
095a50b9a4
commit
92c349a135
3 changed files with 30 additions and 7 deletions
|
|
@ -167,7 +167,7 @@
|
||||||
<div id="intro-step3">
|
<div id="intro-step3">
|
||||||
<h1>General Questions</h1>
|
<h1>General Questions</h1>
|
||||||
<p>Please provide some additional information about you below:</p>
|
<p>Please provide some additional information about you below:</p>
|
||||||
<label for="name">
|
<label id="name-label" for="name">
|
||||||
Your name
|
Your name
|
||||||
<input type="text" id="intro-name" name="name" placeholder="e.g. Max" />
|
<input type="text" id="intro-name" name="name" placeholder="e.g. Max" />
|
||||||
</label>
|
</label>
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,13 @@ export class Logger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public logPersonalData(name: string, age: number, background: string, experience: string) {
|
public logPersonalData(
|
||||||
|
name: string,
|
||||||
|
age: number,
|
||||||
|
background: string,
|
||||||
|
experience: string,
|
||||||
|
anonymous: boolean
|
||||||
|
) {
|
||||||
const uid = store.getState().uid;
|
const uid = store.getState().uid;
|
||||||
|
|
||||||
this.database.ref(uid).set({
|
this.database.ref(uid).set({
|
||||||
|
|
@ -66,6 +72,7 @@ export class Logger {
|
||||||
age,
|
age,
|
||||||
background,
|
background,
|
||||||
experience,
|
experience,
|
||||||
|
anonymous,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,12 @@ export class Intro {
|
||||||
const background = this.backgroundRef.value;
|
const background = this.backgroundRef.value;
|
||||||
const experience = this.experienceRef.value;
|
const experience = this.experienceRef.value;
|
||||||
|
|
||||||
if (!name || !age || !background || experience === 'Choose an option...') {
|
if (
|
||||||
|
(this.anonymous ? false : !name) ||
|
||||||
|
!age ||
|
||||||
|
!background ||
|
||||||
|
experience === 'Choose an option...'
|
||||||
|
) {
|
||||||
this.errorRef.style.display = 'block';
|
this.errorRef.style.display = 'block';
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -158,11 +163,15 @@ export class Intro {
|
||||||
this.sendGeneralQuestionAnswers();
|
this.sendGeneralQuestionAnswers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentStep === 5) {
|
||||||
|
this.sendKnowledgeQuestionAnswers();
|
||||||
|
}
|
||||||
|
|
||||||
store.setState((state) => ({ currentIntroStep: state.currentIntroStep + 1 }));
|
store.setState((state) => ({ currentIntroStep: state.currentIntroStep + 1 }));
|
||||||
}
|
}
|
||||||
|
|
||||||
private sendDemographicData(name: string, age: number, background: string, experience: string) {
|
private sendDemographicData(name: string, age: number, background: string, experience: string) {
|
||||||
logger.logPersonalData(name, age, background, experience);
|
logger.logPersonalData(name, age, background, experience, this.anonymous);
|
||||||
}
|
}
|
||||||
|
|
||||||
private sendGeneralQuestionAnswers() {
|
private sendGeneralQuestionAnswers() {
|
||||||
|
|
@ -179,13 +188,20 @@ export class Intro {
|
||||||
this.fb10.value,
|
this.fb10.value,
|
||||||
];
|
];
|
||||||
|
|
||||||
console.log(answers);
|
|
||||||
logger.logQuestions(answers);
|
logger.logQuestions(answers);
|
||||||
}
|
}
|
||||||
|
|
||||||
private sendKnowledgeQuestionAnswers() {}
|
private sendKnowledgeQuestionAnswers() {
|
||||||
|
const answers = [];
|
||||||
|
|
||||||
private hideNameInput() {}
|
logger.logQuestions(answers, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private hideNameInput() {
|
||||||
|
this.nameRef.style.display = 'none';
|
||||||
|
const label = document.querySelector('#name-label') as HTMLElement;
|
||||||
|
label.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
private showStep() {
|
private showStep() {
|
||||||
if (this.currentStep === 1) {
|
if (this.currentStep === 1) {
|
||||||
|
|
|
||||||
Reference in a new issue