Skip to content

souvikmaji/leaderboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leaderboard

GitHub Maintainability

Standalone REST web service to generate Fantasy MMOG Leaderboard.

Leaderboards are the most accessed screens in any MMOGs. What makes leaderboard calculation little complex than any other rank-based leaderboards is that two or more players can share the same rank. The ranks of the players holding the same score should remain the same and the next succeeding rank to be allocated to the next player and so on.

In this project, we are using the SQL rank function to calculate user ranks.

The OVER() clause In the SQL RANK function is used to define that the entire table is being considered for calculation of the rank. The ORDER BY clause is used to sort the results in descending order.

To see the database queries being generated while fetching data, set database.logmode: true in the config.yml file.

Run in local environment

Prerequisites

  1. Go with minimum version 1.13
  2. make
  3. PostgreSQL

Setup

# Get the code
git clone https://github.com/souvikmaji/leaderboard
cd leaderboard

# initialize database and tables
make init

# Build and run
make

The application follows 12 factor principals for configuration management. Configurations are read in the following manner config.yml > .env > Exported Enviroment variables > Program Flags.

Visit: <127.0.0.1:8000>

Live Reload Server

During development use the autoreload server

make devrun

Technologies Used

TODO

  • CRUD apis for game
  • CRUD apis for users
  • Integrate validators
  • Use datatable sorting feature
  • Datatable filter by game id/ name
  • User auth apis
  • Gameplay apis
  • DB script sample size from flag
  • Use redis for db
  • Benchmark with a larger dataset
  • Read database credentials at app start for the first time.
  • Integrate Swagger
  • AutomaticEnv not working
  • Add logger
  • Hosting
  • Unit tests