Walk to win(also known as walk2win) is an online walking challenge for workplaces. Employees are able to register with this challenge as individual participants or they are able to register as teams. Daily steps count can be recorded by signing into the Google account(via Google Fit platform) or by manual entry. Game leaderboard will show a list of players and teams ranked by the total score and steps.
- Easy setup with Docker
- Fully customizable scoring system with advanced features like bonus scores
- Mobile friendly dashboard
- Multiple leaderboard views (male, female and teams)
- Create initial project files
- Add html template to the client folder
- Create mongo models (Team, Player, SyncRecord)
- Create required controllers
- Add method to accept date + steps and update accordingly
- Google Auth and extract daily steps
- API integration testing
- Implement frontend according to the design
- Create Dockerfile and docker-compose.yml
- Deploy into a AWS vm
- User testing
GET /api/v1/leaderboard/topteams
GET /api/v1/leaderboard/topteams/{teamId}
GET /api/v1/leaderboard/topplayers
GET /api/v1/leaderboard/topplayers/{playerId}
GET /api/v1/leaderboard/topmaleplayers
GET /api/v1/leaderboard/topfemaleplayers
POST /api/v1/sync
- Replaces steps data, recalculates team/solo scores
{
"stepCounts": [
{
"date": "2018-10-12",
"steps": 7500
},
{
"date": "2018-12-12",
"steps": 8500
}
]
}
POST /api/v1/syncmanual
- Update/Add single data point, recalculates team/solo scores
{
"stepCounts":
{
"date": "2018-10-12",
"steps": 7500
}
}
GET /api/v1/playersync
- Retrive scores/steps for a specific player
//Sample output
{
"total_steps": [
{
"_id": "5d31f96c936e5360eaa83c94",
"steps": 5500,
"points": 25,
"date": "2018-11-12T00:00:00.000Z"
},
{
"_id": "5d31ec3d41f5763bf038d9ae",
"date": "2018-10-12T00:00:00.000Z",
"steps": 5500,
"points": 25
}
],
"steps": 11000,
"points": 50
}
Fork and clone https://github.com/99xt/walk2win.git
Install dependencies
$ cd client
$ npm i
$ cd ../server
$ npm i
- A Docker-installed virtual machine. (Eg: AWS EC2)
- A MongoDb instance
- OAuth 2.0 client ID and API key for Google Fit API
- Setup mongo connection string and the server port from
./server/.env
MONGO_STR=<database_string>
PORT=3003
- Add your contest rules into
./server/constants.js
-
Follow steps mentioned here to request an OAuth 2.0 client ID and API key.
-
Add the keys to the relevant
environment.ts
file in locationclient/src/environments
. You can select either prod or dev.
export const environment = {
production: true,
baseApi: '<add_base_api_here>',
client_id: '<add_client_id_here>',
apiKey: '<add_apiKey_here>'
};
Install mongodb and then import sample data
$ cd server
// Enter some rows into data/data.csv
$ npm run initdb
Start the REST API
$ cd server
$ npm run dev
Start the Angular app
$ cd client
$ ng serve -o
Submit a pull request with the new feature
Login to your vm or machine via ssh
$ ssh -i <key-file>.pem <username>@<domain>
Remove existing directory and get a clone from deployment repository
$ sudo rm -rf <repo-name>
$ git clone <repo-url>
Create containers
$ cd <repo-name>
$ sudo docker-compose up --build -d
if you are using external mongodb service directly execute intialize.sh
from the host. Otherwise(If you are using dockerized mongo instance), Log in to the container and execute initialize.sh
$ sudo docker exec -it --user=root <container_id> /bin/bash -d
$ cd data
$ ./initialize.sh
Distributed under the MIT License
Made with contributors-img.