Commit Graph

65 Commits

Author SHA1 Message Date
Javi Martín
5b6de96241 Add and apply MultilineMethodCallIndentation rule 2023-08-18 14:56:16 +02:00
Javi Martín
b98244afd9 Remove votes query optimizations
Just like we did in commit 0214184b2d for investments, we're removing
some possible optimizations (we don't have any benchmarks proving they
affect performance at all) in order to simplify the code.

The investement votes component `delegate` code was accidentally left
but isn't used since commit 0214184b2, so we're removing it now that
we're removing the `voted_for?` helper method.
2022-02-21 18:47:13 +01:00
Javi Martín
0be6eb9512 Add and apply Style/RedundantParentheses rule
Parentheses make the code harder to read in these cases.
2021-09-03 11:49:52 +02:00
Javi Martín
45517f659e Add SDG goals/targets to legislation proposals 2021-02-24 20:42:53 +01:00
Javi Martín
b2b64ca8a0 Add link to download summary in XLSX format again
It was removed in commit 128a8164 alongside everything related to the
legislation process summary.

Co-Authored-By: taitus <sebastia.roig@gmail.com>
2020-09-08 13:32:08 +02:00
Javi Martín
14df74fed7 Add collaborative legislation summary again
It was removed in commit 128a8164 because we hadn't reviewed it nor
tested it properly. We're now adding it again, fixing the issues we've
found while reviewing.
2020-09-08 13:32:08 +02:00
Javi Martín
128a816464 Remove collaborative legislation summary
This feature wasn't properly tested nor reviewed, and after reviewing
several pull requests with a similar status and considering this pull
request is related to the public area of the web, we've decided to
remove it before releasing version 1.1.

This commit reverts commit 4f50e67a.
2019-11-06 17:21:03 +01:00
Javi Martín
82b0a6a92d Remove new CSV report generation
The new CSV report was more configurable and could work on proposals,
processes and comments. However, it had several issues.

In the public area, by default it generated a blank file.

In the admin section, the report was hard to configure and it generated
a file with less quality than the old system.

So until we improve this system, we're bringing back the old investment
CSV exporter.

This commit reverts most of commit 9d1ca3bf.
2019-11-06 00:04:02 +01:00
Javi Martín
d0d681a44b Add and apply EmptyLineAfterGuardClause rule
We were inconsistent on this one. I consider it particularly useful when
a method starts with a `return` statement.

In other cases, we probably shouldn't have a guard rule in the middle of
a method in any case, but that's a different refactoring.
2019-10-24 17:56:03 +02:00
Javi Martín
1004ac01f8 Add and apply Style/SafeNavigation rubocop rule
We were already using it most of the time, but not always.
2019-10-22 17:37:51 +02:00
Javi Martín
70a07c095f Add and apply Style/BlockDelimiters rubocop rule
We were already using it most of the time, but there were a few places
were we used brackets for multiline blocks.
2019-10-05 14:44:14 +02:00
Javi Martín
f9ed186909 Add rubocop spacing rules
We were following these rules in most places; we just didn't define them
anywhere.
2019-09-10 21:04:56 +02:00
Javi Martín
488461b8ac Remove consecutive blank lines 2019-09-10 20:02:15 +02:00
Javi Martín
a21240b230 Use Date.current and Time.current
Using Date.today and Time.now might lead to inconsistencies if the time
zone the application uses is not the same as the system time zone.
2019-08-28 20:32:40 +02:00
Raimond Garcia
259e05c3e0 Merge pull request #3410 from LextrendIT/report_generation
Report generation, download CSV
2019-06-12 11:45:59 +02:00
German Galia
9d1ca3bfd4 Report generation. Download csv 2019-06-12 10:17:31 +02:00
German Galia
4f50e67ac3 Collaborative legislation summary 2019-06-03 12:34:25 +02:00
Julian Herrero
d24376f6ad Use double quotes in controllers/ 2019-03-13 22:19:49 +01:00
Javi Martín
6682121069 Reuse code to set and order by a random seed 2019-02-20 12:10:12 +01:00
Javi Martín
e3ca700e17 Add concerns to set and order by a random seed 2019-02-20 11:51:32 +01:00
Javi Martín
660c59016b Fix random proposals order in the same session
Using `setseed` and ordering by `RAND()` doesn't always return the same
results because, although the generated random numbers will always be
the same, PostgreSQL doesn't guarantee the order of the rows it will
apply those random numbers to, similar to the way it doesn't guarantee
an order when the `ORDER BY` clause isn't specified.

Using something like `reorder("legislation_proposals.id % #{seed}")`,
like we do in budget investments, is certainly more elegant but it makes
the test checking two users get different results fail sometimes, so
that approach might need some adjustments in order to make the results
more random.
2019-02-20 11:51:32 +01:00
decabeza
060a4c684f Remove legislation processes next filter 2019-02-08 14:29:43 +01:00
Julian Herrero
33d6f6c18d Sort Legislation Processes by descending start date 2019-01-22 18:51:22 +01:00
dperez
bef404c443 add homepage for legislation processes 2018-12-15 18:04:24 +01:00
decabeza
df221b43a0 Fixes hound warnings on legislation processes 2018-12-12 18:23:11 +01:00
Javi Martín
b95ca9df8a Add milestones to legislation process view 2018-12-11 20:18:53 +01:00
Javi Martín
1b46ba9ee6 Make legislation proposals random seed more robust
Using a number with only two decimals means the seed is going to be the
same 1% of the time. Using ruby's default value for random numbers makes
it almost impossible to generate the same seed twice.

Using `rand` also simplifies the code, and it's what we use in the
budget investments controller.
2018-12-05 13:03:10 +01:00
Javi Martín
07c22d289c Change the random seed before storing it
Even though it probably doesn't change the behaviour, it's a bit strange
to set a seed, then storing it in the session, and then modifying it
again.
2018-12-05 13:03:10 +01:00
Javi Martín
6f62d76c71 Simplify random seed conversion to float
The method `to_f` already returns `0.0` instead of raising an exception
when handling non-numeric values.
2018-12-05 13:03:10 +01:00
Javi Martín
ba7ca11cd8 Fix buggy parallel assignment
In ruby, when we assign two variables to one value, the second variable
is set to `nil`.
2018-12-05 13:02:39 +01:00
João Lutz
34b58a5208 Adds draft phase functionality in legislation processes 2018-11-19 22:18:50 -02:00
Javi Martín
9c13f08c8e Show selected legislation proposals by default 2018-10-04 16:31:00 +02:00
Javi Martín
8976280493 Order selected proposals by confidence score
The same way we order budget results.
2018-10-04 16:31:00 +02:00
Javi Martín
d9410a132a Always show filters for legislation proposals
As done in the rest of the application: we show the filters even if
there isn't any data to display.
2018-10-04 16:31:00 +02:00
Javi Martín
ec2b4fe7ff Use %w[] instead of %w{}
As agreed when discussing our rubocop rules.
2018-10-04 16:30:59 +02:00
Javi Martín
d6ff7e0f3f Simplify code 2018-10-04 16:29:01 +02:00
Raúl Fuentes
05340e423c Add select to Legislation::Proposals
Add admin interface for mark any proposal as selected
Add filter to public interface for selected proposals
2018-10-04 16:28:56 +02:00
voodoorai2000
422f3a5f47 Add tag filtering for legislation proposals 2018-10-04 15:43:41 +02:00
María Checa
d73be15296 Added tests 2018-10-03 16:02:41 +02:00
María Checa
056086e81e Allow admins to see legislation debates and proposals index 2018-10-03 16:02:12 +02:00
Bertocq
df3df71a54 Force postgresql setseed value in correct range
This commit partially backports commit AyuntamientoMadrid@f038399 by
taking only the parts affecting code already in CONSUL's main
repository.
2018-10-03 13:46:32 +02:00
Bertocq
c04b0ceda4 Add pagination to legislation process proposals list 2018-10-03 13:46:32 +02:00
Bertocq
349abffb20 Add random order based on seed to legislation process proposals list 2018-10-03 13:40:59 +02:00
Bertocq
599ddf8f41 Create @proposal variable con process controller for proposals list that use random seed 2018-10-03 13:40:59 +02:00
Bertocq
4ab9b8b767 Move onto proposals method the random seed call 2018-10-03 13:40:59 +02:00
Bertocq
0cabede68c Add random seed on Legislation Proposal controller for index 2018-10-03 13:40:59 +02:00
Bertocq
f45cfc108a Fix Style/AccessorMethodName rubocop issue 2017-11-13 02:34:00 +01:00
María Checa
38ba5e159b Legislation proposals show and edit views available 2017-09-20 17:45:17 +02:00
María Checa
0245605f19 Added Legislation Proposals controller 2017-09-14 12:51:36 +02:00
Eduardo Martinez Echevarria
9324b02ce1 Avoid set_process on legislation/processes controller member actions 2017-07-01 12:39:16 +02:00