Giter VIP home page Giter VIP logo

roschaefer / rundfunk-mitbestimmen Goto Github PK

View Code? Open in Web Editor NEW
39.0 9.0 30.0 13.94 MB

How should your broadcasting fees be spent? Publish your support and improve the program.

Home Page: https://rundfunk-mitbestimmen.de/

License: MIT License

Ruby 45.05% Gherkin 5.05% HTML 5.09% JavaScript 26.84% CSS 0.38% PLpgSQL 5.43% Dockerfile 0.18% Shell 0.12% Handlebars 11.86%
democracy broadcasting data-visualization

rundfunk-mitbestimmen's Introduction

rundfunk-mitbestimmen

Build Status

Problem

Public broadcasting in Germany receives €8,000,000,000 (eight billion euros) annually, yet it is subject to no public feedback, ranking, or even debate on what constitutes value or quality.

Solution

On rundfunk-mitbestimmen.de you can say how your €17.50 per month should be spent. It is a proof of concept how digital democracy can work for publicly funded media and it is a win-win situation for both sides: More influence for the audience. More data for broadcasters.

Community

Rundfunk mitbestimmen is maintained by the community. We have regular meetings, run online pair-programmings and tutorials in our online learner community at Agile Ventures. You can join our Slack here and then find us in our channel #rundfunk-mitbestimmen. Here is the Youtube Playlist of our recent meetings or pair-programmings:

Community pair-programming/meeting

Directory Layout

This repository contains three important folders:

  1. frontend (EmberJS)
  2. backend (Ruby on Rails)
  3. features (Cucumber/Capybara)

Backend

The backend is responsible to store the data. Who wants to pay for which broadcast and how much? Users are related to broadcasts via impressions in the database. The response on the impression model can be either negative, neutral and positive and indicates whether a user wants to give money to a broadcast. If the response is positive, the amount further specifies how much to pay for a broadcast. So, the sum of all amounts per user must not exceed the monthly fee of 17,50€ per month.

ER diagram

Frontend

The frontend should be as easy to use as possible. The user can login and register, fetch a set of not yet voted broadcasts, decide about broadcasts, assign money and see the public statistics. Most of these actions will send requests to the backend. The frontend should be comfortable to use, e.g. by default amounts are evenly distributed with the option to set the amount explicitly.

Process diagram

Features

We do full stack testing with Cucumber and Capybara. We specify the requirements as user stories in our Github issues and implement them as cucumber features. The cucumber features are a good starting for you to understand the current behaviour and the reasoning behind it.

Here is our model how to write tests. The cucumber tests are at the top. As they test the entire stack, cucumber tests tend to be rather slow in execution but in return they deliver some confidence that the system works. Testing pyramid

Installation and Usage with Docker

Make sure you have docker and docker-compose installed:

$ docker --version
Docker version 18.05.0-ce, build f150324782
$ docker-compose --version
docker-compose version 1.22.0, build unknown

Clone the repository:

git clone https://github.com/roschaefer/rundfunk-mitbestimmen.git

You can setup the development environment with:

cd rundfunk-mitbestimmen
docker-compose up

This can take a while... As soon as this is finished, create the database and run migrations with:

docker-compose run --rm backend rails db:create db:migrate

App is running on localhost:4200

If you want, you can create some seed data

docker-compose run --rm backend rails db:seed

Run frontend tests:

docker-compose run --rm frontend ember test

Run backend tests:

docker-compose run --rm backend bin/rspec

For fullstack testing, use the provided docker-compose override:

docker-compose -f docker-compose.yml -f docker-compose.fullstack-testing.yml up

When all containers are up, run the cucumber tests in the fullstack service with:

docker-compose run --rm fullstack bundle exec cucumber

Local Installation

Make sure that you have a recent version of node, yarn, EmberJS, ruby, Redis and postgresql installed before you proceed. E.g. we have the following versions:

$ node --version
v10.4.1
$ yarn --version
1.7.0
$ ember --version
ember-cli: 3.1.4
node: 10.4.1
os: linux x64

$ ruby --version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
$ psql --version
psql (PostgreSQL) 9.6.5
$ redis-server -v
Redis server v=5.0.1

Clone the repository:

git clone https://github.com/roschaefer/rundfunk-mitbestimmen.git

Install dependencies and run migrations:

  1. Install dependencies for full stack testing
cd rundfunk-mitbestimmen
bundle
  1. Install frontend dependencies
cd frontend
yarn install
  1. Install backend dependencies
cd ../backend
bundle
  1. Setup the database

(OPTIONAL): Customize the file backend/config/database.yml to match your local database configuration.

Now make sure that postgresql database is running

[linux]$ sudo systemctl start postgresql
[macos]$ brew services start postgresql

Create the databases and run the migrations:

rails db:create db:migrate
  1. If you want, you can create some seed data

You need to have redis running

[linux]$ sudo systemctl start redis
[macos]$ brew services start redis

Then you can seed the data

cd backend
rails db:seed
cd ..

Usage

Start the backend and sidekiq:

cd backend && rails s
cd backend && bundle exec sidekiq

Open another terminal and start the frontend:

cd frontend && ember server

App is running on localhost:4200

Full stack testing

Run the frontend server:

cd frontend && ember server --environment=fullstack

Open two more terminals and run the backend server and sidekiq:

cd backend && rails server --environment=fullstack
cd backend && bundle exec sidekiq

Open yet another terminal and run the tests:

bundle exec cucumber

These environments serve the purpose to

  1. Stub out external services in the frontend, e.g. authentication via Auth0.
  2. Use a separate test database in the backend, which will be cleaned after each test run.

If you want to run chrome or firefox instead of headless chrome, you can set an environment variable:

bundle exec cucumber DRIVER=chrome

or

bundle exec cucumber DRIVER=firefox

Frontend tests

cd frontend && ember test --server

Backend tests

cd backend && bin/rspec

Guidelines

See our detailed contribution guidelines 🔍

We use this project board as our central issue tracker. Issues are ordered by priority and you can filter for good first issue if you are interested in a beginner-friendly task. Additionally, issues are tagged with backend and frontend depending on where code needs to be changed.

Auth0

Don't be afraid of our identity provider Auth0. In development environment your login will reach the "rundfunk-testing" instance of Auth0. This will not pollute the Auth0 instance used in production.

Workflow for Behaviour Driven Development with Cucumber:

  1. Fork it 🍴
  2. Pick an issue from the backlog
  3. Create your feature branch: git checkout -b [issue number]_my_new_feature_branch
  4. Createfeatures/[site of change]/your.feature and copy+paste the feature description from GitHub
  5. Boot both frontend and backend as described in the section about testing
  6. Run bundle exec cucumber
  7. Append the terminal output to features/step_definitions/steps.rb and write expectations
  8. Run bundle exec cucumber - tests should fail
  9. Implement the feature
  10. Run bundle exec cucumber - tests should pass
  11. Commit your changes: git commit -am 'Add some feature'
  12. Push to the branch: git push origin -u [issue number]_my_new_feature_branch
  13. Submit a pull request ❤️

Deployment

Our build server Travis CI takes care about automatic deployment. Approximately 15 minutes after your pull request was merged into master, you should see the changes in production.

Useful Links

License

See the LICENSE file for license rights and limitations (MIT).

rundfunk-mitbestimmen's People

Contributors

amotl avatar aonomike avatar arku avatar ciremoussadia avatar dangilletta avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar dkuku avatar domangi avatar faithngetich avatar gitter-badger avatar jehrhardt avatar kachulio1 avatar lilibetborges avatar lindseyperry avatar mattlindsey avatar mattwr18 avatar mz99 avatar najarhasan avatar nickschimek avatar roschaefer avatar sigu avatar somamo avatar tbaraza avatar zmagod avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rundfunk-mitbestimmen's Issues

Invoice: Release a fixed amount

As a user
I want to release a previously fixed amount and let the application take care of it
Because I changed my mind and now I do not care anymore how much money a broadcast will receive

My Broadcasts: Distribute division rest

As a user who is distributing the symbolic budget
I want to distribute the division rest with a click, it's OK if that leads to unequal amounts
To get rid of any remaining budget

selection_156

Broadcasts: Reselect broadcast

As a user
I want to have a list with all my deselected broadcasts and an option to re-select some of them
Because I changed my mind and want to add them to my invoice again

Find broadcasts: Update remaining results counter

Feature: Update remaining results counter
  As a user
  I want the number of unseen broadcasts to decrease when I click on `Yes` or `Next`
  In order to get immediate feedback and to learn that I am constantly reducing a set of broadcasts

selection_154

LandingPage: Compare annual broadcasting fees with analogies

As a user, who visits the app for the first time
I want to browse through a set of examples, what you could do with 8 billions of euros
In order to get a feeling for this otherwise intangible number

Acceptance criteria:
Cycle through a list of paragraphs every 5 seconds: With 8 billion euros, you can do

  • example 1
  • example 2
  • etc

This was repeatedly mentioned during user tests, people don't have a feeling how much 8 billions of euros actually is.

Decide/new: Validate broadcasts description

As the maintainer of the database
I want that users cannot create broadcasts without an acceptable description
To enforce a minimum quality of the data

Acceptance criteria:
Description must be

  • present
  • minimum number of characters (e.g. 40)
  • no URLs (user should not leave the app, aka context switching)

During user tests I learned that users click on Save, not knowing they create new broadcasts in the database. "Oops" 😄

Balances: Better metrics

As a broadcaster
I want to see a ratio how many people like my broadcast and how much money people give on average
In order to infer the popularity of my broadcast and how important it is for my target group

DecisionPage: Pagination

As a user
I want to load more broadcasts on the decision page
Because I am not tired and I want to make a decision on even more broadcasts

Decide: Spinning symbol spinning forever

If you hit the search button twice and the model does not get updated, the spinning symbol in your search bar spins forever even though there is no pending request to the backend. Creates a lot of confusion.

LandingPage: Explain the purpose

As a visitor
I want to see a short paragraph of text with general information on the landing page
To understand the purpose of the app

Allow Surplus Donations

The Rundfunkbeitrag is the minimal amount users have to distribute to shows or projects they like.

However if people like to, they should be allowed to donate more of their money than their Rundfunkbeitrag to Projects.

I propose:
Allow extra donations by users.

For this to work properly and efficiently I believe it is a good idea to have the feature of making what each show/project needs transparent, as mentioned in #15 .

Taking 1-5% of this money could be a business model. The relative amount donated could also be variable and chosen by the user.

Allow guest accounts

As a first-time user
I want to use the app without registration
So there is no barrier and I won't loose my interest

Decide: Lead the user through the suggestions

As a user
I want to get a suggestion when a pile of decision cards runs out - issue the invoice or draw new cards?
Because I do not know when it is a good moment to review the invoice

LandingPage: Explain the impact

As a user, who visits the app for the very first time
I want to read that plausible user data has an effect on broadcasters and the public opinion
In order to understand the mechanism, how does influence arise?

During user tests people didn't get that the app distributes virtual money only. Also, it was not obvious that broadcasters may take decisions based on that user data. This connection should be stated explicitly on the landing page with a short paragraph.

Decide: Go back one decision card

As a user
I want to have a 'Back' button on the decision page
To fix an error e.g. I pushed the button 'Next' but that was by accident

Generate invoices

As a user
I want to generate an invoice including the selected broadcasts
To say how much money should go to each item

LandingPage: Show some stats

As a user
I want to see on the landing page these numbers:

  • registered users
  • broadcasts
  • selections
  • global sum of all amounts

To be impressed and get a feeling how the total amount of monies compares to the broadcasting fees

LandingPage: FAQ

As a journalist who wants to write about the platform
I probably have some questions that I want to be answered on the very first page, e.g.

  • who is responsible for this?
  • is it a survey?
  • do they get money? do they want money?
  • is it open source?
  • who has access to user data?

Because I want the concept to be well laid out and then I might get in contact the maintainer of the website

Decide: Random sample

As a user
I want to get a random sample of broadcasts on the decision page, unless specified differently
In order to make an unbiased decision

Decide: Display a nice picture

Feature: Show broadcasts with a teaser image
  As a user when deciding if I want to support a broadcast
  I want to see a picture for every broadcast
  Because e.g. I know the moderator and immediately recognize the show

selection_157

Note
This includes also adding a image url input field to the broadcast form

Decide: Progress-bar

Show a progress depending on the current step. Let's hope this is rewarding for people.

Invoice: See leftover budget

As a contributor
I want to see if I have any remaining budget that I have not spent so far
In order to spend all my budget completely

Invoice: Rounding error?

Sometimes an amount does not get saved exactly as I enter it, e.g. 5.0€ turns into 4.99€ even though there is still enough available money.

Show required amount and money already received

Every Project or show on TV has a certain amount of money they need to produce whatever they produce. If the money exceeds the required amount of money a lot the money cannot be put to good use in this project. More money for the show/project does not necessarily mean there will be more shows of that type or it will have a better quality.

I propose:
Each show/project can submit or has a required amount of money they need to produce the show./work on the project (Maybe this can be more distinguished as well, "amount required", "amount wanted", "maximum amount usable in a reasonable way")
As Users distribute their Rundfunkbeitrag they see how much money each show is already receiving (and whether the threshold is crossed).
This allows users to distribute their Rundfunkbeitrag not only paying attention to what they like but also to what each show needs. This allows the users to give their money to a show they like, which is not their favorite, because the favorite has already received enough money.

This opens up the possibility for users to influence the program a lot by not supplying shows or projects with the minimal required amount.

Imprint

As the maintainer of the site
I want to link to the imprint from the landing page
In order to comply with German law

Decide: Filter by medium

As a contributor
I want to filter by radio or TV
To get more relevant results with a coarse filter and without limiting my results too extensively

Find broadcast: Filter by genre

Feature: Filter by genre
  As a user
  I want to filter the list of available broadcasts by genre
  To see broadcasts that are more relevant to me

Invoice: Change amount

As a contributor
I want to click on my invoice table and edit the amount
To say precisely how much money I want to give to certain broadcasts

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.