sapor 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (326) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/bin/create_installation_package.sh +1 -1
  4. data/bin/install.sh +1 -1
  5. data/bin/sapor.rb +1 -1
  6. data/bin/sapor.sh +1 -1
  7. data/data/hu/hungary-2014.txt +1 -1
  8. data/data/hu/hungary_2014_screen_scraper.rb +1 -1
  9. data/data/hu/hungary_2014_to_psv.rb +2 -2
  10. data/data/ie/2016-04-28_general-election-2016-candidate-details-csv_en.csv +552 -0
  11. data/data/ie/ireland_2016_to_psv.rb +138 -0
  12. data/data/no/2020-01-01_partifordeling_1_st_2017.csv +335 -0
  13. data/data/no/norway_2017_to_psv.rb +61 -0
  14. data/data/pl/poland_2015_to_psv.rb +2 -2
  15. data/data/pl/poland_2015_to_psv_with_ko_and_rsw.rb +2 -2
  16. data/data/pl/poland_2015_to_psv_with_ko_konf_kp_l_and_zp.rb +2 -2
  17. data/data/pl/poland_2015_to_psv_with_ko_sld_and_wi.rb +2 -2
  18. data/data/pl/poland_2015_to_psv_with_sld.rb +2 -2
  19. data/data/pl/poland_2015_to_psv_with_sld_and_wi.rb +2 -2
  20. data/data/uk/united_kingdom_2015_to_psv.rb +2 -2
  21. data/data/uk/united_kingdom_2017_to_psv.rb +2 -2
  22. data/data/uk/united_kingdom_2017_to_psv_with_brexit_and_chuk.rb +2 -2
  23. data/data/uk/united_kingdom_2017_to_psv_with_tig.rb +2 -2
  24. data/lib/sapor.rb +3 -3
  25. data/lib/sapor/binomials_cache.rb +1 -1
  26. data/lib/sapor/combinations_distribution.rb +1 -1
  27. data/lib/sapor/denominators.rb +1 -1
  28. data/lib/sapor/dichotomies.rb +1 -1
  29. data/lib/sapor/dichotomy.rb +1 -1
  30. data/lib/sapor/first_past_the_post.rb +1 -1
  31. data/lib/sapor/largest_remainder.rb +1 -1
  32. data/lib/sapor/log4r_logger.rb +1 -1
  33. data/lib/sapor/log_facade.rb +1 -1
  34. data/lib/sapor/many_past_the_post.rb +113 -0
  35. data/lib/sapor/multi_district_leveled_proportional.rb +1 -1
  36. data/lib/sapor/multi_district_proportional.rb +1 -1
  37. data/lib/sapor/multi_district_variable_threshold_proportional.rb +1 -1
  38. data/lib/sapor/number_formatter.rb +1 -1
  39. data/lib/sapor/options.rb +1 -1
  40. data/lib/sapor/poll.rb +12 -14
  41. data/lib/sapor/polychotomy.rb +1 -1
  42. data/lib/sapor/pseudorandom_multirange_enumerator.rb +1 -1
  43. data/lib/sapor/referendum_polychotomy.rb +1 -1
  44. data/lib/sapor/regional_data/area.rb +28 -10
  45. data/lib/sapor/regional_data/austria.rb +1 -1
  46. data/lib/sapor/regional_data/belgium-brussels-2014.psv +1 -1
  47. data/lib/sapor/regional_data/belgium-brussels-20190526.psv +1 -1
  48. data/lib/sapor/regional_data/belgium-flanders-2014.psv +1 -1
  49. data/lib/sapor/regional_data/belgium-flanders-20190526.psv +1 -1
  50. data/lib/sapor/regional_data/belgium-wallonia-2014.psv +1 -1
  51. data/lib/sapor/regional_data/belgium-wallonia-20190526.psv +1 -1
  52. data/lib/sapor/regional_data/belgium.rb +1 -1
  53. data/lib/sapor/regional_data/belgium_brussels.rb +1 -1
  54. data/lib/sapor/regional_data/belgium_flanders.rb +1 -1
  55. data/lib/sapor/regional_data/belgium_wallonia.rb +1 -1
  56. data/lib/sapor/regional_data/catalonia-2012-2015.psv +1 -1
  57. data/lib/sapor/regional_data/catalonia-2012.psv +1 -1
  58. data/lib/sapor/regional_data/catalonia-2015-jxcat.psv +1 -1
  59. data/lib/sapor/regional_data/catalonia-2015-no-jxsi.psv +1 -1
  60. data/lib/sapor/regional_data/catalonia-2015.psv +1 -1
  61. data/lib/sapor/regional_data/catalonia-20171221-with-vox.psv +67 -0
  62. data/lib/sapor/regional_data/catalonia-20171221.psv +61 -0
  63. data/lib/sapor/regional_data/catalonia.rb +57 -29
  64. data/lib/sapor/regional_data/denmark-20150618-with-e-and-p.psv +1 -1
  65. data/lib/sapor/regional_data/denmark-20150618-with-e.psv +1 -1
  66. data/lib/sapor/regional_data/denmark-20150618-with-p.psv +1 -1
  67. data/lib/sapor/regional_data/denmark-20150618.psv +1 -1
  68. data/lib/sapor/regional_data/denmark.rb +1 -1
  69. data/lib/sapor/regional_data/denmark_with_e.rb +1 -1
  70. data/lib/sapor/regional_data/denmark_with_e_and_p.rb +1 -1
  71. data/lib/sapor/regional_data/denmark_with_p.rb +1 -1
  72. data/lib/sapor/regional_data/estonia.rb +1 -1
  73. data/lib/sapor/regional_data/european-union-great-britain-20140522-brexit-chuk.psv +1 -1
  74. data/lib/sapor/regional_data/european-union-great-britain-20140522.psv +1 -1
  75. data/lib/sapor/regional_data/european-union-great-britain-20190523.psv +1 -1
  76. data/lib/sapor/regional_data/european-union-ireland-2014-ia-ri-sd.psv +1 -1
  77. data/lib/sapor/regional_data/european-union-ireland-2014-ia-sd.psv +1 -1
  78. data/lib/sapor/regional_data/european-union-ireland-2014-ia.psv +1 -1
  79. data/lib/sapor/regional_data/european-union-ireland-2014-sd.psv +1 -1
  80. data/lib/sapor/regional_data/european-union-ireland-2014.psv +1 -1
  81. data/lib/sapor/regional_data/european-union-ireland-20190524-ia.psv +1 -1
  82. data/lib/sapor/regional_data/european-union-ireland-20190524.psv +1 -1
  83. data/lib/sapor/regional_data/european_union_27_austria.rb +1 -1
  84. data/lib/sapor/regional_data/european_union_27_croatia.rb +4 -2
  85. data/lib/sapor/regional_data/european_union_27_denmark.rb +1 -1
  86. data/lib/sapor/regional_data/european_union_27_estonia.rb +1 -1
  87. data/lib/sapor/regional_data/european_union_27_finland.rb +1 -1
  88. data/lib/sapor/regional_data/european_union_27_france.rb +1 -1
  89. data/lib/sapor/regional_data/european_union_27_ireland.rb +1 -1
  90. data/lib/sapor/regional_data/european_union_27_ireland_with_ia.rb +1 -1
  91. data/lib/sapor/regional_data/european_union_27_italy.rb +1 -1
  92. data/lib/sapor/regional_data/european_union_27_netherlands.rb +1 -1
  93. data/lib/sapor/regional_data/european_union_27_poland.rb +1 -1
  94. data/lib/sapor/regional_data/european_union_27_romania.rb +1 -1
  95. data/lib/sapor/regional_data/european_union_27_slovakia.rb +1 -1
  96. data/lib/sapor/regional_data/european_union_27_spain.rb +1 -1
  97. data/lib/sapor/regional_data/european_union_27_sweden.rb +1 -1
  98. data/lib/sapor/regional_data/european_union_austria.rb +1 -1
  99. data/lib/sapor/regional_data/european_union_bulgaria.rb +1 -1
  100. data/lib/sapor/regional_data/european_union_croatia.rb +4 -2
  101. data/lib/sapor/regional_data/european_union_cyprus.rb +1 -1
  102. data/lib/sapor/regional_data/european_union_czech_republic.rb +1 -1
  103. data/lib/sapor/regional_data/european_union_denmark.rb +1 -1
  104. data/lib/sapor/regional_data/european_union_estonia.rb +1 -1
  105. data/lib/sapor/regional_data/european_union_finland.rb +1 -1
  106. data/lib/sapor/regional_data/european_union_flanders.rb +1 -1
  107. data/lib/sapor/regional_data/european_union_france.rb +1 -1
  108. data/lib/sapor/regional_data/european_union_french_community_of_belgium.rb +1 -1
  109. data/lib/sapor/regional_data/european_union_germany.rb +1 -1
  110. data/lib/sapor/regional_data/european_union_great_britain.rb +1 -1
  111. data/lib/sapor/regional_data/european_union_greece.rb +1 -1
  112. data/lib/sapor/regional_data/european_union_hungary.rb +1 -1
  113. data/lib/sapor/regional_data/european_union_ireland.rb +1 -1
  114. data/lib/sapor/regional_data/european_union_ireland_with_ia.rb +1 -1
  115. data/lib/sapor/regional_data/european_union_italy.rb +1 -1
  116. data/lib/sapor/regional_data/european_union_latvia.rb +1 -1
  117. data/lib/sapor/regional_data/european_union_lithuania.rb +1 -1
  118. data/lib/sapor/regional_data/european_union_luxembourg.rb +1 -1
  119. data/lib/sapor/regional_data/european_union_malta.rb +1 -1
  120. data/lib/sapor/regional_data/european_union_netherlands.rb +1 -1
  121. data/lib/sapor/regional_data/european_union_northern_ireland.rb +1 -1
  122. data/lib/sapor/regional_data/european_union_poland.rb +1 -1
  123. data/lib/sapor/regional_data/european_union_portugal.rb +1 -1
  124. data/lib/sapor/regional_data/european_union_romania.rb +1 -1
  125. data/lib/sapor/regional_data/european_union_slovakia.rb +1 -1
  126. data/lib/sapor/regional_data/european_union_slovenia.rb +1 -1
  127. data/lib/sapor/regional_data/european_union_spain.rb +1 -1
  128. data/lib/sapor/regional_data/european_union_sweden.rb +1 -1
  129. data/lib/sapor/regional_data/finland-20150419-with-sin.psv +1 -1
  130. data/lib/sapor/regional_data/finland-20150419.psv +1 -1
  131. data/lib/sapor/regional_data/finland.rb +1 -1
  132. data/lib/sapor/regional_data/finland_with_sin.rb +1 -1
  133. data/lib/sapor/regional_data/flanders-2014.psv +1 -1
  134. data/lib/sapor/regional_data/flanders-20190526.psv +1 -1
  135. data/lib/sapor/regional_data/flanders.rb +1 -1
  136. data/lib/sapor/regional_data/france.rb +1 -1
  137. data/lib/sapor/regional_data/greece.rb +1 -1
  138. data/lib/sapor/regional_data/hungary-2014.psv +1 -1
  139. data/lib/sapor/regional_data/hungary.rb +1 -1
  140. data/lib/sapor/regional_data/iceland-20161029-midflokkurinn.psv +1 -1
  141. data/lib/sapor/regional_data/iceland-20161029.psv +1 -1
  142. data/lib/sapor/regional_data/iceland-20171028-with-j.psv +94 -0
  143. data/lib/sapor/regional_data/iceland-20171028.psv +1 -1
  144. data/lib/sapor/regional_data/iceland.rb +32 -16
  145. data/lib/sapor/regional_data/ireland-20160226-2020-candidates.psv +322 -0
  146. data/lib/sapor/regional_data/ireland-20160226-2020.psv +344 -0
  147. data/lib/sapor/regional_data/ireland-20160226.psv +348 -0
  148. data/lib/sapor/regional_data/ireland.rb +165 -0
  149. data/lib/sapor/regional_data/latvia-20141004-kpv-p-par.psv +1 -1
  150. data/lib/sapor/regional_data/latvia-20141004-kpv-par.psv +1 -1
  151. data/lib/sapor/regional_data/latvia-20141004-kpv.psv +1 -1
  152. data/lib/sapor/regional_data/latvia-20141004.psv +1 -1
  153. data/lib/sapor/regional_data/latvia-20181006.psv +1 -1
  154. data/lib/sapor/regional_data/latvia.rb +1 -1
  155. data/lib/sapor/regional_data/luxembourg-20131020.psv +1 -1
  156. data/lib/sapor/regional_data/luxembourg-20181014.psv +1 -1
  157. data/lib/sapor/regional_data/luxembourg.rb +1 -1
  158. data/lib/sapor/regional_data/netherlands.rb +1 -1
  159. data/lib/sapor/regional_data/norway-20170911.psv +331 -0
  160. data/lib/sapor/regional_data/norway.rb +44 -339
  161. data/lib/sapor/regional_data/norwegian_municipality.rb +1 -1
  162. data/lib/sapor/regional_data/poland-20151025-with-ko-and-l-without-n-po-r-and-zl.psv +1 -1
  163. data/lib/sapor/regional_data/poland-20151025-with-ko-konf-kp-l-and-zp-without-k-k15-n-pis-po-psl-r-and-zl.psv +1 -1
  164. data/lib/sapor/regional_data/poland-20151025-with-ko-sld-and-wi-without-n-po-and-zl.psv +1 -1
  165. data/lib/sapor/regional_data/poland-20151025-with-sld-and-wi-without-zl.psv +1 -1
  166. data/lib/sapor/regional_data/poland-20151025-with-sld-without-zl.psv +1 -1
  167. data/lib/sapor/regional_data/poland-20151025.psv +1 -1
  168. data/lib/sapor/regional_data/poland.rb +1 -1
  169. data/lib/sapor/regional_data/poland_with_ko_and_l_without_n_po_r_and_zl.rb +1 -1
  170. data/lib/sapor/regional_data/poland_with_ko_konf_kp_l_and_zp_without_k_k15_n_pis_po_psl_r_and_zl.rb +1 -1
  171. data/lib/sapor/regional_data/poland_with_ko_sld_and_wi_without_n_po_and_zl.rb +1 -1
  172. data/lib/sapor/regional_data/poland_with_sld_and_wi_without_zl.rb +1 -1
  173. data/lib/sapor/regional_data/poland_with_sld_without_zl.rb +1 -1
  174. data/lib/sapor/regional_data/portugal-20151004-with-a-and-ch-without-paf.psv +1 -1
  175. data/lib/sapor/regional_data/portugal-20151004-with-a-and-il-without-paf.psv +1 -1
  176. data/lib/sapor/regional_data/portugal-20151004-with-a-ch-and-il-without-paf.psv +1 -1
  177. data/lib/sapor/regional_data/portugal-20151004-with-a-without-paf.psv +1 -1
  178. data/lib/sapor/regional_data/portugal-20151004-with-ch-and-il-without-paf.psv +1 -1
  179. data/lib/sapor/regional_data/portugal-20151004-without-paf.psv +1 -1
  180. data/lib/sapor/regional_data/portugal-20151004.psv +1 -1
  181. data/lib/sapor/regional_data/portugal.rb +1 -1
  182. data/lib/sapor/regional_data/portugal_with_a_and_ch_without_paf.rb +1 -1
  183. data/lib/sapor/regional_data/portugal_with_a_and_il_without_paf.rb +1 -1
  184. data/lib/sapor/regional_data/portugal_with_a_ch_and_il_without_paf.rb +1 -1
  185. data/lib/sapor/regional_data/portugal_with_a_without_paf.rb +1 -1
  186. data/lib/sapor/regional_data/portugal_with_ch_and_il_without_paf.rb +1 -1
  187. data/lib/sapor/regional_data/portugal_without_paf.rb +1 -1
  188. data/lib/sapor/regional_data/slovakia.rb +1 -1
  189. data/lib/sapor/regional_data/slovenia.rb +1 -1
  190. data/lib/sapor/regional_data/spain-20160626.psv +1 -1
  191. data/lib/sapor/regional_data/spain.rb +1 -1
  192. data/lib/sapor/regional_data/sweden.rb +1 -1
  193. data/lib/sapor/regional_data/sweden_20140914.rb +1 -1
  194. data/lib/sapor/regional_data/united_kingdom-2015.psv +1 -1
  195. data/lib/sapor/regional_data/united_kingdom-20170608-brexit-chuk.psv +1 -1
  196. data/lib/sapor/regional_data/united_kingdom-20170608-brexit.psv +1 -1
  197. data/lib/sapor/regional_data/united_kingdom-20170608-tig.psv +1 -1
  198. data/lib/sapor/regional_data/united_kingdom-20170608.psv +1 -1
  199. data/lib/sapor/regional_data/united_kingdom.rb +1 -1
  200. data/lib/sapor/regional_data/united_kingdom_with_brexit.rb +1 -1
  201. data/lib/sapor/regional_data/united_kingdom_with_brexit_and_chuk.rb +1 -1
  202. data/lib/sapor/regional_data/united_kingdom_with_tig.rb +1 -1
  203. data/lib/sapor/regional_data/utopia.rb +1 -1
  204. data/lib/sapor/regional_data/wallonia-2014.psv +1 -1
  205. data/lib/sapor/regional_data/wallonia-20190526.psv +1 -1
  206. data/lib/sapor/regional_data/wallonia.rb +1 -1
  207. data/lib/sapor/representatives_polychotomy.rb +1 -1
  208. data/lib/sapor/single_district_proportional.rb +1 -1
  209. data/sapor.gemspec +2 -2
  210. data/spec/integration/area_spec.rb +1 -1
  211. data/spec/integration/poll_spec.rb +1 -1
  212. data/spec/spec_helper.rb +1 -1
  213. data/spec/unit/area_spec.rb +1 -1
  214. data/spec/unit/austria_spec.rb +1 -1
  215. data/spec/unit/belgium_brussels_spec.rb +1 -1
  216. data/spec/unit/belgium_flanders_spec.rb +1 -1
  217. data/spec/unit/belgium_spec.rb +1 -1
  218. data/spec/unit/belgium_wallonia_spec.rb +1 -1
  219. data/spec/unit/binomials_cache_spec.rb +1 -1
  220. data/spec/unit/catalonia_spec.rb +13 -26
  221. data/spec/unit/catalonia_with_vox_spec.rb +62 -0
  222. data/spec/unit/combinations_distribution_spec.rb +1 -1
  223. data/spec/unit/denmark_spec.rb +1 -1
  224. data/spec/unit/denmark_with_e_and_p_spec.rb +1 -1
  225. data/spec/unit/denmark_with_e_spec.rb +1 -1
  226. data/spec/unit/denmark_with_p_spec.rb +1 -1
  227. data/spec/unit/denominators_spec.rb +1 -1
  228. data/spec/unit/dichotomies_spec.rb +1 -1
  229. data/spec/unit/dichotomy_spec.rb +1 -1
  230. data/spec/unit/estonia_spec.rb +1 -1
  231. data/spec/unit/european_union_27_austria_spec.rb +1 -1
  232. data/spec/unit/european_union_27_croatia_spec.rb +1 -1
  233. data/spec/unit/european_union_27_denmark_spec.rb +1 -1
  234. data/spec/unit/european_union_27_estonia_spec.rb +1 -1
  235. data/spec/unit/european_union_27_finland_spec.rb +1 -1
  236. data/spec/unit/european_union_27_france_spec.rb +1 -1
  237. data/spec/unit/european_union_27_ireland_spec.rb +1 -1
  238. data/spec/unit/european_union_27_ireland_with_ia_spec.rb +1 -1
  239. data/spec/unit/european_union_27_italy_spec.rb +1 -1
  240. data/spec/unit/european_union_27_netherlands_spec.rb +1 -1
  241. data/spec/unit/european_union_27_poland_spec.rb +1 -1
  242. data/spec/unit/european_union_27_romania_spec.rb +1 -1
  243. data/spec/unit/european_union_27_slovakia_spec.rb +1 -1
  244. data/spec/unit/european_union_27_spain_spec.rb +1 -1
  245. data/spec/unit/european_union_27_sweden_spec.rb +1 -1
  246. data/spec/unit/european_union_austria_spec.rb +1 -1
  247. data/spec/unit/european_union_bulgaria_spec.rb +1 -1
  248. data/spec/unit/european_union_croatia_spec.rb +1 -1
  249. data/spec/unit/european_union_cyprus_spec.rb +1 -1
  250. data/spec/unit/european_union_czech_republic_spec.rb +1 -1
  251. data/spec/unit/european_union_denmark_spec.rb +1 -1
  252. data/spec/unit/european_union_estonia_spec.rb +1 -1
  253. data/spec/unit/european_union_finland_spec.rb +1 -1
  254. data/spec/unit/european_union_flanders_spec.rb +1 -1
  255. data/spec/unit/european_union_france_spec.rb +1 -1
  256. data/spec/unit/european_union_french_community_of_belgium_spec.rb +1 -1
  257. data/spec/unit/european_union_germany_spec.rb +1 -1
  258. data/spec/unit/european_union_great_britain_spec.rb +1 -1
  259. data/spec/unit/european_union_greece_spec.rb +1 -1
  260. data/spec/unit/european_union_hungary_spec.rb +1 -1
  261. data/spec/unit/european_union_ireland_spec.rb +1 -1
  262. data/spec/unit/european_union_ireland_with_ia_spec.rb +1 -1
  263. data/spec/unit/european_union_italy_spec.rb +1 -1
  264. data/spec/unit/european_union_latvia_spec.rb +1 -1
  265. data/spec/unit/european_union_lithuania_spec.rb +1 -1
  266. data/spec/unit/european_union_luxembourg_spec.rb +1 -1
  267. data/spec/unit/european_union_malta_spec.rb +1 -1
  268. data/spec/unit/european_union_netherlands_spec.rb +1 -1
  269. data/spec/unit/european_union_northern_ireland_spec.rb +1 -1
  270. data/spec/unit/european_union_poland_spec.rb +1 -1
  271. data/spec/unit/european_union_portugal_spec.rb +1 -1
  272. data/spec/unit/european_union_romania_spec.rb +1 -1
  273. data/spec/unit/european_union_slovakia_spec.rb +1 -1
  274. data/spec/unit/european_union_slovenia_spec.rb +1 -1
  275. data/spec/unit/european_union_spain_spec.rb +1 -1
  276. data/spec/unit/european_union_sweden_spec.rb +1 -1
  277. data/spec/unit/finland_spec.rb +1 -1
  278. data/spec/unit/finland_with_sin_spec.rb +1 -1
  279. data/spec/unit/first_past_the_post_spec.rb +1 -1
  280. data/spec/unit/flanders_spec.rb +1 -1
  281. data/spec/unit/france_spec.rb +1 -1
  282. data/spec/unit/greece_spec.rb +1 -1
  283. data/spec/unit/hungary_spec.rb +1 -1
  284. data/spec/unit/iceland_spec.rb +1 -1
  285. data/spec/unit/iceland_with_j_spec.rb +58 -0
  286. data/spec/unit/ireland_2016_spec.rb +62 -0
  287. data/spec/unit/ireland_spec.rb +62 -0
  288. data/spec/unit/largest_remainder_spec.rb +1 -1
  289. data/spec/unit/latvia_spec.rb +1 -1
  290. data/spec/unit/luxembourg_spec.rb +1 -1
  291. data/spec/unit/multi_district_leveled_proportional_spec.rb +1 -1
  292. data/spec/unit/multi_district_proportional_spec.rb +1 -1
  293. data/spec/unit/netherlands_spec.rb +1 -1
  294. data/spec/unit/norway_spec.rb +26 -21
  295. data/spec/unit/norwegian_municipality_spec.rb +1 -1
  296. data/spec/unit/number_formatter_spec.rb +1 -1
  297. data/spec/unit/poland_spec.rb +1 -1
  298. data/spec/unit/poland_with_ko_and_l_without_n_po_r_and_zl_spec.rb +1 -1
  299. data/spec/unit/poland_with_ko_konf_kp_l_and_zp_without_k_k15_n_pis_po_psl_r_and_zl_spec.rb +1 -1
  300. data/spec/unit/poland_with_ko_sld_and_wi_without_n_po_and_zl_spec.rb +1 -1
  301. data/spec/unit/poland_with_sld_and_wi_without_zl_spec.rb +1 -1
  302. data/spec/unit/poland_with_sld_without_zl_spec.rb +1 -1
  303. data/spec/unit/poll_spec.rb +1 -1
  304. data/spec/unit/portugal_spec.rb +1 -1
  305. data/spec/unit/portugal_with_a_and_ch_without_paf_spec.rb +1 -1
  306. data/spec/unit/portugal_with_a_and_il_without_paf_spec.rb +1 -1
  307. data/spec/unit/portugal_with_a_ch_and_il_without_paf_spec.rb +1 -1
  308. data/spec/unit/portugal_with_a_without_paf_spec.rb +1 -1
  309. data/spec/unit/portugal_with_ch_and_il_without_paf_spec.rb +1 -1
  310. data/spec/unit/portugal_without_paf_spec.rb +1 -1
  311. data/spec/unit/pseudorandom_multirange_enumerator_spec.rb +1 -1
  312. data/spec/unit/referendum_polychotomy_spec.rb +1 -1
  313. data/spec/unit/representatives_polychotomy_spec.rb +1 -1
  314. data/spec/unit/slovakia_spec.rb +1 -1
  315. data/spec/unit/slovenia_spec.rb +1 -1
  316. data/spec/unit/spain_spec.rb +1 -1
  317. data/spec/unit/sweden_20140914_spec.rb +1 -1
  318. data/spec/unit/sweden_spec.rb +1 -1
  319. data/spec/unit/united_kingdom_spec.rb +1 -1
  320. data/spec/unit/united_kingdom_with_brexit_and_chuk_spec.rb +1 -1
  321. data/spec/unit/united_kingdom_with_brexit_spec.rb +1 -1
  322. data/spec/unit/united_kingdom_with_tig_spec.rb +1 -1
  323. data/spec/unit/wallonia_spec.rb +1 -1
  324. metadata +23 -4
  325. data/lib/sapor/regional_data/catalonia-jxcat.rb +0 -109
  326. data/lib/sapor/regional_data/catalonia-no-jxsi.rb +0 -96
@@ -0,0 +1,61 @@
1
+ #
2
+ # Statistical Analysis of Polling Results (SAPoR)
3
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ #
5
+ # This file is part of SAPoR.
6
+ #
7
+ # SAPoR is free software: you can redistribute it and/or modify it under the
8
+ # terms of the GNU General Public License as published by the Free Software
9
+ # Foundation, either version 3 of the License, or (at your option) any later
10
+ # version.
11
+ #
12
+ # SAPoR is distributed in the hope that it will be useful, but WITHOUT ANY
13
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
+ # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15
+ #
16
+ # You can find a copy of the GNU General Public License in /doc/gpl.txt
17
+ #
18
+
19
+ SOURCE = '2020-01-01_partifordeling_1_st_2017.csv'.freeze
20
+ TARGET = '../../lib/sapor/regional_data/norway-20170911.psv'.freeze
21
+
22
+ parties = []
23
+ total_votes = 0
24
+ File.open(TARGET, 'w') do |output|
25
+ output.puts '# Statistical Analysis of Polling Results (SAPoR)'
26
+ output.puts '# Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>'
27
+ output.puts '#'
28
+ output.puts '# This file is part of SAPoR.'
29
+ output.puts '#'
30
+ output.puts '# SAPoR is free software: you can redistribute it and/or' \
31
+ ' modify it under the'
32
+ output.puts '# terms of the GNU General Public License as published by the' \
33
+ ' Free Software'
34
+ output.puts '# Foundation, either version 3 of the License, or (at your' \
35
+ ' option) any later'
36
+ output.puts '# version.'
37
+ output.puts '#'
38
+ output.puts '# SAPoR is distributed in the hope that it will be useful, but' \
39
+ ' WITHOUT ANY'
40
+ output.puts '# WARRANTY; without even the implied warranty of' \
41
+ ' MERCHANTABILITY or FITNESS FOR'
42
+ output.puts '# A PARTICULAR PURPOSE. See the GNU General Public License' \
43
+ ' for more details.'
44
+ output.puts '#'
45
+ output.puts '# You can find a copy of the GNU General Public License in' \
46
+ ' /doc/gpl.txt'
47
+ output.puts '#'
48
+ File.open(SOURCE).each do |line|
49
+ next if line.start_with?('Fylkenummer')
50
+ elements = line.chomp.split(';')
51
+ constituency = elements[1]
52
+ party = elements[7]
53
+ next if party == 'Blanke'
54
+ parties << party unless parties.include?(party)
55
+ votes = elements[12].to_i
56
+ total_votes += votes
57
+ output.puts "#{constituency} | #{party} | #{votes}"
58
+ end
59
+ end
60
+ puts 'Parties: ' + parties.sort.join(', ')
61
+ puts "Total votes: #{total_votes}"
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
5
  #
6
6
  # This file is part of SAPoR.
7
7
  #
@@ -39,7 +39,7 @@ PARTIES = ['Prawo i Sprawiedliwość',
39
39
 
40
40
  File.open(TARGET, 'w') do |output|
41
41
  output.puts '# Statistical Analysis of Polling Results (SAPoR)'
42
- output.puts '# Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>'
42
+ output.puts '# Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>'
43
43
  output.puts '#'
44
44
  output.puts '# This file is part of SAPoR.'
45
45
  output.puts '#'
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
5
  #
6
6
  # This file is part of SAPoR.
7
7
  #
@@ -44,7 +44,7 @@ PARTIES = ['Prawo i Sprawiedliwość',
44
44
 
45
45
  File.open(TARGET, 'w') do |output|
46
46
  output.puts '# Statistical Analysis of Polling Results (SAPoR)'
47
- output.puts '# Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>'
47
+ output.puts '# Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>'
48
48
  output.puts '#'
49
49
  output.puts '# This file is part of SAPoR.'
50
50
  output.puts '#'
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
5
  #
6
6
  # This file is part of SAPoR.
7
7
  #
@@ -46,7 +46,7 @@ PARTIES = ['Zjednoczona Prawica',
46
46
 
47
47
  File.open(TARGET, 'w') do |output|
48
48
  output.puts '# Statistical Analysis of Polling Results (SAPoR)'
49
- output.puts '# Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>'
49
+ output.puts '# Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>'
50
50
  output.puts '#'
51
51
  output.puts '# This file is part of SAPoR.'
52
52
  output.puts '#'
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
5
  #
6
6
  # This file is part of SAPoR.
7
7
  #
@@ -43,7 +43,7 @@ PARTIES = ['Prawo i Sprawiedliwość',
43
43
 
44
44
  File.open(TARGET, 'w') do |output|
45
45
  output.puts '# Statistical Analysis of Polling Results (SAPoR)'
46
- output.puts '# Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>'
46
+ output.puts '# Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>'
47
47
  output.puts '#'
48
48
  output.puts '# This file is part of SAPoR.'
49
49
  output.puts '#'
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
5
  #
6
6
  # This file is part of SAPoR.
7
7
  #
@@ -40,7 +40,7 @@ PARTIES = ['Prawo i Sprawiedliwość',
40
40
 
41
41
  File.open(TARGET, 'w') do |output|
42
42
  output.puts '# Statistical Analysis of Polling Results (SAPoR)'
43
- output.puts '# Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>'
43
+ output.puts '# Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>'
44
44
  output.puts '#'
45
45
  output.puts '# This file is part of SAPoR.'
46
46
  output.puts '#'
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
5
  #
6
6
  # This file is part of SAPoR.
7
7
  #
@@ -40,7 +40,7 @@ PARTIES = ['Prawo i Sprawiedliwość',
40
40
 
41
41
  File.open(TARGET, 'w') do |output|
42
42
  output.puts '# Statistical Analysis of Polling Results (SAPoR)'
43
- output.puts '# Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>'
43
+ output.puts '# Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>'
44
44
  output.puts '#'
45
45
  output.puts '# This file is part of SAPoR.'
46
46
  output.puts '#'
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
5
  #
6
6
  # This file is part of SAPoR.
7
7
  #
@@ -22,7 +22,7 @@ TARGET = '../lib/sapor/regional_data/united_kingdom-2015.psv'.freeze
22
22
 
23
23
  File.open(TARGET, 'w') do |output|
24
24
  output.puts '# Statistical Analysis of Polling Results (SAPoR)'
25
- output.puts '# Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>'
25
+ output.puts '# Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>'
26
26
  output.puts '#'
27
27
  output.puts '# This file is part of SAPoR.'
28
28
  output.puts '#'
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
5
  #
6
6
  # This file is part of SAPoR.
7
7
  #
@@ -22,7 +22,7 @@ TARGET = '../../lib/sapor/regional_data/united_kingdom-20170608.psv'.freeze
22
22
 
23
23
  File.open(TARGET, 'w') do |output|
24
24
  output.puts '# Statistical Analysis of Polling Results (SAPoR)'
25
- output.puts '# Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>'
25
+ output.puts '# Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>'
26
26
  output.puts '#'
27
27
  output.puts '# This file is part of SAPoR.'
28
28
  output.puts '#'
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
5
  #
6
6
  # This file is part of SAPoR.
7
7
  #
@@ -22,7 +22,7 @@ TARGET = '../../lib/sapor/regional_data/united_kingdom-20170608-brexit-chuk.psv'
22
22
 
23
23
  File.open(TARGET, 'w') do |output|
24
24
  output.puts '# Statistical Analysis of Polling Results (SAPoR)'
25
- output.puts '# Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>'
25
+ output.puts '# Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>'
26
26
  output.puts '#'
27
27
  output.puts '# This file is part of SAPoR.'
28
28
  output.puts '#'
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
5
  #
6
6
  # This file is part of SAPoR.
7
7
  #
@@ -22,7 +22,7 @@ TARGET = '../../lib/sapor/regional_data/united_kingdom-20170608-tig.psv'.freeze
22
22
 
23
23
  File.open(TARGET, 'w') do |output|
24
24
  output.puts '# Statistical Analysis of Polling Results (SAPoR)'
25
- output.puts '# Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>'
25
+ output.puts '# Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>'
26
26
  output.puts '#'
27
27
  output.puts '# This file is part of SAPoR.'
28
28
  output.puts '#'
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Statistical Analysis of Polling Results (SAPoR)
3
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
3
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
4
  #
5
5
  # This file is part of SAPoR.
6
6
  #
@@ -42,6 +42,7 @@ require 'sapor/polychotomy'
42
42
  require 'sapor/referendum_polychotomy'
43
43
  require 'sapor/representatives_polychotomy'
44
44
  require 'sapor/first_past_the_post'
45
+ require 'sapor/many_past_the_post'
45
46
  require 'sapor/largest_remainder'
46
47
  require 'sapor/denominators'
47
48
  require 'sapor/single_district_proportional'
@@ -55,8 +56,6 @@ require 'sapor/regional_data/belgium_brussels'
55
56
  require 'sapor/regional_data/belgium_flanders'
56
57
  require 'sapor/regional_data/belgium_wallonia'
57
58
  require 'sapor/regional_data/catalonia'
58
- require 'sapor/regional_data/catalonia-no-jxsi'
59
- require 'sapor/regional_data/catalonia-jxcat'
60
59
  require 'sapor/regional_data/denmark'
61
60
  require 'sapor/regional_data/denmark_with_e'
62
61
  require 'sapor/regional_data/denmark_with_e_and_p'
@@ -115,6 +114,7 @@ require 'sapor/regional_data/france'
115
114
  require 'sapor/regional_data/greece'
116
115
  require 'sapor/regional_data/hungary'
117
116
  require 'sapor/regional_data/iceland'
117
+ require 'sapor/regional_data/ireland'
118
118
  require 'sapor/regional_data/latvia'
119
119
  require 'sapor/regional_data/luxembourg'
120
120
  require 'sapor/regional_data/netherlands'
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
5
  #
6
6
  # This file is part of SAPoR.
7
7
  #
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
5
  #
6
6
  # This file is part of SAPoR.
7
7
  #
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Statistical Analysis of Polling Results (SAPoR)
3
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
3
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
4
  #
5
5
  # This file is part of SAPoR.
6
6
  #
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
5
  #
6
6
  # This file is part of SAPoR.
7
7
  #
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
5
  #
6
6
  # This file is part of SAPoR.
7
7
  #
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
5
  #
6
6
  # This file is part of SAPoR.
7
7
  #
@@ -1,5 +1,5 @@
1
1
  # Statistical Analysis of Polling Results (SAPoR)
2
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
2
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
3
3
  #
4
4
  # This file is part of SAPoR.
5
5
  #
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
5
  #
6
6
  # This file is part of SAPoR.
7
7
  #
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
5
  #
6
6
  # This file is part of SAPoR.
7
7
  #
@@ -0,0 +1,113 @@
1
+ #
2
+ # Statistical Analysis of Polling Results (SAPoR)
3
+ # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
4
+ #
5
+ # This file is part of SAPoR.
6
+ #
7
+ # SAPoR is free software: you can redistribute it and/or modify it under the
8
+ # terms of the GNU General Public License as published by the Free Software
9
+ # Foundation, either version 3 of the License, or (at your option) any later
10
+ # version.
11
+ #
12
+ # SAPoR is distributed in the hope that it will be useful, but WITHOUT ANY
13
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
+ # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15
+ #
16
+ # You can find a copy of the GNU General Public License in /doc/gpl.txt
17
+ #
18
+
19
+ module Sapor
20
+ #
21
+ # Class representing an electoral system with more than one
22
+ # district where parties only have a limited number of candidates in each of
23
+ # the constituencies.
24
+ #
25
+ class ManyPastThePost
26
+ def initialize(last_election_result, last_detailed_election_result,
27
+ seat_distribution, caps = {}, weights = {})
28
+ @last_election_result = last_election_result
29
+ @last_detailed_election_result = last_detailed_election_result
30
+ @seat_distribution = seat_distribution
31
+ @caps = caps
32
+ @weights = weights
33
+ end
34
+
35
+ def project(simulation)
36
+ multiplicators = calculate_multiplicators(simulation)
37
+ result = create_empty_result(simulation)
38
+ @last_detailed_election_result.each_pair do |name, local_last_result|
39
+ no_of_seats = @seat_distribution[name]
40
+ caps = @caps.empty? ? {} : @caps[name]
41
+ seats = local_seats(no_of_seats, local_last_result, multiplicators,
42
+ caps, @weights)
43
+ add_seats_to_result(result, seats)
44
+ end
45
+ result
46
+ end
47
+
48
+ private
49
+
50
+ def add_seats_to_result(result, seats)
51
+ seats.each do |seat|
52
+ if result.key?(seat)
53
+ result[seat] += 1
54
+ else
55
+ result[seat] = 1
56
+ end
57
+ end
58
+ end
59
+
60
+ def calculate_multiplicators(simulation)
61
+ simulation_sum = simulation.values.inject(:+)
62
+ last_election_sum = @last_election_result.values.inject(:+)
63
+ multiplicators = {}
64
+ simulation.each_key do |choice|
65
+ new_fraction = simulation[choice].to_f / simulation_sum
66
+ last_fraction = @last_election_result[choice].to_f / last_election_sum
67
+ multiplicators[choice] = new_fraction / last_fraction
68
+ end
69
+ multiplicators
70
+ end
71
+
72
+ def create_empty_result(simulation)
73
+ result = {}
74
+ simulation.each_key do |choice|
75
+ result[choice] = 0
76
+ end
77
+ result[OTHER] = 0
78
+ result
79
+ end
80
+
81
+ def local_votes(local_last_result, multiplicators)
82
+ local_votes = {}
83
+ local_last_result.each_pair do |choice, votes|
84
+ local_votes[choice] = if multiplicators.key?(choice)
85
+ votes * multiplicators[choice]
86
+ else
87
+ votes
88
+ end
89
+ end
90
+ local_votes
91
+ end
92
+
93
+ def local_quotients(local_votes, no_of_seats, caps, weights)
94
+ local_quotients = []
95
+ local_votes.each_pair do |choice, new_value|
96
+ actual_no_of_seats = caps.empty? ? no_of_seats : [caps[choice], no_of_seats].min
97
+ actual_weights = weights[actual_no_of_seats - 1]
98
+ actual_weights.each do |w|
99
+ local_quotients << [choice, new_value.to_f * w]
100
+ end
101
+ end
102
+ local_quotients
103
+ end
104
+
105
+ def local_seats(no_of_seats, local_last_result, multiplicators, caps,
106
+ weights)
107
+ local_votes = local_votes(local_last_result, multiplicators)
108
+ local_quotients = local_quotients(local_votes, no_of_seats, caps, weights)
109
+ sorted_quotients = local_quotients.sort { |a, b| b.last <=> a.last }
110
+ sorted_quotients.map(&:first).slice(0, no_of_seats)
111
+ end
112
+ end
113
+ end