Commit graph

1841 commits

Author SHA1 Message Date
Paul Chavard
8a74438dc1 Use conservation_extension instead of en_construction_conservation_extension 2021-05-11 17:33:53 +02:00
Paul Chavard
1e0d6ea28f Rename en_construction_conservation_extension to conservation_extension 2021-05-11 14:08:51 +02:00
simon lehericey
c5f6c9ae1e fix missing state translation 2021-05-10 11:17:34 +02:00
simon lehericey
8d0082419c do not know how it worked before 2021-05-05 14:36:34 +02:00
simon lehericey
4dc314d24b [fix #6084] add db constraints to france_connect_informations table 2021-05-05 14:28:20 +02:00
simon lehericey
50f679746f do not extract twice the same dossier_id if the dossier is followed twice 2021-05-04 16:38:34 +02:00
Paul Chavard
bcbfcdc537 Revert "Merge pull request #6142 from tchak/enable_brouillon_extend_conservation"
This reverts commit 48eb4d9778, reversing
changes made to 5539d5cb8c.

# Conflicts:
#	app/models/dossier.rb
#	db/schema.rb
2021-05-04 16:03:29 +02:00
Christophe Robillard
01f180022b prend en compte uniquement les pj pour estimer la taille d'un dossier 2021-05-04 12:50:12 +02:00
Paul Chavard
f6508899de Refactor NotificationMailer 2021-05-04 12:05:06 +02:00
Paul Chavard
a4fd629f4a Enable user destruction 2021-05-04 12:05:06 +02:00
Paul Chavard
b2a867266a Allow users to extend conservation on drafts 2021-04-29 19:50:30 +02:00
Christophe Robillard
f40d96fbd2 Revert "Revert "Export de tous les dossier d'une démarche""
This reverts commit d9a588b52e.
2021-04-29 17:29:47 +02:00
krichtof
d9a588b52e
Revert "Export de tous les dossier d'une démarche" 2021-04-29 16:07:18 +02:00
simon lehericey
db23a853a9 fetch all notification at once 2021-04-29 11:23:41 +02:00
simon lehericey
a4e813380a one query for avis count 2021-04-29 11:23:41 +02:00
simon lehericey
8b73d8804c fetch all exports at once by groupe_instructeurs_ids 2021-04-29 11:23:41 +02:00
Christophe Robillard
09870c918d prevent race conditions when creating archives 2021-04-28 11:40:58 +02:00
Christophe Robillard
dfbe004122 rename content_type to time_span_type for archives 2021-04-28 11:40:58 +02:00
Christophe Robillard
8b2849408c instructeurs can create and download archives 2021-04-28 11:40:58 +02:00
Christophe Robillard
07cc4fa97f add service to create procedure archive 2021-04-28 11:40:58 +02:00
Christophe Robillard
c25f3c79d9 add archive model 2021-04-28 11:40:58 +02:00
Pierre de La Morinerie
0cb2162a65 db: fix out-to-date Procedure comments 2021-04-27 15:36:22 +02:00
Paul Chavard
2a068fb9b0 Remove user feedback buttons 2021-04-22 15:40:40 +01:00
Paul Chavard
c20ad5ca17 Remove the link between commentaire and user 2021-04-22 15:10:47 +01:00
simon lehericey
553e1d973c remove old methods 2021-04-22 10:46:04 +02:00
kara Diaby
541a36abbf Add boolean to procedures table 2021-04-19 10:23:45 +02:00
simon lehericey
e0959cda1e constantize hot strings
- 1131 objects over 4220 (-25%) created in app/
2021-04-16 13:13:22 +02:00
simon lehericey
47f13219ed Avoid useless TypeDeChamp deserialization
- 520 objects overs 4720 (10%) created in app/ (using ?pp=profile-memory&memory_profiler_allow_files=app/)
2021-04-16 13:13:22 +02:00
simon lehericey
e728a3fcb7 include type_de_champ
Avoid n+1 when matching champ.stable_id in procedure.presentation.displayed_fields_values
win 2s in the worst 3s scenario
2021-04-16 13:13:22 +02:00
Paul Chavard
ea484b879e Prevent expert users to be deleted 2021-04-15 16:17:36 +01:00
kara Diaby
663fa50f02 notify expert when a decision is taken on a dossier 2021-04-15 11:29:55 +02:00
Paul Chavard
6d37e1d133 Fix discarded procedures destruction 2021-04-14 12:24:16 +01:00
Paul Chavard
5b56ec425b Fix discarded dossiers destruction 2021-04-14 12:24:16 +01:00
Paul Chavard
f152c51d12 Remove ignored_columns 2021-04-13 17:00:07 +01:00
simon lehericey
76e261691a add data column to france_connect_infromations 2021-04-13 09:59:28 +02:00
simon lehericey
cd6cb99c3c add bypass_email_login_token to instructeur 2021-04-13 09:43:38 +02:00
simon lehericey
594cda3ee3 Remove previous attempt but steal its spec 2021-04-13 09:32:48 +02:00
simon lehericey
6055fd1b0b remove for_procedure 2021-04-13 09:32:48 +02:00
simon lehericey
430acb1cb0 Fetch all count at once (- 400ms on pass culture) 2021-04-13 09:32:48 +02:00
simon lehericey
b24faae7e3 remove obsolete procedure_id column in assign_to table 2021-04-09 11:41:13 +02:00
Paul Chavard
5a7312f775 Ensure address to_s never returns nil 2021-04-08 16:43:45 +01:00
Paul Chavard
651a928b7c Improuve export UI 2021-04-08 14:40:26 +01:00
Paul Chavard
371d612fdb Remove unused columns 2021-04-08 12:43:29 +01:00
Paul Chavard
5e5122a436 Prevent crash in preview where there is no siblings 2021-04-06 18:15:29 +01:00
Paul Chavard
2702660d72 Update app/models/champs/header_section_champ.rb
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
2021-04-06 10:45:16 +01:00
Paul Chavard
4feda01b6f Show section numbers only if none of sections start with numbers 2021-04-06 10:45:16 +01:00
kara Diaby
60c06b6d8c add revoked at to experts_procedures 2021-04-06 10:39:22 +02:00
Pierre de La Morinerie
3499f5af9a models: remove invalid Dossier ↔︎ Champ inverse relationship
`Dossier.champs` is not really an inverse of `Champs.dossier`: when a
Champ record is created, it should not always be added to dossier.champs
(for instance if the champ is private).

NB: this breaks the workaround we added in #3907 to fix the parent
dossier not being touched in some cases (the workaround was to add an
inverse relationship, but we now have to remove it).

The new workaround is to watch for `changed_for_autosave?` on champs.
Unlike `changed?`, `changed_for_autosave?` also detects changes to
attachments. This allows us to touch both `last_champ_updated_at` and
`updated_at` in a single pass.
2021-04-06 10:26:17 +02:00
Paul Chavard
7f3d4a26ad Make exports#key not-null 2021-04-02 17:42:24 +01:00
Paul Chavard
fd48b86b7f Simplify export unicity check and use create_or_find_by 2021-04-01 21:14:16 +01:00
Pierre de La Morinerie
798b4a65cc models: fix db structure comment in etablissement.rb
The column is not removed yet, but it is ignored.
2021-03-30 10:45:31 +02:00
Paul Chavard
23104f15a4 Fix export n+1 queries 2021-03-25 19:22:12 +01:00
Pierre de La Morinerie
3f3d6ae399 controllers: use template: rather than file: to render PDFs
ActionView now throws an error if a relative path is used with `file:`.
2021-03-25 13:24:53 +01:00
kara Diaby
2930de1015 remove useless code in models 2021-03-24 17:47:24 +01:00
kara Diaby
71973de17c remove useless columns from the db 2021-03-24 16:20:44 +01:00
Paul Chavard
0b22788d60 experts_procedure should not be optional 2021-03-23 13:46:33 +01:00
Paul Chavard
84214f4bd4 Do not export non exportable champs on draft procedures 2021-03-23 09:55:37 +01:00
Kara Diaby
38837443aa
Merge branch 'main' into fix-experts-lookup 2021-03-18 20:46:56 +01:00
Pierre de La Morinerie
239169e925 dossier: fix looking-up avis from Expert
This line causes an error on Rails 6.1.

And it isn't even necessary: this line is supposed to query avis where
the expert advice has been requested – but this is handled by the
`if expert.dossiers.include?(self)` condition just above.
2021-03-18 17:59:30 +01:00
Paul Chavard
1449fbbe67 Fix multiple_drop_down_list mandatory check 2021-03-18 15:22:28 +01:00
kara Diaby
5e88ecc24c improve request to find an expert 2021-03-18 11:38:53 +01:00
kara Diaby
328c2a8e3c change email to display for expert 2021-03-18 11:38:52 +01:00
kara Diaby
e7945594cf eager_load for expert 2021-03-18 11:38:52 +01:00
kara Diaby
38740d1b5b modify experts avis controllers, concern and serializer 2021-03-18 11:38:52 +01:00
kara Diaby
c55e4d0d98 remove unused instructeur logic 2021-03-18 11:38:52 +01:00
kara Diaby
54d414b3b7 add expert to export 2021-03-18 11:27:51 +01:00
kara Diaby
d47fde3fcb add polymorphic relation to claimant on avis table 2021-03-18 11:27:51 +01:00
kara Diaby
d2ab2debb6 add expert logic 2021-03-18 11:27:51 +01:00
Christophe Robillard
60cc4d3697 add pdf to pjs export 2021-03-16 15:13:17 +01:00
Paul Chavard
76aa7bdfe3 Add default nil value for numero_tva_intracommunautaire 2021-03-16 12:57:10 +01:00
Pierre de La Morinerie
75a1046315 active_storage: refactor concerns
Follow-up of #5953.

Refactor the concerns with two goals:

- Getting closer from the way ActiveStorage adds its own hooks.
  Usually ActiveStorage does this using an `Attachment#after_create`
  hook, which then delegates to the blob to enqueue the job.
- Enqueuing each job only once. By hooking on `Attachment#after_create`,
  we guarantee each job will be added only once.

We then let the jobs themselves check if they are relevant or not, and
retry or discard themselves if necessary.

We also need to update the tests a bit, because Rails'
`perform_enqueued_jobs(&block)` test helper doesn't honor the `retry_on`
clause of jobs. Instead it forwards the exception to the caller – which
makes the test fail.

Instead we use the inline version of `perform_enqueued_jobs()`, without
a block, which properly ignores errors catched by retry_on.
2021-03-16 11:49:14 +01:00
Paul Chavard
a7fb7bf1ef Add geo json validation 2021-03-11 15:51:09 +01:00
Paul Chavard
d24ee27cac Try to reduce the number of external data fetches
Only fetch external data if the external_id is the current one and data is not yet fetched
2021-03-11 14:56:37 +01:00
kara Diaby
6383e6b9e7 Revert "Revert "Claimant type to avis table""
This reverts commit f4fd220d43.
2021-03-10 08:48:55 +01:00
Paul Chavard
70500e3d56 Groupe instructeur selector default blank 2021-03-09 14:47:23 +01:00
Paul Chavard
9c3e72c84a Use revision instead of groupe instructeur as dossier procedure link 2021-03-09 14:47:23 +01:00
Kara Diaby
f4fd220d43
Revert "Claimant type to avis table" 2021-03-09 13:40:10 +01:00
kara Diaby
af4a27f4e0 add claimant type on avis table 2021-03-07 22:47:24 +01:00
Christophe Robillard
6169399a6b fix limit date for notice validation 2021-03-05 08:34:39 +01:00
Pierre de La Morinerie
b0735aafe0 config: fix DynamicSmtpSettingsInterceptor warning again
This warning re-appeared when running mailer tests:

```
DISABLE_SPRING=1 bin/rspec spec/mailers/administration_mailer_spec.rb
```

It is now fixed properly, in a way recommanded by the documentation.
2021-03-04 22:52:19 +01:00
Christophe Robillard
7f496c43e5 no validation for old procedures 2021-03-04 16:13:19 +01:00
Pierre de La Morinerie
2f948f7e46 active_storage: fix blob update hooks
For some reason on Rails 6.1 the `after_update_commit` hook is properly
registered – but disappears from the record later, and in the end is
never run.

Fix it by using the general `after_commit` hook instead.
2021-03-04 14:30:38 +01:00
Paul Chavard
f31096b33e When procedure is reset delete only draft revision dossiers 2021-03-04 13:10:58 +01:00
Paul Chavard
600f49a0ff Hide groupe instructeur selector when routage is done via API 2021-03-04 11:06:04 +01:00
Paul Chavard
1c811083c0 Cleanup feature flags usage 2021-03-04 11:06:04 +01:00
Pierre de La Morinerie
9537342c06 procedure: fix query for finding champs without stable_id
It would break on ActiveRecord 6.1.
2021-03-04 09:54:22 +00:00
Paul Chavard
5d4f025be0 Rename for consistency with defaut_groupe_instructeur 2021-03-04 10:45:02 +01:00
Paul Chavard
89ec3923f2 Defaut groupe instructeur ordered by label 2021-03-04 10:35:44 +01:00
Paul Chavard
96a832bc19 Add SerializerService 2021-03-02 12:42:22 +01:00
Paul Chavard
bb072ba9e9 Add id argument to most collections on dossier 2021-03-02 12:42:22 +01:00
Pierre de La Morinerie
9f676c76e1 config: fix zeitwerk warning about DynamicSmtpSettingsInterceptor
Fix a warning when running tests:

> DEPRECATION WARNING: Initialization autoloaded the constant DynamicSmtpSettingsInterceptor.
>
> Being able to do this is deprecated. Autoloading during initialization is going
to be an error condition in future versions of Rails.
> 
> Reloading does not reboot the application, and therefore code executed during
> initialization does not run again. So, if you reload DynamicSmtpSettingsInterceptor, for example,
> the expected changes won't be reflected in that stale Class object.
> 
> This autoloaded constant has been unloaded.
> 
> Please, check the "Autoloading and Reloading Constants" guide for solutions.

However if we fix as recommanded, the interceptor will get added
each time the classes are reloaded. And as the actual class instance
changed after the reloading, they won't be de-duplicated – *and*
there's no way to remove the old interceptor without having a reference
to the (now-deleted) class.

Instead we load the interceptor once, and add a message about the class
not being auto-reloaded.
2021-02-24 19:00:29 +01:00
Paul Chavard
92158cecb6 fix constant 2021-02-19 11:29:08 +01:00
Paul Chavard
75392272fb Add champ address model 2021-02-17 19:10:16 +01:00
Paul Chavard
7eee14feef Add ChampFetchExternalDataJob 2021-02-17 19:10:16 +01:00
Christophe Robillard
d55f156aec admin: durée de conservation des données hors ds n'est plus demandée
La colonne est tout de même gardée en base
2021-02-17 16:41:57 +01:00
kara Diaby
7b4ec486ec change active record request to get expert list 2021-02-16 09:46:18 +00:00
Paul Chavard
9ce07be1ee [GraphQL] modifier annotation 2021-02-11 17:45:14 +01:00
Pierre de La Morinerie
819325c761 zeitwerk: move our Array extension to initializers/core_ext 2021-02-11 12:30:43 +01:00
Christophe Robillard
966ee33529 ignore when FranceConnect calls callback 2 times 2021-02-10 18:13:47 +01:00
Christophe Robillard
a288a13805 disable france connect authentication for admin and instructeurs 2021-02-10 18:13:47 +01:00