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

Spike: plan how to record user's progress #64

Closed
alodahl opened this issue Sep 13, 2020 · 5 comments
Closed

Spike: plan how to record user's progress #64

alodahl opened this issue Sep 13, 2020 · 5 comments
Assignees
Labels
backend GHC2020 Project good first issue Good for newcomers GraceHopperOSD Reserved for GHC Open Source Day! Priority 1 Do first!

Comments

@alodahl
Copy link
Collaborator

alodahl commented Sep 13, 2020

Note: make pull requests to techtonica/keyboard-shortcuts-practice's 'backend' branch.

Find out the best way to record a user savepoint in Techtonica/keyboard-shortcuts-practice.

Document your new dev plan + user journey for how to access the data for a savepoint at the bottom of the project's ReadMe.md.

People who pick this up are going to have to research how the practice app progresses through its stages of difficulty so that they know which data to save once we have a user database.

@alodahl alodahl added backend GHC2020 Project GraceHopperOSD Reserved for GHC Open Source Day! Priority 1 Do first! labels Sep 13, 2020
@alodahl
Copy link
Collaborator Author

alodahl commented Sep 13, 2020

userflow

@alodahl alodahl added the good first issue Good for newcomers label Sep 13, 2020
@vegetabill vegetabill self-assigned this Sep 22, 2020
@vegetabill
Copy link
Collaborator

vegetabill commented Sep 25, 2020

Hi @alodahl , The draft below covers the data model and auth. Please take a look and provide feedback, in particular the bolded open questions.

DB Tables

users table

  • id: string - will be an Auth0 identifier or an arbitrary value like "test" value for local development
  • last_login: timestamp

Indexes needed: none

user_answers table

  • id: integer sequence
  • user_id: string (foreign key to users.id)
  • question_number: integer
  • is_correct: boolean
  • elapsed_time_ms: integer
  • created_at : timestamp (we don't need updated_at since this is immutable. this name can be configured in the sequelize model as we don't want the default camel case name)

Indexes needed:

  • [user_id, question_number]
  • [user_id] - if we need the bulk /user/answers endpoint
  • created_at - for /user/answers/last

Open question: do we need is_correct or will we only store correct answers? - I was wondering if we want to track % correct for the user.

Authentication Setup

  • Open question: are we supporting guest usage or does the user need to be logged in?
  • Auth0 will provide a hosted signup/signin form (email/password) so we can delete issues related to building that UI
  • Using the Auth0-endorsed express middleware, express-openid-connect, this will redirect the user to the login form if they are not logged in
  • For local development, since developers will likely not have an Auth0 setup and there is not a simple way to stub it, I suggest we just have a sensible default, such as always logging in with user id "1" or "test"
  • If the user is logged in and begins using the app, any API requests to save data can look at the request object and know the logged in user id

API endpoints

  • GET /user/answers/question/{questionNumber} - returns the user's history of a question they have answered, a max of 3 previous records per unique question (for the timing UI)
  • POST /user/answers/question/{questionNumber} - submit a (correct?) answer including its timing
  • GET /users/answers/last - returns the most recently created answer record, which if the user wants to resume where they left off, would be one before where they should start
  • GET /user/answers - bulk endpoint to get all the history in one request, which is similar to how the history code works now (needed??)
  • GET /questions - (optional) move the public JSON file into the express server
  • Note: /login, /logout will be provided by express-openid-connect and don't need any custom code

@alodahl
Copy link
Collaborator Author

alodahl commented Oct 1, 2020

This looks good!

I think guest usage should be fine.

Whatever feedback a user gets now should be available when they come back in another session, but we can break those things into separate issues do to later if need be.

@alodahl
Copy link
Collaborator Author

alodahl commented Oct 1, 2020

Also, I disagree that we don't need a login button. Would we want the user to be able to trigger the Auth0 login UI? And log out? We just wouldn't need to design an input. Also, with a login button, the user has the option not to log in. But we can discuss tomorrow =)

@vegetabill
Copy link
Collaborator

Mapped these reqs to the tickets on the board. Closing as done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend GHC2020 Project good first issue Good for newcomers GraceHopperOSD Reserved for GHC Open Source Day! Priority 1 Do first!
Development

No branches or pull requests

2 participants