memopol merge requestshttps://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests2016-10-03T17:36:10+02:00https://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/54Display votes with recommendation only2016-10-03T17:36:10+02:00okhinokhin@laquadrature.netDisplay votes with recommendation only*Created by: jpic*
Fixes display bug ie.
http://lqdn-memopol.rhcloud.com/legislature/representative/yannick-jadot/*Created by: jpic*
Fixes display bug ie.
http://lqdn-memopol.rhcloud.com/legislature/representative/yannick-jadot/https://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/55Fixed url conflicts2016-10-03T17:36:13+02:00okhinokhin@laquadrature.netFixed url conflicts*Created by: jpic*
*Created by: jpic*
https://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/56WIP - Admin: Optimization and UX with Campaigns2016-10-03T17:36:15+02:00okhinokhin@laquadrature.netWIP - Admin: Optimization and UX with Campaigns*Created by: jpic*
The purpose of this PR is to enable more real-time-ish user experience for the
administrator:
- [ ] Optimization: Sync only dossiers which the admins are interrested in,
- [ ] UX: Sync Dossiers in real-time, when...*Created by: jpic*
The purpose of this PR is to enable more real-time-ish user experience for the
administrator:
- [ ] Optimization: Sync only dossiers which the admins are interrested in,
- [ ] UX: Sync Dossiers in real-time, when the admin changes Dossiers they are
interested in
- [ ] UX: Email admins when a new Proposal was synchronized on a Dossier they
follow
- [ ] UX: Show a list of Proposals which require the admin to set a
Recommendation for
To achieve this, a Campaign model was added, with an n:m relation to Dossier.
The admin manages the Dossiers it is interrested in by managing Campaign
objects.https://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/60Clear ContentType table before loading fixtures2016-10-03T17:36:18+02:00okhinokhin@laquadrature.netClear ContentType table before loading fixtures*Created by: jpic*
Something has changed in the last two months, when this test used to
pass:
https://travis-ci.org/political-memory/political_memory/builds/108147420
Exception this patch fixes::
=================================...*Created by: jpic*
Something has changed in the last two months, when this test used to
pass:
https://travis-ci.org/political-memory/political_memory/builds/108147420
Exception this patch fixes::
======================================================================
ERROR: setUpClass (representatives_positions.tests.test_functional.PositionTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jpic/work/lqdn/lqdn_env/lib/python2.7/site-packages/django/test/testcases.py", line 956, in setUpClass
'database': db_name,
File "/home/jpic/work/lqdn/lqdn_env/lib/python2.7/site-packages/django/core/management/__init__.py", line 120, in call_command
return command.execute(*args, **defaults)
File "/home/jpic/work/lqdn/lqdn_env/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
output = self.handle(*args, **options)
File "/home/jpic/work/lqdn/lqdn_env/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 60, in handle
self.loaddata(fixture_labels)
File "/home/jpic/work/lqdn/lqdn_env/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 100, in loaddata
self.load_label(fixture_label)
File "/home/jpic/work/lqdn/lqdn_env/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 157, in load_label
obj.save(using=self.using)
File "/home/jpic/work/lqdn/lqdn_env/lib/python2.7/site-packages/django/core/serializers/base.py", line 173, in save
models.Model.save_base(self.object, using=using, raw=True)
File "/home/jpic/work/lqdn/lqdn_env/lib/python2.7/site-packages/django/db/models/base.py", line 762, in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/home/jpic/work/lqdn/lqdn_env/lib/python2.7/site-packages/django/db/models/base.py", line 827, in _save_table
forced_update)
File "/home/jpic/work/lqdn/lqdn_env/lib/python2.7/site-packages/django/db/models/base.py", line 877, in _do_update
return filtered._update(values) > 0
File "/home/jpic/work/lqdn/lqdn_env/lib/python2.7/site-packages/django/db/models/query.py", line 580, in _update
return query.get_compiler(self.db).execute_sql(CURSOR)
File "/home/jpic/work/lqdn/lqdn_env/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 1062, in execute_sql
cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
File "/home/jpic/work/lqdn/lqdn_env/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 840, in execute_sql
cursor.execute(sql, params)
File "/home/jpic/work/lqdn/lqdn_env/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/jpic/work/lqdn/lqdn_env/lib/python2.7/site-packages/django/db/utils.py", line 98, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/jpic/work/lqdn/lqdn_env/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/jpic/work/lqdn/lqdn_env/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 318, in execute
return Database.Cursor.execute(self, query, params)
IntegrityError: Problem installing fixture '/home/jpic/work/lqdn/political_memory/memopol/fixtures/one_representative.json': Could not load contenttypes.ContentType(pk=25): UNIQUE constraint failed: django_content_type.app_label, django_content_type.modelhttps://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/61Fix tests on master2016-10-03T17:36:20+02:00okhinokhin@laquadrature.netFix tests on master*Created by: jpic*
Otherwise tests might become broken as a side effect of an upgrade in
these packages. And that's hard to figure out ;)*Created by: jpic*
Otherwise tests might become broken as a side effect of an upgrade in
these packages. And that's hard to figure out ;)https://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/64Add scores, scoredvotes, recommendations to api2016-10-03T17:36:23+02:00njoyardAdd scores, scoredvotes, recommendations to api*Created by: njoyard*
This PR adds memopol entries to the REST api:
- recommendations
- representative scores
- scored votes (ie. votes with their contribution to the rep score)
- score contribution by dossier (via a new DossierScor...*Created by: njoyard*
This PR adds memopol entries to the REST api:
- recommendations
- representative scores
- scored votes (ie. votes with their contribution to the rep score)
- score contribution by dossier (via a new DossierScore model that maps to a DB view, because django querysets do not seem to enable aggregating over annotated fields)
https://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/75Enhance footer links2016-10-03T17:36:31+02:00okhinokhin@laquadrature.netEnhance footer links*Created by: djangocreation*
In response to issue #71
*Created by: djangocreation*
In response to issue #71
https://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/77Enhance dossiers views, fixes #702016-10-03T17:36:33+02:00njoyardEnhance dossiers views, fixes #70*Created by: njoyard*
Dossier list:
![dossier list](https://framapic.org/OChfK78WhmMT/LlSAnZN22HMS.png)
Dossier details:
![dossier details](https://framapic.org/mnQvP6zBKkBd/kSEAX5pb2QcF.png)*Created by: njoyard*
Dossier list:
![dossier list](https://framapic.org/OChfK78WhmMT/LlSAnZN22HMS.png)
Dossier details:
![dossier details](https://framapic.org/mnQvP6zBKkBd/kSEAX5pb2QcF.png)https://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/78Rewrite score computing, fixes #692016-10-03T17:36:36+02:00njoyardRewrite score computing, fixes #69*Created by: njoyard*
This PR removes static, asynchronous representative score updates by replacing plain models with views in the `representatives_recommendations` app:
* `votescores` computes the score consequence of each vote on ...*Created by: njoyard*
This PR removes static, asynchronous representative score updates by replacing plain models with views in the `representatives_recommendations` app:
* `votescores` computes the score consequence of each vote on the representative score ; it is mapped to the new VoteScore model that replaces ScoredVote (which extended Vote and computed scores in python).
* `dossierscores` was introduced in a previous changeset but was rewritten to use `votescores`; it aggregates votes over proposals from a single dossier and returns the score contribution of each dossier on representatives scores. It is mapped to the DossierScore model.
* `representativescore` aggregates scores from the `dossierscores` view over all dossiers for each representative and gives a direct queryable access to the score of each representative. It is mapped to the RepresentativeScore model.
This PR also removes score update facilities as they now don't have any use.
TL;DR: no more manual score updates, scores are computed on the fly.https://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/80[WIP] Add import scripts for old data, fixes #582016-10-03T17:36:39+02:00njoyard[WIP] Add import scripts for old data, fixes #58*Created by: njoyard*
This PR adds two import scripts for old memopol data.
Links to exported data:
* [recommendations.csv](https://framabin.org/?ad32ff1675bd62b5#74mkMfNTLRNT4f4tGkJpgxUmRe02Zgp5ImosoBrSAvg=)
* [positions.csv](http...*Created by: njoyard*
This PR adds two import scripts for old memopol data.
Links to exported data:
* [recommendations.csv](https://framabin.org/?ad32ff1675bd62b5#74mkMfNTLRNT4f4tGkJpgxUmRe02Zgp5ImosoBrSAvg=)
* [positions.csv](https://framabin.org/?089bceff87c480cc#EfiUTwUi/Umz6JuqGaPOhwTKpHesnqVdQ8u2CsUVcs0=)
#### Recommendations
Export old recommendation data to a `|`-separated CSV file with the following query:
```sql
SELECT CONCAT(r.description, '|', r.weight, '|', r.recommendation, '|',
r.part, '|', p.title, '|', p.ponderation)
FROM votes_recommendation r
LEFT JOIN votes_proposal p ON r.proposal_id = p.id
WHERE p.institution = 'EU'
```
Then run the import script using :
```sh
cat recommendations.csv | memopol_import_recommendations
```
#### Positions
Export old position data to a `|`-separated CSV file with the following query:
```sql
SELECT CONCAT(o.content, '|', o.url, '|', o.title, '|', ro.date, '|',
r.first_name, '|', r.last_name)
FROM reps_opinion o
INNER JOIN reps_opinionrep ro ON ro.opinion_id = o.id
INNER JOIN reps_representative r ON r.id = ro.representative_id
WHERE o.institution='EU'
```
Then run the import script using :
```sh
cat positions.csv | memopol_import_positions
```https://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/82Add group icons2016-10-03T17:36:41+02:00njoyardAdd group icons*Created by: njoyard*
Previews :
![1](https://framapic.org/b2EEtbt3NuSB/1veWYO55pRbX.png)
![2](https://framapic.org/cmkoxbmebjH1/mmMsj7r9fW8L.png)
![3](https://framapic.org/DU7yaeWtuugm/UMoMhDZjpJcI.png)
We should also add frenc...*Created by: njoyard*
Previews :
![1](https://framapic.org/b2EEtbt3NuSB/1veWYO55pRbX.png)
![2](https://framapic.org/cmkoxbmebjH1/mmMsj7r9fW8L.png)
![3](https://framapic.org/DU7yaeWtuugm/UMoMhDZjpJcI.png)
We should also add french groups when applicablehttps://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/83Enhance representative details, fixes #742016-10-03T17:36:44+02:00njoyardEnhance representative details, fixes #74*Created by: njoyard*
This PR adds contact information on the representative page:
- social network and websites
- email addresses, phone number and postal addresses
![preview](https://framapic.org/4lFSBXV00nSt/9VLkllVvPkmq.png)*Created by: njoyard*
This PR adds contact information on the representative page:
- social network and websites
- email addresses, phone number and postal addresses
![preview](https://framapic.org/4lFSBXV00nSt/9VLkllVvPkmq.png)https://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/84Add import scripts for old data, fixes #582016-10-03T17:36:47+02:00njoyardAdd import scripts for old data, fixes #58*Created by: njoyard*
This PR adds two import scripts for old memopol data.
Links to exported data:
* [recommendations.csv](https://framabin.org/?ad32ff1675bd62b5#74mkMfNTLRNT4f4tGkJpgxUmRe02Zgp5ImosoBrSAvg=)
* [positions.csv](http...*Created by: njoyard*
This PR adds two import scripts for old memopol data.
Links to exported data:
* [recommendations.csv](https://framabin.org/?ad32ff1675bd62b5#74mkMfNTLRNT4f4tGkJpgxUmRe02Zgp5ImosoBrSAvg=)
* [positions.csv](https://framabin.org/?089bceff87c480cc#EfiUTwUi/Umz6JuqGaPOhwTKpHesnqVdQ8u2CsUVcs0=)
#### Recommendations
Export old recommendation data to a `|`-separated CSV file with the following query:
```sql
SELECT CONCAT(r.description, '|', r.weight, '|', r.recommendation, '|',
r.part, '|', p.title, '|', p.ponderation)
FROM votes_recommendation r
LEFT JOIN votes_proposal p ON r.proposal_id = p.id
WHERE p.institution = 'EU'
```
Then run the import script using :
```sh
cat recommendations.csv | memopol_import_recommendations
```
#### Positions
Export old position data to a `|`-separated CSV file with the following query:
```sql
SELECT CONCAT(o.content, '|', o.url, '|', o.title, '|', ro.date, '|',
r.first_name, '|', r.last_name)
FROM reps_opinion o
INNER JOIN reps_opinionrep ro ON ro.opinion_id = o.id
INNER JOIN reps_representative r ON r.id = ro.representative_id
WHERE o.institution='EU'
```
Then run the import script using :
```sh
cat positions.csv | memopol_import_positions
```https://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/85Integrate views removed from d-r[-v]2016-10-03T17:36:51+02:00njoyardIntegrate views removed from d-r[-v]*Created by: njoyard*
A quick summary of the changes made:
- Gave names to API views because their default names conflicted with other view names
- Added tags to make group/chamber/country URLs (1)
- Moved views each to its own file ...*Created by: njoyard*
A quick summary of the changes made:
- Gave names to API views because their default names conflicted with other view names
- Added tags to make group/chamber/country URLs (1)
- Moved views each to its own file and integrated views removed from d-r[-v]
- Integrated URLs removed from d-r[-v]
- Made URLs more homogenous ~~(allow singular & plural ; all URLs default to singular)~~ : moved /groups/ to /group/ and added 301 redirect from old to new
(1) I prefer using tags instead of using get_absolute_url. As models are defined in a dependency, they cannot "know" what the user application wants to use as the "canonical model url" (for example for groups it may be rep list filtered by this group, or a detail page for the group, or whatever). I could have made inherited models in memopol just to override get_absolute_url, but then making sure foreign keys use overriden models is not made easy AT ALL by django. It's possible, but the code is horrible.https://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/86Move from LESS to SCSS2016-10-03T17:36:53+02:00njoyardMove from LESS to SCSS*Created by: njoyard*
`lesscpy` is not fully LESS-compliant. Instead `django-libsass` relies on `libsass`, which is a fully compliant C/C++ implementation of SASS/SCSS.
The reason for that change: I came across a lesscpy bug while ad...*Created by: njoyard*
`lesscpy` is not fully LESS-compliant. Instead `django-libsass` relies on `libsass`, which is a fully compliant C/C++ implementation of SASS/SCSS.
The reason for that change: I came across a lesscpy bug while adding new style to inactive meps, tried to fix it in lesscpy but seeing how poorly written it was made me change my mind - there is no other less implementation that does not require nodejs (actually there is one, but it is even less compliant).https://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/87Remove versioned database and add quickstart script instead2016-10-03T17:36:55+02:00njoyardRemove versioned database and add quickstart script instead*Created by: njoyard*
Everything is in the title :)*Created by: njoyard*
Everything is in the title :)https://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/88Allow former meps2016-10-03T17:36:58+02:00njoyardAllow former meps*Created by: njoyard*
This PR enables importing and using inactive MEPs in memopol. Inactive MEPs are shown in grayscale and listing pages have an toggle between showing active MEPs only (default) or all MEPs.
![example](https://fram...*Created by: njoyard*
This PR enables importing and using inactive MEPs in memopol. Inactive MEPs are shown in grayscale and listing pages have an toggle between showing active MEPs only (default) or all MEPs.
![example](https://framapic.org/3rQyc0QeDLXc/WVbq1FMNColc.png)
It also enables pagination on group lists, as well as active vs all filtering.https://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/89[Abandoned] Enhance pager2016-10-03T17:37:01+02:00njoyard[Abandoned] Enhance pager*Created by: njoyard*
**Abandoned. PR kept for future reference**
Change pager icons and tooltips to be more descriptive ; add "go to page" feature*Created by: njoyard*
**Abandoned. PR kept for future reference**
Change pager icons and tooltips to be more descriptive ; add "go to page" featurehttps://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/90Add country flags (and import template tags)2016-10-03T17:37:03+02:00njoyardAdd country flags (and import template tags)*Created by: njoyard*
This PR adds country flags to the Countries page.
It also imports template tags from django-representatives[-votes] so that they can be removed from there later.*Created by: njoyard*
This PR adds country flags to the Countries page.
It also imports template tags from django-representatives[-votes] so that they can be removed from there later.https://git.laquadrature.net/la-quadrature-du-net/memopol/memopol/-/merge_requests/92Add filters for representatives2016-10-03T17:37:10+02:00njoyardAdd filters for representatives*Created by: njoyard*
This PR adds a filter form that uses django-filters on the representative list with the following criteria:
* *search*: identical to the previously existing search box, searches representatives by name
* *chamber...*Created by: njoyard*
This PR adds a filter form that uses django-filters on the representative list with the following criteria:
* *search*: identical to the previously existing search box, searches representatives by name
* *chamber*: static drop down list to filter by chamber
* *country*: static drop down list to filter by country
* *group*: autocompleted drop down to filter by all kinds of groups (except chamber and country) : party, committee, delegation, ...
The group URLs (like `/legislature/representatives/committee/European Parliament/Committee on Defense whatever`) are now 301-redirected to an URL with querystring parameters in order to pre-fill the filter form.
TODO:
* [x] fix select2 style to match the rest of the form
* [x] ensure the filter form always submits to the root representative list url instead of the current page url (not really needed but just in case)
* [x] ~~add a checkbox to choose active/inactive meps~~ *postponed until we have an easy way to turn options/selects into a nice bootstrap button group*
* [x] add something more obvious when there are no results
* [x] ~~add a media block to the root template to allow page templates to add to it~~ *not needed, we have a head block already*
* [x] ~~change the way groups are displayed in the ac (add abbreviation, make group type more obvious)~~ *doesn't seem possible currently with select2*
* [x] add filter tests
* [x] check duplicate meps issue again
* [x] fix missing querystring in page links
Preview:
![preview](https://framapic.org/gierm9d1M2ym/dqpVBqKOA2Ud.png)