Closed twishasaraiya closed 6 years ago
What about fetching quote and options together? Like GET Question?? @twishasaraiya
Truth is, our MongoDB schema will be somewhat like: questions: [ { question: "...", options: ["....", "..."], answer: ["..."] }, // Continues ]
So during fetching of each of the questions, there will be requirement of just one GET request as @danivijay mentioned. Regarding the customizing of options as @twishasaraiya once told me, if there are 6 options we can use a random option generator function to generate random options (3 of them) from the options list and add the answer as a default to it to make it 4 options.
Let me know what you guys think regarding this?
I agree with @anurag-majumdar I will suggest a minor change to the schema
questions: [
{
question: "...",
answer: "..."
},
...
],
options: [
'optionone',
'optiontwo',
...
]
To keep things simple, we can process the GET /question
as:
options
listAdding an options
list will help us not store redundant data and will help us in future when we add more questions.
@twishasaraiya Regarding score update, I have one doubt. Will there be a profile for every player or we just have to remember the current score and forget it when a new game is played or user logs out. I think as a starting point to make things simple, we can just remember the current score in a single game. The client side can take care of this. So the flow will look like:
Looks great @ashwani99 . Can I make a PR to make the initial part of the schema for MongoDB using Mongoose?
@anurag-majumdar Sure, take it on. Thanks again for contributing. :)
@skyshader I want to work on the API using ExpressJS. May I take that? I will work with @anurag-majumdar
@ashwani99 Sounds great. You will be making changes to the route request and adding controllers I guess?
I would like to take something as well.
@anurag-majumdar Yes
@ashwani99 do submit your own PRs. Note that working on something with dependencies needs a lot of collaboration and merges :)
So what I understand is: @anurag-majumdar is taking up the schema creation for Quotes model. @ashwani99 is taking up API creation for getting the quotes (This is tricky, lets discuss this further)
Some of the concerns while creating the API is:
Let's discuss.
@sounak07 You can take UserAnswers which would contain user, the question they answered and if they were right or wrong with a score. Let's discuss this in a separate issue thread. Right now we are talking about schema creation. We will move to API next.
Yeah, I'd like to take something up as well... been away for a couple of days.
@SevenSinS02 and others, please ask the questions not related to issues on slack channel. Let's keep the issues with relevant discussions.
@skyshader Nice points. So my suggestions will go like this:
limit
which will send us that many questions. Or rather make it a constant if the number of questions are same for every game. If we are using the limit
query param, we can have another GET endpoint for /options
which will be handled as explained in 3
@ashwani99
@skyshader
id
. We will have /questions?limit=<number-of-questions>
which will return a list of ids of questions chosen at random. Then for each question we will make /quote/<id>
which will return us the question
, answer
and the options
For example, /questions?limit=3
will return:
{
'ids': [5, 8, 2]
}
Then for each quote we will request to /quote/5
, /quote/8
and /quote/2
I think we need @twishasaraiya 's input here. Do we want to make it a continuous game play or do we want to keep a quiz session of let's say 10 questions and declare the results. If that's answered we would know what steps we need to take to achieve this.
@skyshader I am adding the schema in a new file in develop branch. Will send a PR soon.
@skyshader and @ashwani99 This is how I have thought about it. Suppose each question is of 100 points, I would like to continue the game till the user reaches 1000 points(If the user gets first 10 question right he wins) else the game continues till he reaches 1000 points. The user can leave the game at any point if he wishes too. Let me know what you guys think.
@twishasaraiya That eliminates the competitiveness. If there are a limited number of questions, user can share that score on social media that will attract new users. I think we should have either a constant number of questions(like 10) or let the user choose number of questions. What do you think? @skyshader
@ashwani99 I think we should maybe allow the user to select his target in the number of points(like a goal) he wishes to achieve instead of the number of questions.
@danivijay @twishasaraiya @skyshader @ashwani99 Added a pull request for the initial question model file. The PR is for develop branch.
@anurag-majumdar I would suggest please move the discussion regarding the DB model to another issue
@ashwani99 sure.
So since we have the basic schema ready, i think we should start looking into the API bit.
Please acknowledge who is taking up the task and let's get started with the development :)
I would like to contribute to one of the routes setup for API with schema. @skyshader
i liked to work on backend part is their any features left to do?? @twishasaraiya @skyshader
@skyshader I wanted to take the API creation part https://github.com/UdacityMobileWebScholarship/guess-quote/issues/36#issuecomment-383617589 May I take this?
Yes, @ashwani99 @anurag-majumdar take it away. Do comment which API you guys will be working on down below. :)
@skyshader @ashwani99 I think we need to setup a route for questions in server. Can I work on setting up the routes for the question part? Then @ashwani99 can work on the API GET /questions part.
Or we can negotiate on both.
What about UPDATE Score?? I think we need new collection for Score Details.
@suhasbansude There is a high possibility that the score of the quiz won't be saved initially. I guess the back-end of the app is almost ready except for the randomizing and fetching of questions part.
The API for getting random set of questions is done and we are planning to keep the scoring offline for now. Hence closing this.
I can think of the following
Please let us know your suggestions here.