Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stats: Display on Profile the user's top, average and median score #77

Open
vimark1 opened this issue Oct 29, 2018 · 1 comment
Open

Comments

@vimark1
Copy link
Owner

vimark1 commented Oct 29, 2018

Render user's time top, average and median score

There should be dropdown to allow the user to see top, average and median from a time range:

  • Last 24 hours
  • Last month
  • All time

User sessions are stored in

typist/src/Main/index.js

Lines 187 to 218 in 1f8c297

async saveScore() {
try {
const { user } = this.props;
if (!user.uid) return this.setState({ authError: true });
this.setState({ authError: false, error: '' });
const { score } = this.state;
// a string in the format 2018-10-26
const sessionId = (new Date()).toISOString().slice(0,10);
// store record in Firebase
await firebase
.database()
.ref('user-score')
.child(user.uid)
.child(sessionId)
.push({
score,
timestamp: firebase.database.ServerValue.TIMESTAMP
});
this.updateScoreboard(user, score)
} catch (err) {
console.error(err);
this.setState({
error:
'Something went wrong while saving score, please contact support!'
});
}
}

@prakash9494
Copy link

Hi,
Can you provide any screenshot this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants