https://github.com/99x/walk2win
Online Walking challenge for workplaces
https://github.com/99x/walk2win
fitness game google-fit hacktoberfest steps walk2win walking-game
Last synced: 3 months ago
JSON representation
Online Walking challenge for workplaces
- Host: GitHub
- URL: https://github.com/99x/walk2win
- Owner: 99x
- License: mit
- Created: 2019-07-13T13:50:05.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-10T07:32:11.000Z (about 2 years ago)
- Last Synced: 2025-04-29T09:43:01.466Z (5 months ago)
- Topics: fitness, game, google-fit, hacktoberfest, steps, walk2win, walking-game
- Language: TypeScript
- Homepage:
- Size: 3.91 MB
- Stars: 12
- Watchers: 5
- Forks: 17
- Open Issues: 28
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
![]()
[](https://github.com/99xt/walk2win/blob/master/LICENSE)
[](https://github.com/99xt/walk2win/issues)
[](https://github.com/99xt/walk2win/stargazers)
[](https://github.com/99xt/walk2win/network)
[](https://img.shields.io/github/last-commit/99xt/walk2win)
[](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2F99xt%2Fwalk2win)### What is walk2win
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.
#### Some highlighted features
- Easy setup with Docker
- Fully customizable scoring system with advanced features like bonus scores
- Mobile friendly dashboard
- Multiple leaderboard views (male, female and teams)### Milestones
- [x] Create initial project files
- [x] Add html template to the client folder
- [x] Create mongo models (Team, Player, SyncRecord)
- [x] Create required controllers
- [x] Add method to accept date + steps and update accordingly
- [x] Google Auth and extract daily steps
- [x] API integration testing
- [x] Implement frontend according to the design
- [x] Create Dockerfile and docker-compose.yml
- [x] Deploy into a AWS vm
- [x] User testing### REST API
- `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```json
{
"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
```json
{
"stepCounts":
{
"date": "2018-10-12",
"steps": 7500
}
}
```
- `GET /api/v1/playersync` - Retrive scores/steps for a specific player```json
//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
}
```### Developer Setup
Fork and clone `https://github.com/99xt/walk2win.git`
Install dependencies
```bash
$ cd client
$ npm i
$ cd ../server
$ npm i
```
### Setup enviroment configuration#### Prerequisites
- A Docker-installed virtual machine. (Eg: AWS EC2)
- A MongoDb instance
- OAuth 2.0 client ID and API key for Google Fit API#### server
- Setup mongo connection string and the server port from `./server/.env`
```
MONGO_STR=
PORT=3003
```- Add your contest rules into `./server/constants.js`
#### client
- Follow steps mentioned [here](https://developers.google.com/fit/rest/v1/get-started) to request an OAuth 2.0 client ID and API key.
- Add the keys to the relevant `environment.ts` file in location `client/src/environments`. You can select either prod or dev.
```
export const environment = {
production: true,
baseApi: '',
client_id: '',
apiKey: ''
};
```Install mongodb and then import sample data
```bash
$ 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
### Deployment guidelines
Login to your vm or machine via `ssh`
```
$ ssh -i .pem @
```Remove existing directory and get a clone from deployment repository
```
$ sudo rm -rf
$ git clone
```Create containers
```
$ cd
$ sudo docker-compose up --build -d
```### Initialize db from data.csv
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 /bin/bash -d
$ cd data
$ ./initialize.sh
```## License
Distributed under the MIT [License](https://github.com/99xt/walk2win/blob/master/LICENSE)
Made with [contributors-img](https://contributors-img.firebaseapp.com).