Simply include it in your Decidim instance.
Add this line to your application's Gemfile:
gem 'decidim-stratified_sortitions'And then execute:
bundleThis module uses the COIN-OR CBC solver for the LEXIMIN fair selection algorithm. You need to install CBC on your system:
Ubuntu/Debian:
sudo apt install coinor-cbc coinor-libcbc-devmacOS (Homebrew):
brew install cbcFedora/RHEL:
sudo dnf install coin-or-Cbc coin-or-Cbc-develAfter installing the gem you must import and execute the migrations bundled with the gem:
bundle exec rails decidim_stratified_sortitions:install:migrations
bundle exec rails db:migrateDecidim::StratifiedSortitions allows fair sortitions in two ways.
- Generate all the panels and extract the samples at once.
- Execute the sortition in two phases
See Decidim::StratifiedSortitions::FairSortitionService for more details on how to each workflow works.
Create a dummy app in your application (if not present):
bundle exec rake test_app
cd spec/decidim_dummy_app/
bundle exec rails decidim_stratified_sortitions:install:migrations
RAILS_ENV=test bundle exec rails db:migrateAnd run tests:
# Run all tests
bundle exec rspec spec
# Run only performance tests
bundle exec rspec --tag performance
# Run all tests except performance (default)
bundle exec rspec --tag ~performance
# Run also slow tests
bundle exec rspec --tag performance --tag slowSee Decidim.
See Decidim.