Finish logging

This commit is contained in:
Dennis Schoepf 2021-08-03 18:06:02 +02:00
parent 0e66a015e8
commit 095a50b9a4
6 changed files with 53 additions and 42 deletions

View file

@ -72,9 +72,10 @@ export class Logger {
public logQuestions(answers: string[], isKQ: boolean = false) {
const uid = store.getState().uid;
this.database.ref(uid).set({
[`${isKQ ? 'knowledge' : 'general'}Questions`]: answers,
});
this.database
.ref(uid)
.child(`${isKQ ? 'knowledge' : 'general'}Questions`)
.set(answers);
}
}

View file

@ -84,7 +84,16 @@ export class DetailScene {
store.getState().addUserMessage({
text: "Yaay! You've found all of the important parts of this part of the repository. You will be returned to the subproject overview now. Pick the next subproject you want to take a look at there.",
inputWanted: false,
onNext: () => store.setState({ showScore: false, currentScene: Scenes.OVERVIEW }),
onNext: () => {
logger.log({
type: 'SF',
timestamp: Date.now(),
message: `Finished subprojects: ${JSON.stringify(
store.getState().finishedSubProjects
)}`,
});
store.setState({ showScore: false, currentScene: Scenes.OVERVIEW });
},
showIdle: false,
});
}

View file

@ -13,6 +13,7 @@ export class OverviewScene {
player: Player;
playerHead: Area;
edges: Edge[];
sfLogged: boolean;
constructor() {
this.edges = generateEdges(projectMetadata.subprojects);
@ -34,7 +35,7 @@ export class OverviewScene {
logger.log({
type: 'OC',
timestamp: Date.now(),
message: 'Click outside edge',
message: 'Click inside edge',
});
store.getState().setProjectMetadata(edge.name);
@ -47,7 +48,7 @@ export class OverviewScene {
logger.log({
type: 'OC',
timestamp: Date.now(),
message: 'Click on edge',
message: 'Click outside edge',
});
}
});
@ -80,12 +81,6 @@ export class OverviewScene {
this.edges.forEach((edgeShape) => {
if (store.getState().finishedSubProjects.some((fsp) => fsp === edgeShape.name)) {
logger.log({
type: 'SF',
timestamp: Date.now(),
message: `Finished subproject: ${edgeShape.name}`,
});
edgeShape.finished = true;
}

View file

@ -43,6 +43,7 @@ export class Revealable {
isHovered: boolean;
isRevealed: boolean;
wasInteractedWith: boolean;
wasRevealed: boolean;
minSize: number = 5;
currentSize: number;
@ -87,16 +88,20 @@ export class Revealable {
} else if (isRevealed && !isHovered) {
this.state = RevealableStates.REVEALED;
logger.log({
type:
this.type === RevealableTypes.CONTRIBUTOR
? 'NR'
: this.type === RevealableTypes.LEGACY
? 'LR'
: 'PR',
timestamp: Date.now(),
message: `Revealed ${this.name}`,
});
if (!this.wasRevealed) {
logger.log({
type:
this.type === RevealableTypes.CONTRIBUTOR
? 'NR'
: this.type === RevealableTypes.LEGACY
? 'LR'
: 'PR',
timestamp: Date.now(),
message: `Revealed ${this.name}`,
});
}
this.wasRevealed = true;
} else {
this.state = RevealableStates.HIDDEN;
}

View file

@ -54,16 +54,16 @@ export class Intro {
this.backgroundRef = document.querySelector('#intro-background');
this.experienceRef = document.querySelector('#intro-experience');
this.fb1 = document.querySelector('#fb1');
this.fb2 = document.querySelector('#fb2');
this.fb3 = document.querySelector('#fb3');
this.fb4 = document.querySelector('#fb4');
this.fb5 = document.querySelector('#fb5');
this.fb6 = document.querySelector('#fb6');
this.fb7 = document.querySelector('#fb7');
this.fb8 = document.querySelector('#fb8');
this.fb9 = document.querySelector('#fb9');
this.fb10 = document.querySelector('#fb10');
this.fb1 = document.querySelector('#fb-1');
this.fb2 = document.querySelector('#fb-2');
this.fb3 = document.querySelector('#fb-3');
this.fb4 = document.querySelector('#fb-4');
this.fb5 = document.querySelector('#fb-5');
this.fb6 = document.querySelector('#fb-6');
this.fb7 = document.querySelector('#fb-7');
this.fb8 = document.querySelector('#fb-8');
this.fb9 = document.querySelector('#fb-9');
this.fb10 = document.querySelector('#fb-10');
this.errorRef = document.querySelector('#intro-error');
@ -180,6 +180,7 @@ export class Intro {
];
console.log(answers);
logger.logQuestions(answers);
}
private sendKnowledgeQuestionAnswers() {}