Commit graph

14602 commits

Author SHA1 Message Date
LeSim
4f80ab6374
Merge pull request #6747 from betagouv/US/fix-flacky-spec
wip - works from time to time (rspec ./spec/services/procedure_archive_service_spec.rb:181)
2021-12-14 14:29:11 +01:00
Martin
5ad0ee8ca9 fix(spec.flacky): try to use extractor in a more conventional way to extract file content 2021-12-14 14:18:59 +01:00
Pierre de La Morinerie
075c42e11e
Merge pull request #6737 from govpf/feature/fix_time_zoned_queries 2021-12-14 08:58:02 +01:00
maatinito
0a31c8bc79 refactor date_trunc queries using groupdate gem 2021-12-14 08:50:11 +01:00
maatinito
573b3d39e2 Fix date_trunc sql queries for timezoned forks 2021-12-14 08:50:09 +01:00
mfo
776f531804
Merge pull request #6735 from betagouv/zip_using_zip
Zip using zip
2021-12-13 17:50:29 +01:00
Martin
cf5794eebf clean(brakeman): remove unwanted warning 2021-12-13 17:09:20 +01:00
Martin
721d926c0d wip(fix): chdir 2021-12-13 16:37:04 +01:00
mfo
148be50c86 Update app/services/procedure_archive_service.rb
Co-authored-by: LeSim <mail@simon.lehericey.net>
2021-12-13 16:37:04 +01:00
Martin
1795084dce fix(brakeman): no code injection here 2021-12-13 16:37:04 +01:00
Martin
f7bc387e44 feat(flipper): use new way of generating archive only on some procedure flipped with new actor :zip_using_binary 2021-12-13 16:37:04 +01:00
simon lehericey
f0b0e7fd9a Switch to usage of zip unix binary to create archive. Also use a dedicated queue for DelayedJob
use dedicated archives queue

As the used disk space will increase, we want a fined grain control

move zip logic in dedicated method

zip

wip

wip

fix(spec): pass spec in green

tech(improvements): avoid File.delete(folder), favor FileUtils.remove_entry_secure which is safer. Also wrap most of code that open file within blocks so it is cleaned when the block ends. Lastly use  attachement.download to avoid big memory pressure [download in chunk, write in chunk] otherwise big file [124>1GO] are loaded in memory. what if we run multiple jobs/download in parallel ?

fix(spec): try to retry with grace

clean(procedure_archive_service_spec.rb): better retry [avoid to rewrite on open file]

lint(things): everything
2021-12-13 16:37:04 +01:00
mfo
68a0b6f474
Merge pull request #6746 from betagouv/US/fix_mon_avis_validator
ETQ administrateur ; je souhaite pouvoir publier un lien vers monavis qui utilise les URL de vosusagers
2021-12-13 15:48:53 +01:00
Martin
4b2e858a1a fix(mon_avis_embed_validator): enhance regexp 2021-12-13 14:49:40 +01:00
LeSim
6cdb694a14
Répare le fichier csv des stats accessible en super admin 2021-12-10 16:52:02 +01:00
maatinito
9df0d98109 Fix csv download of stats
https://medium.com/@mitsun.chieh/activerecord-relation-with-raw-sql-argument-returns-a-warning-exception-raising-8999f1b9898a
2021-12-10 16:48:11 +01:00
Paul Chavard
58adcf14e4
Merge pull request #6741 from tchak/fix-bulk_messages_groupe_instructeurs
fix(bulk_messages): destroy bulk messages with procedures
2021-12-09 16:20:43 +01:00
Paul Chavard
c7b1dc7f87 fix(bulk_messages): destroy bulk messages with procedures 2021-12-09 16:16:40 +01:00
Pierre de La Morinerie
14af63d32f
Merge pull request #6742 from betagouv/main 2021-12-09 13:11:33 +01:00
Paul Chavard
78784d1c62
Merge pull request #6740 from betagouv/fix-instructeur-daily-notifications
Correction de la requête de notification quotidienne des Instructeurs
2021-12-09 12:21:56 +01:00
Pierre de La Morinerie
0e35bc609d notifications: don't preload dossiers on instructeurs
This request currently times out almost every night in production.

It's because although Instructeurs are loaded in batches (default batch
size is 1000), loading all dossiers for 1000 instructeurs is slow.

Turns out the code executed after this query to compute notifications
doesn't even use these dossiers. Indeed it is faster not to preload
them: both the initial query and the total treatment time are shorter.

Here's a quick benchmark made locally (but using production data):

- Before this commit:

	Benchmark.measure { pp Instructeur.includes(assign_to: { procedure: :dossiers }).where(assign_tos: { daily_email_notifications_enabled: true }).limit(100).m
ap(&:email_notification_data) }

Only the initial query : 35s
Total time : 97s

- Without preloading dossiers:

	Benchmark.measure { pp Instructeur.includes(assign_to: :procedure).where(assign_tos: { daily_email_notifications_enabled: true }).limit(100).m
ap(&:email_notification_data) }

Only the initial query : 0.08s (400x faster)
Total time : 29s (3,3x faster)

Plus it doesn't timeout, of course.
2021-12-09 12:10:00 +01:00
Paul Chavard
0a96e2f5a0
Merge pull request #6739 from tchak/feat-helpscout-tags
feat(helpscout): add a tag to messages submited through contact form
2021-12-09 12:00:40 +01:00
Paul Chavard
b67818e425 feat(helpscout): add a tag to messages submited through contact form 2021-12-09 11:47:13 +01:00
Paul Chavard
a0ce6fa388
Merge pull request #6738 from tchak/fix-graphql-nil-attestation
fix(graphql): do not crash if attestation is nil
2021-12-08 13:24:18 +01:00
Paul Chavard
efd8ddb99e fix(graphql): do not crash if attestation is nil 2021-12-08 13:12:42 +01:00
LeSim
dd380530ea
Merge pull request #6709 from betagouv/small_wording_fixes
Petites corrections textuelles
2021-12-08 11:25:29 +01:00
simon lehericey
3bdf6b63d9 small wording fixes 2021-12-08 11:19:30 +01:00
LeSim
afea30b9c9
Merge pull request #6733 from betagouv/zone-wording
Introduit dès à présent le concept de zone à l'administrateur
2021-12-08 10:59:59 +01:00
Christophe Robillard
4ffd25a321 introduce zone concept from now on 2021-12-08 10:56:17 +01:00
LeSim
e7b7bd8b7b
Merge pull request #6710 from adullact/feature/api-particulier-pole-emploi
[API Particulier] (3/4) Support de Pôle emploi
2021-12-08 10:43:00 +01:00
François Vantomme
6ab8ac0662 feat (api particulier): add Pole emploi field 2021-12-08 10:36:25 +01:00
François Vantomme
4cfc9f7d86 feat(api particulier): add Pole Emploi adapter 2021-12-08 10:36:11 +01:00
François Vantomme
2e05a3fde2 feat(api particulier): add Pole Emploi locales 2021-12-08 10:36:11 +01:00
François Vantomme
cfb8c184fe perf(api particulier): use filter_map instead of map.compact
https://docs.rubocop.org/rubocop-performance/cops_performance.html#performancemapcompact
2021-12-08 10:36:11 +01:00
François Vantomme
a24cf18c9d feat (api particulier): add Pole Emploi support to sources service 2021-12-08 10:36:11 +01:00
François Vantomme
62bc2efbaa style(api particulier): mentionne Pôle Emploi dans les locales 2021-12-08 09:49:53 +01:00
mfo
bf669116c9
Merge pull request #6732 from betagouv/main
2021-12-07-05
2021-12-07 16:23:07 +01:00
LeSim
8caa1e810e
Merge pull request #6731 from tchak/fix-set_dossiers_processed_at
fix(task): fix scope in set_dossiers_processed_at
2021-12-07 16:18:24 +01:00
Paul Chavard
a5b3bc1e79 fix(task): fix scope in set_dossiers_processed_at 2021-12-07 16:15:43 +01:00
Pierre de La Morinerie
8778b24110
Merge pull request #6723 from betagouv/fix-uri-encode 2021-12-07 15:29:42 +01:00
Pierre de La Morinerie
c75dba701d lib: replace URI.encode by CGI.escape
URI.encode was removed in Ruby 3.

Fix an error when adding a phone number to a Helpscout ticket.
2021-12-07 15:25:26 +01:00
mfo
86b6b5df65
Merge pull request #6730 from betagouv/main
2021-12-07-04
2021-12-07 15:22:41 +01:00
Pierre de La Morinerie
799ca8e499
Merge pull request #6726 from betagouv/update-sentry 2021-12-07 15:17:06 +01:00
Pierre de La Morinerie
dc003113e6 gems: update sentry-rails to 4.8.1 2021-12-07 15:09:56 +01:00
Pierre de La Morinerie
f1c267fe81
Merge pull request #6729 from tchak/revert-fix 2021-12-07 15:09:36 +01:00
Paul Chavard
612b3bd82d fix(task): use dossier.read_attribute instead of direct read 2021-12-07 13:36:59 +01:00
Paul Chavard
5615baa985 Revert "Merge pull request #6724 from tchak/fix-approximative_expiration_date"
This reverts commit c95a67d970, reversing
changes made to 032989a400.
2021-12-07 13:32:39 +01:00
Paul Chavard
436569b08c Revert "Merge pull request #6727 from tchak/fix-approximative_expiration_date-again"
This reverts commit 951f974478, reversing
changes made to c95a67d970.
2021-12-07 13:32:27 +01:00
Pierre de La Morinerie
c7b1549063
Merge pull request #6728 from betagouv/main
2021-12-07-03
2021-12-07 13:11:30 +01:00
Pierre de La Morinerie
951f974478
Merge pull request #6727 from tchak/fix-approximative_expiration_date-again
Désactivation temporaire de l'expiration des dossiers
2021-12-07 13:09:59 +01:00