Page 1 of 1

Adding values to database--giving users "points"

Posted: Wed Jul 23, 2014 10:24 pm
by Ololade

I'm relatively new to this but I am hoping someone can help me?

(#1) I am putting together an app that would allow registered users to answer multiple choice questions and receive a certain number of points for each correct answer.

I am wondering what the best way to go about this is? Should I be creating some kind of server script or can I just put make it run a javascript to check the answer and send it to the database right in the page events area.

(#2) Is there an easy way to simply add a value to the database without getting that information from the user?

Please help!


Adding values to database--giving users "points"

Posted: Thu Jul 24, 2014 2:28 pm
by Evgene Karachevtsev

Hello,

1) As you wish, you may do both ways.
2) Please clarify, you just need to paste some info in the dB? You may from admin directory of Appery.io backend, you may create the file in the correct format and import info into the database from a file http://devcenter.appery.io/documentat...


Adding values to database--giving users "points"

Posted: Thu Jul 24, 2014 3:10 pm
by Ololade

Hi Eugene, thank you so much for responding :)

Basically, it works like this:

Users register by signing up (email as login and password) and select one of 3 teams to join (Heat, Rockets, Lakers) and see a list of multiple choice questions such as:

Question1. What is scooby do?
a. a dog
b. a cat
c. a person

Question2. Who is Stephen Colbert
a. the president of Canada
b. a CNN anchor
c. i don't know

DATABASE:
I have four collections so far (i know this may NOT be the best way to set it up):
USERS (username, passsword, team),
POINTS (userpoints, userteampoints),
GAMES (questions, answera, answerb, answerc, pointvalues), and
TEAMS (teamname, totalpoints)
(I still have no idea how to record what questions a user has completed yet)

GENERAL IDEA:
Here is how it is supposed to work: I have a question bank (25 total questions) saved in the games collection. Each time the user answers an individual question correctly, they get either 6 (easy questions) or 10 (hard questions) points added to their userpoints column in my "points" collection. That question disappears from their list of questions (so they can't keep answering the same question and getting more points) and they choose another question to answer.

When a user gets points, their total team score (the team they selected at the beginning registration) is also increased as a bonus with half of those points so "UserBob" gets 6 points for his answering Question1 correctly and his team, Rockets, also gets 3 points as a bonus for his work.

DYANAMIC SIDE
In terms of moving back and forth between collections, I need to be able to:

  • Assign points to a user for answering specific questions

  • Identify and remove questions a user has completed

  • Show users their own current points

  • Show users the number of points they have added to their team

  • Show users each team's total current points (the rankings)

    Is this something that can be accomplished using appery? Would it require a bunch of server scripts or is there an easier way? I have registration complete but I'm not sure how to go about doing the rest (i'm used to relational databases and I'm learning on the fly).