Skip to content

nzzdev/Q-election-seats

Repository files navigation

Q Election Seats Build Status Greenkeeper badge

Maintainer: Danijel Beljan

Q Election Seats is one tool of the Q toolbox to display the allocation of seats according to parliamentary elections. Test it in the playground.

Table of contents

Installation

git clone [email protected]:nzzdev/Q-election-seats.git
cd ./Q-election-seats
nvm use
npm install
npm run build

to the top

Configuration

No configuration is needed for this tool.

to the top

Development

Start the Q dev server:

npx @nzz/q-cli server

Run the Q tool:

node index.js

to the top

Testing

The testing framework used in this repository is Code.

Run the tests:

npm run test

Implementing a new test

When changing or implementing...

  • A route, it needs to be tested in the e2e-tests.js file
  • Something on the frontend, it needs to be tested in the dom-tests.js file

to the top

Deployment

We provide automatically built docker images at https://hub.docker.com/r/nzzonline/q-election-seats/. There are three options for deployment:

  • use the provided images
  • build your own docker images
  • deploy the service using another technology

Use the provided docker images

  1. Deploy nzzonline/q-election-seats to a docker environment
  2. Set the ENV variables as described in the configuration section

to the top

Functionality

The tool structure follows the general structure of each Q tool. Further information can be found in Q server documentation - Developing tools.

Here is what the tool looks like on mobile and other devices. The example shows the intermediate seat allocation of the elections in the Netherlands in 2017. It's in German because we do not have multilanguage support (yet).

Q Election Seats uses svelte3 to render the markup on server-side.

Seat allocation as shown on other devices Seat allocation as shown on mobile

Each graphic has the following three sections:

  • Header: contains specified title and subtitle
  • Main Part: displays the seat allocation including the total amount of seats. The legend indicates the correlation of color and party as well as the gained number of seats and the trend information compared to the last elections
  • Footer: contains further notes (e.g. how many municipalities already finished counting), source(s) and update information

to the top

Options

hideUpdatedDate

This option allows to hide the update date shown in the footnote section

Display Options

hideTitle

Allows to hide the title

License

Copyright (c) 2019 Neue Zürcher Zeitung. All rights reserved.

This software is published under the MIT license.

to the top