Commit Graph

504 Commits

Author SHA1 Message Date
taitus
3a154a57cb Fix houncibot offenses: Style/StringLiterals 2019-06-27 09:21:19 +02:00
taitus
72d1893703 Manage the remote translation button display
- Add remote_translation_button partial to layout
- Only display button when we have remote_translations and if current
  locale is include on available locales from remote translations service.
- Recover available locales from remote translations service.
  Use daily_cache to detect every day if remote translation service has
  added new available locale.

Co-Authored-By: alessandro <agileontheweb@gmail.com>
2019-06-27 09:21:18 +02:00
taitus
6ad294e71f Fix houncibot offenses. 2019-06-27 09:21:18 +02:00
taitus
1d3dd6f727 Add RemoteTranslationsCaller to new namespace
- Rename to Caller
 - Add to new namespace RemoteTranslations
 - Update references to new namespace
2019-06-27 09:21:18 +02:00
taitus
510307b0bd Add SentencesParser to new namespace
Add to new name space RemoteTranslations::Microsoft
2019-06-27 09:21:18 +02:00
taitus
4c1704a5a3 Add RemoteAvailableLocales to new namespace
Add to new name space RemoteTranslations::Microsoft and rename to
AvailableLocales.
2019-06-27 09:21:18 +02:00
taitus
d29656d78f Add MicrososftTranslateClient to new namespace
- Rename to Client
- Add to new namespace RemoteTranslations::Microsoft
- Update references to new namespace
2019-06-27 09:21:18 +02:00
taitus
d2506358ef Fix found Hound violations 2019-06-27 09:21:18 +02:00
taitus
4272b60339 Create Remote Translations Caller
This module is used in a callback model and in charge of
  - extracting resources associated from RemoteTranslation and preparing
    its fields to be sent to the MicrosoftTranslateClient thought DelayedJobs
  - receive the response from MicrosoftTranslateClient and update resource
    with his translates

Co-authored-by: javierm <elretirao@gmail.com>
2019-06-27 09:21:18 +02:00
taitus
95f848f021 Fix specs after rebase with translations branch
- Fix spec spec/features/management/proposals_spec.rb:24 adding single quotes.
- Remove spec related with 'proposal improvement info link' as master branch.
- Fix proposal rake task (now proposals have translations). We put the 'validate: false' to keep the existing html tags in the  proposal's description. Without the sanitizable module deleting them.
2019-06-27 09:19:37 +02:00
taitus
90df1faf07 Maganement of available locales in MicrosoftTranslateClient
- Create remote_available_locales method to recover available locales from microsoft tanslate client. This method will be useful to display the translation button as long as the locale sent is valid.
- Create parse_locale method: Need parse available locales in Consul to will be valid on Microsoft Translate Client
2019-06-27 09:19:36 +02:00
taitus
31011033a7 Create MicrosoftTranslateClient
- Conect to remote translation service and translate array of strings
- Create SentencesParser module with texts management methods:
  - Detect split position method: When the text requested to translate is too large, we need split it in smaller parts for we can translate. This method search first valid point (dot or whitespace) for split this text so then we can get an response without dividing the word in half.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
458fb750eb Fix restore method for paranoid models
Do not try to update confirmed_hide_at column from models without this column.
2019-06-27 09:19:35 +02:00
Pierre Mesure
2705416842 Adding missing subtasks to upgrade task and adding info log 2019-06-11 22:35:57 +02:00
Javier Martín
42f8ce99a0 Merge pull request #3590 from consul/add_upgrade_task
Add task to upgrade to a new release
2019-06-06 13:07:41 +02:00
Javi Martín
1d0b05832c Add info messages for release 1.0.0 tasks
So users know what's going on when they upgrade CONSUL.
2019-06-05 20:23:56 +02:00
Javi Martín
3ab2085e05 Move calculate_ballot_lines task to the right file
We already have a file with the proper budgets namespace.
2019-06-05 20:23:56 +02:00
Javi Martín
c78211af49 Add task to upgrade to version 1.0.0
It includes every task needed for the upgrade.
2019-06-05 20:23:54 +02:00
lalo
28815cb290 Create new email template for new evaluation comment created and add it to system_emails view 2019-06-05 16:22:12 +02:00
Javi Martín
e339ed94d1 Add new settings every time we deploy
This way we don't need to add and execute rake tasks every time we add a
new setting.
2019-05-31 19:33:31 +02:00
voodoorai2000
2f5d153581 Delete migration to budget investments 2019-05-31 18:23:03 +02:00
voodoorai2000
d0b8fef6b3 Delete spending proposals 2019-05-31 18:22:59 +02:00
Javier Martín
087a21b4ca Merge pull request #3565 from consul/fix_annotation_comments_order
Fix order in annotation comments with same score
2019-05-30 18:25:04 +02:00
Javi Martín
dbcc5fb724 Use AR relations when merging comments
Using arrays made it difficult to order by more than one field (like the
`most_voted` scope does), and so we were ordering by `confidence_score`
and ignoring the `created_at` column.

Using an AR relation makes it easy to reuse the existing `most_voted`
scope.

This change has one side effect: now comments with equal votes are
ordered in descending order instead of having no specific order. That
means flaky specs which failed sometimes because they assumed comments
were ordered by date are now always green.

I've also re-added the `oldest` scope removed in 792b15b thinking it was
removed because using it with arrays was too hard.
2019-05-29 20:50:53 +02:00
Javi Martín
7b5ce80593 Simplify MergedCommentTree#initialize
By setting the comments lazily in a different method, we can share its
code with the parent class.
2019-05-29 20:50:53 +02:00
Javi Martín
dd851cb6cc Add task to regenerate ballot_lines_count cache
We've added this column recently to `budget_ballots`, and we use it to
calculate stats.
2019-05-29 20:39:19 +02:00
Javi Martín
9ae0cbb254 Add task to migrate enabled poll results and stats 2019-05-22 12:48:11 +02:00
Javier Martín
82e3c41aa9 Merge pull request #3512 from consul/backport-stats
Change stats layout
2019-05-21 17:18:47 +02:00
Javi Martín
13dd77dd1b Add tasks to generate and expire stats cache
We're generating stats every 2 hours because it's less than the time it
will take to generate stats for every process. Once stats are generated,
this task should take less than a second.

The regenerate task has been added so we can manually execute it.
2019-05-21 13:50:19 +02:00
Javi Martín
383909e16c Extract class to manage GeozoneStats
Even if this class looks very simple now, we're trying a few things
related to these stats. Having a class for it makes future changes
easier and, if there weren't any future changes, at least it makes
current experiments easier.

Note we keep the method `participants_by_geozone` to return a hash
because we're caching the stats and storing GeozoneStats objects would
need a lot more memory and we would get an error.
2019-05-21 13:50:18 +02:00
Javier Martín
cbfa2c1df8 Merge pull request #3504 from consul/backport-poll_slugs
Add slug to polls
2019-05-21 13:42:47 +02:00
Alberto
7db1cac3bc Merge pull request #3507 from consul/proposals-user-segment
Proposals authors user segment
2019-05-20 14:00:15 +02:00
decabeza
e6af2f15fb Add new user segment all_proposals_authors 2019-05-17 17:22:29 +02:00
Javi Martín
3d84920c47 Add task to generate poll slugs 2019-05-17 08:15:41 +02:00
decabeza
f40787561d Remove all references to question and external_url fields 2019-04-30 16:42:07 +02:00
decabeza
e88c66c92c Dont use faker gem on simulate successful proposal rake 2019-04-29 15:45:35 +02:00
decabeza
ad41f23a98 Improve rake to add published_at to proposals 2019-04-29 15:44:47 +02:00
voodoorai2000
992f1d23a1 Change syntax to delay dashboard emails
After updating to Rails5 It seems the after_action[1] in the dashboard's mailer is not beind called.

Using this syntax the emails are still being delayed and the after_action being called correctly.

[1] https://github.com/AyuntamientoMadrid/consul/pull/1945/files#diff-fdf5590f3241c439fcc9d2225c3cf4d8R3
2019-04-29 15:44:45 +02:00
decabeza
f0305e36a6 Replace capistrano task restart file 2019-04-24 14:04:01 +02:00
decabeza
2cff3767c1 Remove open in new tab option for links 2019-04-24 13:58:13 +02:00
decabeza
cb22e6cbfb Merge branch 'master' into proposal-dashboard 2019-04-23 17:12:47 +02:00
voodoorai2000
e47a8be2a2 Add more log messages 2019-04-17 16:51:13 +02:00
voodoorai2000
aa04757e16 Add rake task to check for spending proposals 2019-04-17 16:50:32 +02:00
decabeza
91be3cf775 Fix more hound warnings 2019-03-27 15:22:14 +01:00
decabeza
b79061064b Remove all texts of decide madrid 2019-03-26 18:22:02 +01:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
Javi Martín
9d6bd7e788 Remove obsolete rake tasks
These tasks dealt with data migrations or stats generations which were
done only once, so we don't need them anymore.

New CONSUL installations don't need these tasks, and existing CONSUL
installations will execute them when upgrading one release at a time.
2019-03-22 13:07:09 +01:00
decabeza
ab8f04a71e Add updated_at to proposals rake 2019-03-21 14:15:07 +01:00
decabeza
832f0c40a8 Add rake to move external_url to description
This rake move this field for Proposals and Legislation proposals.
2019-03-21 14:14:50 +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