GithubHelp home page GithubHelp logo

sports-checker's Introduction

README

Database setup

You can use .env file in project root to configure database connections or override other system environment variables. Look at config/database.yml for available variables

Run bin/rake db:seed to fill the database with a sample records set. This may take some time (about 2 minutes on my PC) because it creates a lot of records for players' counter and achievement data.

Available methods

  • Call player.achieved?(match, achievement) on a player instance to check if that player had specific achievement in a match.

  • Call player.achieved_last?(achievement) to check if that player had specific achievement in last 5 matches. You can also override matched count by passing a named argument match_count like that: player.achieved_last?(achievement, match_count: 6)

  • Call Player.top(achievement) to find top 5 players that have this achievement in most matches. You can also use a named argument count if you want other number of players, like Player.top(achievement, count: 3).

    This also applies to any players collection, for example, to members of a team.

  • Call team.top_players(achievement) as a shorthand method to find top 5 players of a team. It calls the players top scope internally and can also accept count argument.

  • Call player.set_counter(match, counter, value) to update value of a specific counter. This will also award achievements assotiated with that counter automatically, if value exceeds or is equal to achievement's threshold.

  • Call player.award_achievement(match, achievement) to manually award achievement to player regardless of counter values.

For any of the above methods:

  • match can be a match id or match object instance
  • achievement can be an achievement id, name, or instance
  • counter can also be a counter id, name, or instance

sports-checker's People

Contributors

infoman avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.