Commit Graph

2200 Commits

Author SHA1 Message Date
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
Alberto
29a87e2746 Merge branch 'dashboard' into dashboard-polish 2019-03-26 12:19:20 +01:00
Raimond Garcia
f6526f4a45 Merge pull request #3271 from Platoniq/dashboard-user-communication
Dashboard user communication
2019-03-26 12:10:18 +01:00
Javi Martín
4c35df4812 Use double quotes inside string interpolation 2019-03-25 14:58:54 +01:00
Javi Martín
58816aef5f Fix legislation process feed order
We need to add an ORDER BY clause; not doing so was causing different
processes to show up sometimes. As mentioned in the PostgreSQL manual:

> Because the order of the rows in the database table is unpredictable,
> when you use the LIMIT clause, you should always use the ORDER BY
> clause to control the order of rows. If you don’t do so, you will get
> an unpredictable result set.
2019-03-21 17:12:03 +01:00
Senén Rodero Rodríguez
c73aae9663 Remove before validation callback
This was breaking nested poll_questions_answers when submitting
more than one new answer at a time.
2019-03-21 14:51:17 +01:00
taitus
8b1c458fdf Allow detect new actions since a custom date
- Rename method "detect_new_actions" to "detect_new_actions_since". Add new param date.
2019-03-21 12:29:31 +01:00
taitus
08383b9cac Send new notification email after publish Proposal
After publish a proposal send email to proposal's author with information text and new actions available.
2019-03-21 12:29:30 +01:00
taitus
5177adb32a New rake task for proposals to send new action email
Execute rake task every day to detect new actions available for not archived proposals. If there are new actions available for today, send email to proposal's author with information text, new actions available and link to proposal dashboard url.
2019-03-21 12:29:28 +01:00
taitus
c959e078b8 Send new action notification email after create Proposal
After create a proposal send email to proposal's author with information text and new actions available.
2019-03-20 11:50:47 +01:00
taitus
868c37ef35 Detect new actions for proposals
Create new Dashboard::Action class method to detect new actions between yesterday and today for a proposal.
- Published proposal: Only detect new actions with "published_proposal" field eq true
- Draft proposal: Only detect new actions with "published_proposal" field eq false
2019-03-20 11:50:46 +01:00
Julian Herrero
89d4ea5aa3 Remove homepage widget settings from configuration tab
- Rename homepage widget settings keys
2019-03-19 19:45:34 +01:00
decabeza
3f1d3f3443 Fix hound warnings 2019-03-19 18:24:49 +01:00
Alberto
501f6257bf Merge pull request #3260 from Platoniq/dashboard-actions-for-published-proposals
Dashboard actions for published proposals
2019-03-19 16:20:47 +01:00
Julian Herrero
9ed6aae348 Refactor Setting model
- Make easier to group settings by using prefixes
- Add method to rename setting keys
- Add method to remove setting keys
2019-03-19 15:14:08 +01:00
Julian Herrero
3ba961a2d7 Use double quotes in models 2019-03-14 17:25:43 +01:00
rgarcia
8125d470de Add methods to obtain polls votable by a user 2019-03-06 17:42:46 +01:00
Alberto
098f4b6c5f Merge pull request #3328 from consul/admin-settings
Improve Admin settings section
2019-02-27 10:49:54 +01:00
Javi Martín
c5c56ad969 Use a virtual attribute to get valuation tags
It was strange to set the valuation tags using `valuation_tag_list=` but
then accessing the valuation tags using `tag_list_on(:valuation)`.
2019-02-26 14:16:10 +01:00
Javi Martín
4980819528 Fix valuation tags being overwritten
When params[:budget_investment][:valuation_tag_list] was not present,
which is the case when updating an investment using the "mark as visible
to valuators" checkbox, we were removing all valuation tags.

Using a virtual attribute to assign the tags only if the parameter is
present simplifies the code in the controller and avoids the issue.
2019-02-26 14:16:10 +01:00
Javier Martín
9fd3c4fb1c Merge pull request #3321 from consul/backport-fix_random_order
Fix random proposals order in the same session
2019-02-26 14:09:24 +01:00
decabeza
8066b96fe3 Remove legacy banner images and banner styles settings 2019-02-25 14:59:38 +01:00
decabeza
0d834744fd Replace open to active filter on admin legislation processes index
Now active filter show open processes and the next ones, processes with a start date greather than current date.
2019-02-20 13:32:09 +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
Javier Martín
7c61f621e2 Merge pull request #3314 from consul/backport-without_valuator
Consider having valuator group as having valuator
2019-02-19 18:59:15 +01:00
Javier Martín
44483c2c32 Merge pull request #3313 from consul/backport-fix_literal_as_condition
Fix literal as condition
2019-02-18 18:58:47 +01:00
Julian Herrero
884274c4ad Add a description for open polls 2019-02-18 13:34:07 +01:00
Javi Martín
bd67fcb9cf Consider having valuator group as having valuator
So under the tab "without valuator" we don't show investments assigned
to a valuator group, just as expected by administrators.

There was a conflict while applying this commit to the CONSUL repo. I've
decided to re-introduce the test which was deleted in commit dddf026a,
which hadn't been deleted in AyuntamientoMadrid@192f1182.
2019-02-15 21:11:24 +01:00
Javi Martín
250b19b0d3 Remove literal used in condition
The right syntax would have been:

`after_save :recalculate_heading_winners, if: :incompatible_changed?`

However, since the method `recalculate_heading_winners` already executes
the `if incompatible_changed?` condition, removing it keeps the intended
behaviour.
2019-02-15 20:21:35 +01:00
Javier Martín
b330de01f6 Merge pull request #3148 from matisnape/budget_investments_sorting_columns
Add sort links to admin tables
2019-02-15 19:19:11 +01:00
Julian Nicolas Herrero
4a12425987 Merge pull request #3296 from consul/make_budgets_translatable
[Backport] Make budgets translatable
2019-02-13 19:01:13 +01:00
Julian Nicolas Herrero
e8c77f58a6 Merge pull request #3292 from consul/backport_delete_officer_assignment_with_associated_data
[Backport] Delete Booth Shifts with associated data
2019-02-13 18:56:43 +01:00
Alberto
fad65b621a Merge pull request #3291 from consul/total-votes
[Backport] Use votes score instead of total votes on debates and legislation proposals
2019-02-13 17:15:39 +01:00
Julian Herrero
a963a99c55 Use correct scope to sort headings by name 2019-02-13 13:35:09 +01:00
Julian Herrero
29a704bd60 Show headings in budgets landing page when translations are missing 2019-02-13 13:35:09 +01:00
Julian Herrero
1ba50c76c4 Use method from Globalizable module
Since we have a method defined inside the Globalizable
module we don't need to create the same method in every model
2019-02-13 13:35:09 +01:00
Julian Herrero
922600252c Make budget headings translatable 2019-02-13 13:35:07 +01:00
Julian Herrero
1c35ec99c1 Make budget groups translatable 2019-02-13 12:30:37 +01:00
Julian Herrero
90d0a6e416 Make budget phases translatable 2019-02-13 11:44:56 +01:00
Julian Herrero
d76782f150 Make budgets translatable 2019-02-13 11:41:58 +01:00
Julian Herrero
5f4a369606 Deleting a booth shift with recounts or partial results.
Show a flash message that it's not possible to delete booth shifts
when they have associated recounts or partial results. Before an
execption was raised.
2019-02-12 18:59:51 +01:00
decabeza
6b62ba0e91 Show cached_votes_score on admin legislation proposals 2019-02-12 18:42:44 +01:00
decabeza
0ae1cdfc8c Replace total votes to cached_votes_score on legislation proposals
This show votes_score as result of votes_up minus votes_down
2019-02-12 18:42:41 +01:00
decabeza
4e4804e180 Replace total votes to cached_votes_score on debates
This show votes_score as result of votes_up minus votes_down
2019-02-12 18:42:35 +01:00
decabeza
73a0f999ad Add order to voted headings names 2019-02-12 17:19:36 +01:00
voodoorai2000
f4b8099703 Simplify sql query 2019-02-12 17:18:38 +01:00
Marko Lovic
264c4e747b Improve User#headings_supported_within_group performance
Performs a single DB call instead of 3
2019-02-12 17:16:49 +01:00
Marko Lovic
e47cbe2a10 Extract "supported headings" logic to User method
In preparation to use this method from views where
it doesn't make sense for it to be associated with
a specific investment.
2019-02-12 17:16:29 +01:00