diff --git a/README.md b/README.md index 08973b5..7fed06e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,14 @@ # sejm-calculator Simulator for the Polish Sejm election + +Main libraries used: +* [Chartist](https://github.com/chartist-js/chartist) +* [Babel](https://github.com/babel/babel) +* [PostCSS](https://github.com/postcss/postcss) +* [Pug](https://github.com/pugjs/pug) +* [TypeScript](https://github.com/microsoft/TypeScript) +* [ESLint](https://github.com/eslint/eslint) +* [Stylelint](https://github.com/stylelint/stylelint) +* [Webpack 5](https://github.com/webpack/webpack) +* [Jest](https://github.com/jestjs/jest) +* [DOM Testing Library](https://github.com/testing-library/dom-testing-library) diff --git a/src/data.ts b/src/data.ts index ff889bd..e2563ee 100644 --- a/src/data.ts +++ b/src/data.ts @@ -35,11 +35,11 @@ export const committees: Committee[] = [ pastSupportEquivalence: [['lewica', 1]], }, { - id: 'psl', - name: 'PSL – Koalicja Polska', - shortName: 'PSL', - threshold: 5, - pastSupportEquivalence: [['psl', 1]], + id: 'td', + name: 'Trzecia Droga', + shortName: 'TD', + threshold: 8, + pastSupportEquivalence: [['psl', 0.48], ['lewica', 0.23], ['konfederacja', 0.17], ['ko', 0.15], ['pis', 0.03]], }, { id: 'konfederacja', @@ -48,13 +48,6 @@ export const committees: Committee[] = [ threshold: 5, pastSupportEquivalence: [['konfederacja', 1]], }, - { - id: 'pl2050', - name: 'Polska 2050', - shortName: 'PL2050', - threshold: 5, - pastSupportEquivalence: [['psl', 0.24], ['lewica', 0.23], ['konfederacja', 0.17], ['ko', 0.15], ['pis', 0.03]], - }, { id: 'mn', name: 'Mniejszość Niemiecka', diff --git a/src/styles/styles.css b/src/styles/styles.css index e0be483..bc7992d 100644 --- a/src/styles/styles.css +++ b/src/styles/styles.css @@ -164,18 +164,14 @@ h2 { stroke: #d44; } -.psl { - stroke: #2ed397; +.td { + stroke: #8bd32e; } .konfederacja { stroke: #655; } -.pl2050 { - stroke: #f9c013; -} - .mn { stroke: #aaa; } diff --git a/src/templates/content.pug b/src/templates/content.pug index a3c21ff..f3711e6 100644 --- a/src/templates/content.pug +++ b/src/templates/content.pug @@ -18,6 +18,8 @@ ol.updates 2020-10-28: dodano partię polityczną Polska 2050; jej prognozowane poparcie w okręgach jest liczone na podstawie deklaracji wyborców Szymona Hołowni przedstawionych w artykule #[a(href='https://biqdata.wyborcza.pl/biqdata/7,159116,26083709,analiza-przeplywow-wyborcow-za-duda-tylko-pis-lewicowcy-nie.html') #[i Analiza przepływów wyborców]] z 29 czerwca 2020 roku. + li. + 2023-08-21: dodano koalicyjny komitet wyborczy Trzecia Droga (Polska 2050 + PSL – Koalicja Polska). form#support-form diff --git a/test/calculate.test.ts b/test/calculate.test.ts index e59199a..36e46ee 100644 --- a/test/calculate.test.ts +++ b/test/calculate.test.ts @@ -1,22 +1,22 @@ import calculateMandates from '../src/mandates'; test('calculates correct results (1)', () => { - const support = [43.59, 27.4, 12.56, 8.55, 6.81, 0]; + const support = [43.59, 27.4, 12.56, 8.55, 6.81]; const mandates = calculateMandates(support); - expect(mandates).toEqual([235, 134, 49, 30, 11, 0, 1]); + expect(mandates).toEqual([237, 133, 48, 31, 10, 1]); }); test('calculates correct results (2)', () => { - const support = [30, 25, 10, 8, 6, 12]; + const support = [30, 25, 10, 20, 6]; const mandates = calculateMandates(support); - expect(mandates).toEqual([182, 133, 40, 34, 12, 58, 1]); + expect(mandates).toEqual([176, 131, 39, 104, 9, 1]); }); test('calculates correct results (3)', () => { - const support = [39.7, 42.4, 0, 0, 7.2, 0]; + const support = [39.7, 42.4, 0, 0, 7.2]; const mandates = calculateMandates(support); - expect(mandates).toEqual([225, 216, 0, 0, 18, 0, 1]); + expect(mandates).toEqual([225, 216, 0, 0, 18, 1]); }); diff --git a/test/initialDisplay.test.ts b/test/initialDisplay.test.ts index 9f01205..bfb283a 100644 --- a/test/initialDisplay.test.ts +++ b/test/initialDisplay.test.ts @@ -1,6 +1,7 @@ import {screen} from '@testing-library/dom'; import '@testing-library/jest-dom'; import {generateTable} from '../src/display'; +import {committees} from '../src/data'; import html from '../src/templates/content.pug'; beforeEach(() => { @@ -9,7 +10,7 @@ beforeEach(() => { }); test('display number inputs for electoral data', () => { - const numberOfCommitees = 6; + const numberOfCommitees = committees.length - 1; const numberInputs = screen.getAllByRole('spinbutton'); expect(numberInputs).toHaveLength(numberOfCommitees);