Commit graph

675 commits

Author SHA1 Message Date
Pierre de La Morinerie
49410ff5f7 models: update database comments 2022-05-18 15:39:33 +02:00
Martin
ba7a316f5e fix(Dossier.for_export): instead of iterating champs to build an hash {stable_id: values} ; we iterate on the list of all type de champs, so when there is a type de champ with mutliple values for export, we build the column with the nil value 2022-05-06 09:38:45 +02:00
simon lehericey
ea361643be types_de_champ -> types_de_champs_public 2022-05-03 11:05:24 +02:00
Paul Chavard
68ca9efba0 feat(dossier): use persisted dossier for preview 2022-04-28 12:20:41 +02:00
Paul Chavard
27f9a820cc feat(dossier): add preview flag 2022-04-28 11:52:38 +02:00
Paul Chavard
c671f25d34 fix(dossier): do not show unwanted closed procedure banners 2022-04-14 12:22:37 +02:00
Paul Chavard
433c01b1e6 Revert "Merge pull request #7137 from betagouv/faster_pdf"
This reverts commit 9da44bd913, reversing
changes made to ebac71796c.
2022-04-12 19:22:07 +02:00
simon lehericey
ba688a477a small refactor 2022-04-12 11:56:56 +02:00
Paul Chavard
90dd5bc9c5 fix(dossiers): dossier extend_conservation actually works 2022-04-08 13:40:28 +02:00
Martin
4890530428 fix(Dossier.processed_in_month): recast date to datetime in scope 2022-04-05 13:54:36 +02:00
Martin
9484c4cdf4 fix(Dossier.processed_in_month): using PG between operator with a date does not play nicely when it is compared to DateTime in postgres. meaning given a Date as 2022/03/31, when compared with a DateTime in postgres, the casting of 2022/03/31 to Datetime becomes 2022/03/31 00:00. So we skiped all dossiers from last date in month 2022-04-05 13:54:36 +02:00
Martin
c1884f231c Revert "Merge pull request #7105 from betagouv/US/fix-dossier.processed_in_month"
This reverts commit a0e144b9a7, reversing
changes made to 49848bd150.
2022-04-05 13:39:37 +02:00
Martin
d6d9db9721 tech(Sorbet): prepare usage of sorbet to avoid defensive programming style [casting date to datetime] 2022-04-05 12:14:07 +02:00
Martin
ec78340c06 fix(Dossier.processed_in_month): recast date to datetime in scope 2022-04-05 12:14:07 +02:00
Martin
ab777a790c fix(Dossier.processed_in_month): using PG between operator with a date does not play nicely when it is compared to DateTime in postgres. meaning given a Date as 2022/03/31, when compared with a DateTime in postgres, the casting of 2022/03/31 to Datetime becomes 2022/03/31 00:00. So we skiped all dossiers from last date in month 2022-04-05 12:14:07 +02:00
Paul Chavard
0daae815d8 refactor(dossier): use by_statut 2022-04-05 09:42:23 +02:00
simon lehericey
57f9e5bac3 always allow dossier pjs download (-9 queries) 2022-04-04 17:26:49 +02:00
Martin
ad4e5a8bc6 fix(instructeurs/procedures#index): counter not in sync 2022-04-04 16:28:25 +02:00
Paul Chavard
6df18e1234 fix(dossier): only expire dossiers visible by user or administration 2022-03-31 12:17:24 +02:00
Kara Diaby
217793c5c8 modify model 2022-03-29 12:30:52 +02:00
Kara Diaby
eda5f75ec3 modify dossier model 2022-03-17 13:57:49 +01:00
Paul Chavard
77c2187747 fix(instructeur): avoid n+1 in instructeur_dossier#show and user_dossier#show 2022-03-15 09:57:54 +01:00
Paul Chavard
c60a8970f1 perf(dossier): memoize champ.sections on dossier 2022-03-11 00:15:53 +01:00
Paul Chavard
54b559364a feat(dossier): replace discarded with visible_by_administration 2022-03-10 14:29:40 +01:00
Paul Chavard
e269077c40 refactor(attestation_template): cleanup relationships 2022-02-11 08:45:32 +01:00
Kara Diaby
0ce61f451e modify dossier model 2022-02-09 14:43:36 +01:00
Paul Chavard
12151acb99 Revert "Revert "feat(attestation): revise attestations""
This reverts commit 4e7733e571.
2022-02-08 16:22:59 +01:00
Kara Diaby
0f968f4c4e modify models 2022-01-27 17:01:27 +01:00
Paul Chavard
4e7733e571 Revert "feat(attestation): revise attestations"
This reverts commit e413872530.
2022-01-25 18:26:34 +01:00
Kara Diaby
2eb35065f8 fix dossier deletion mailers 2022-01-25 11:46:05 +01:00
Paul Chavard
e413872530 feat(attestation): revise attestations 2022-01-19 18:00:37 +01:00
Paul Chavard
403e71b41f feat(procedure): only purge procedures without dossiers 2022-01-18 11:22:04 +01:00
Paul Chavard
7937e58caa fix(archives): only export dossiers in archive groupe_instructeurs
fix #6793
2022-01-18 11:16:20 +01:00
Paul Chavard
7e0d471a08 improuve discarded_expired scopes 2022-01-12 15:49:38 +01:00
Kara Diaby
894b065615 modify dossier model 2022-01-12 15:49:37 +01:00
Kara Diaby
1ca553e088 rename hidden_by_instructeur by hidden_by_administration 2022-01-03 11:51:25 +01:00
Paul Chavard
ad4be3c482 refactor(dossier): handle discard by admin and super admin 2022-01-03 11:51:25 +01:00
Kara Diaby
051d7b2028 change dossier method 2021-12-29 17:37:58 +01:00
Kara Diaby
37e991ccb8 User : delete the folder if the instructeur has hide it 2021-12-29 17:37:58 +01:00
Kara Diaby
22ac853815 add hidden_by_instructeur scope 2021-12-29 17:37:58 +01:00
Kara Diaby
cd95b730e0 add hidden_by_instructeur_at on dossiers 2021-12-29 17:37:57 +01:00
Paul Chavard
efd8ddb99e fix(graphql): do not crash if attestation is nil 2021-12-08 13:12:42 +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
Paul Chavard
48ee830586 fix(dossier): fix approximative_expiration_date again 2021-12-07 13:02:53 +01:00
Paul Chavard
60d4bcc4f7 fix(dossier): fix approximative_expiration_date 2021-12-07 12:47:27 +01:00
Paul Chavard
2ba05bfb4f fix(dossier): use depose_at instead of en_construction_at 2021-12-06 15:49:17 +01:00
Martin
081d5094a9 feat(instructeurs/procedure/dossiers#extend_conservation): add extends duree conservation in action button list, also rewire this action for user [extend by procedure.duree_conservation_dans_ds by default] but force 1.month for instructeur. add new icon for standby based on https://en.wikipedia.org/wiki/Power_symbol 2021-12-06 07:20:01 +01:00
Martin
d8a8d1fdab feat(instructeur/dossier/header/_expiration_banner): split trads and add dedicated expiration banner for instructeur. also enhance wording to include duree conservation + extension_conservation
feat(expiration_banner): enhance wording of expiration

feat(dossiers/expiration_banner): enhance wording regarding expiration to include duree_conservation_dossiers_dans_ds + extension_conservation, also add spec on expiration_banner for instructeur
2021-12-06 07:05:17 +01:00
Martin
1bb868714c fix(spec/lint/review): lint and fix spec of previous commits, also fix based on tchak feedback 2021-12-06 07:05:17 +01:00
Martin
d87f8b57cc feat(instructeurs/procedures#show): add dossier experiant in procedure#show 2021-12-06 07:05:17 +01:00
Martin
ce87878ff0 refactor(traitement.process_expired): move process expired to procedure 2021-12-03 16:32:36 +01:00
Martin
725521c3a1 fix(expiration_banner): only show expirations info when flip is enabled
fix(lint): lint haml

fix(spec): enable flipper and allow procedure to receive flipper check when checking banner presence

fix(doc): add missing documentation on readme regarding system testing with a visual feedback

fix(typo): add missing accent

clean(PR): feedback from Tchak, better to wrap feature check for expirability by procedure within dossier.expirable? helper
2021-11-30 16:05:32 +01:00
simon lehericey
5a0fb6237f 😭 AASM does not support keyword arguments
https://github.com/aasm/aasm/issues/672
2021-11-30 09:42:45 +01:00
Martin
cf82c030e8 hotfix(scoping): try to avoid requesting archived: false when using termine scope, use state_termine instead 2021-11-26 15:09:53 +01:00
kara Diaby
eaac293da3 add a new tab traités on user dossiers 2021-11-26 09:45:13 +01:00
Paul Chavard
d847775c68 feat(traitements): add depose_at to dossiers 2021-11-25 12:57:55 +03:00
Paul Chavard
1f1dd9fce5 fix(traitements): add missing traitements to dossiers when reverting a decision 2021-11-25 12:57:55 +03:00
Martin
b6adf5fc72 feat(dossiers/show): enhance header with expirations message/banner. also ensure consistent design between dossier states
fix(spec): broken due to last refactoring

spec(dossier.extend_conservation): add system spec

lint(ruby): still not yet ready for auto lint in IDE...
2021-11-23 05:50:25 +01:00
Martin
a9978fb70b clean(code): move mfo comment to its rightful place 2021-11-19 14:34:20 +01:00
Martin
608a85148f feat(Dossier.close_to_expiration): add method to find any kind of dossier close to expiration [reuse previous scopes], add missing spec to termine_close_to_expiration, complement spec for each kind of expiration scope with general close_to_expiration spec 2021-11-19 14:28:54 +01:00
Martin
d8257284ef tech(refactor): extract states close to expiration within their scope. 2021-11-19 14:07:47 +01:00
Martin
1d721f14a0 fix(spec): get back to stable state 2021-11-19 12:36:03 +01:00
Martin
646459a1da fix(spec): at least let us start from a green suite 2021-11-18 18:15:57 +01:00
Paul Chavard
df474b60cf WIP 2021-11-18 18:58:17 +03:00
Paul Chavard
04e67ea20a fix(dossier): add instructeur email to traitements when available 2021-11-16 19:00:20 +03:00
Paul Chavard
da47f491b3 fix(dossier): nullify close to expiration notice timestamps when changing state 2021-11-11 12:52:58 +01:00
Paul Chavard
faa235d205 fix(dossier): destroy operation logs when destroying an expired dossier 2021-11-11 09:37:09 +01:00
Paul Chavard
122cdacbc2 fix(avis): destroy avis for discarded en_construction dossiers 2021-11-04 10:12:44 +01:00
Paul Chavard
f6b8689a97 fix(revisions): fix repetitions export with revisions 2021-11-03 18:20:48 +01:00
Paul Chavard
0e2f09dd6f fix(dossiers): wrap dossier discard in a transaction
By doing this we ensure that deleted_dossier are not created when dossier is not discarded
2021-11-02 18:17:35 +01:00
Paul Chavard
d5d3995dad fix(dossier): fix dossier.avis cascade 2021-10-26 11:16:29 +02:00
Paul Chavard
4aa573a75d fix(transfer): remove discarded dossiers from transfers 2021-10-26 10:41:01 +02:00
Paul Chavard
2a3a9dd822 feat(revisions): rebase dossiers brouillons 2021-10-20 17:26:09 +02:00
Paul Chavard
1ca8192864 perf(export): load dossiers.champs in batches 2021-10-20 16:52:38 +02:00
Paul Chavard
9d5c5447c2 fix(dossier): do not attempt to destroy transfers when a dossier is destroyed
we had a dependent option on both sides of a relationship which created race conditions
2021-10-06 17:51:09 +02:00
Paul Chavard
d3c1941fbe fix(dossier): never write dossier log on dossiers brouillons 2021-10-05 17:56:51 +02:00
simon lehericey
65911b7680 update with_notifications dossiers scope (used in procedure index and show) 2021-10-05 12:05:43 +02:00
simon lehericey
3a878dfc04 add identity_updated_at column to dossier 2021-10-05 12:05:43 +02:00
Paul Chavard
d6cbdf2a48 feat(dossier): add dossier transfer models 2021-09-08 14:39:46 +02:00
Paul Chavard
a7ec43a21e fix(i18n): fix email previews 2021-09-08 09:21:19 +02:00
Paul Chavard
74e277d0a2 feat(graphql): add an option to dossier state change mutations to disable notifications 2021-09-07 14:21:48 +02:00
Paul Chavard
ff7fa4d895 feat(i18n): expose locale on dossier and deleted_dossier 2021-09-07 09:51:23 +02:00
Paul Chavard
8e1bfb469f fix(dossier): send expiration notifications 2 weeks prior to supression instead of a month 2021-08-26 11:28:57 +02:00
Christophe Robillard
e06f11f33f add code insee libelle for commune export 2021-08-19 08:04:47 +02:00
Christophe Robillard
daa306859c champ export can be an array of values 2021-08-19 08:04:47 +02:00
Paul Chavard
ffa8c0c80a feat(dossiers): enable dossiers termine expiration behind feature flag
feature flag "procedure_process_expired_dossiers_termine" controls if a procedure has expiration
enabled on dossiers termine

re #3796
2021-08-18 16:11:35 +01:00
Pierre de La Morinerie
0fd23ebd43 db: fix schema.rb leftovers 2021-07-22 17:55:47 +02:00
Christophe Robillard
66cc0dd08d Revert "Revert "Expose dossier PDF export as IO""
This reverts commit 362093eff0.
2021-06-24 21:01:59 +02:00
krichtof
362093eff0
Revert "Expose dossier PDF export as IO" 2021-06-24 19:21:37 +02:00
Paul Chavard
b73d504f8d Expose dossier PDF export as IO
Co-authored-by: Christophe Robillard <christophe.robillard@beta.gouv.fr>
2021-06-24 17:49:24 +02:00
Paul Chavard
19195008e8 Expose removed types_de_champ in exports 2021-06-23 09:40:07 +02:00
François Vantomme
c9b1095d1e Refactor (Rubocop): replace map{ … }.compact by filter_map
In Ruby 2.7, Enumerable#filter_map has been added.
This cop identifies places where map { … }.compact can be replaced by filter_map.

See: https://docs.rubocop.org/rubocop-performance/cops_performance.html#performancemapcompact
2021-06-11 15:38:09 +02:00
Paul Chavard
1888f74b10 Prevent double processing of declarative dossiers 2021-06-04 17:55:40 +02:00
simon lehericey
b620888597 show only dossier avis 2021-05-20 16:18:04 +02:00
kara Diaby
20933579b0 do not display confidential avis to other experts 2021-05-19 21:30:22 +02:00
Paul Chavard
5f419954b4 Fix dossier deleted user display 2021-05-13 10:43:55 +02:00
Paul Chavard
3f7a2bea9b Dossier without user should be valid 2021-05-11 17:50:10 +02:00
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
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
Christophe Robillard
07cc4fa97f add service to create procedure archive 2021-04-28 11:40:58 +02:00
kara Diaby
663fa50f02 notify expert when a decision is taken on a dossier 2021-04-15 11:29:55 +02:00
Paul Chavard
5b56ec425b Fix discarded dossiers destruction 2021-04-14 12:24:16 +01:00
simon lehericey
6055fd1b0b remove for_procedure 2021-04-13 09:32:48 +02:00
Paul Chavard
371d612fdb Remove unused columns 2021-04-08 12:43:29 +01: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
23104f15a4 Fix export n+1 queries 2021-03-25 19:22:12 +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
kara Diaby
38740d1b5b modify experts avis controllers, concern and serializer 2021-03-18 11:38:52 +01:00
Christophe Robillard
60cc4d3697 add pdf to pjs export 2021-03-16 15:13:17 +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
Paul Chavard
600f49a0ff Hide groupe instructeur selector when routage is done via API 2021-03-04 11:06:04 +01:00
Paul Chavard
9ce07be1ee [GraphQL] modifier annotation 2021-02-11 17:45:14 +01:00
Pierre de La Morinerie
4ad9adc510 models: fix Ruby 2.7 arguments passing
Arguments to an ActiveRecord scope will always been passed as a
Dictionnary. Thus
`Dossier.with_notifiable_procedure(notify_on_closed: true)` will trigger
a Ruby 2.7 warning:

> /ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/relation.rb:412: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call

Fix the issue by always expecting a Dictionary (rather than keyword
arguments).
2021-02-09 09:20:46 +01:00
Paul Chavard
a591d5528e Add job exception log methods to champ and dossier 2021-02-05 18:56:27 +01:00
Paul Chavard
78a07ef021 Add job exception logs to dossier and champ 2021-02-04 19:27:27 +01:00
simon lehericey
4960eda5cb use stable id 2020-12-17 10:51:09 +01:00
kara Diaby
f3c4040d2d add grace period to deleted dossiers 2020-12-16 15:00:26 +01:00
kara Diaby
00b5ad7a10 EQT instructeur, je peux supprimer un dossier terminé 2020-12-16 15:00:26 +01:00
Paul Chavard
48e7822e34 Remove titres identite after a dossier is processed 2020-12-10 15:21:25 +01:00
kara Diaby
d9dea779ea Remove foreign key dossier on dossier operations logs 2020-11-17 16:02:53 +01:00
kara Diaby
c033ef0910 Ajoute a l'information de connexion France Connect dans les informations du dossier ainsi que sur la demande usager 2020-11-05 19:30:13 +01:00
Paul Chavard
0aa06d0197 [GraphQL] expose dossier pdf, geojson and attestation 2020-10-06 21:54:43 +02:00
Paul Chavard
1bd59c72e5 Include in exports types_de_champ from all revisions 2020-09-30 13:42:38 +02:00
clemkeirua
4fc038fe1b use after_create instead of after_save 2020-09-29 18:15:38 +00:00
clemkeirua
dd7840cdc4 Notify new draft after dossier commit 2020-09-29 18:15:38 +00:00
Paul Chavard
973973ab6a Do not enqueue web hooks for empty urls 2020-09-22 17:03:19 +02:00
Paul Chavard
a911a71db9 Log dossier archiver/desarchiver operations 2020-09-22 08:34:38 +00:00
clemkeirua
f96377d878 refactor Dossier#with_notifications 2020-09-21 08:28:42 +00:00
clemkeirua
d01a53eb72 remove :cached_notifications gate 2020-09-21 08:28:42 +00:00
clemkeirua
c7b96d3d43 add feature-flip for instructeurs on cached notifications 2020-09-08 15:40:42 +00:00
clemkeirua
52ea5ef89a make Dossier#with_notifications great again
Co-authored-by: Christophe Robillard <christophe.robillard@beta.gouv.fr>
2020-09-08 15:40:42 +00:00
Paul Chavard
ec72fdd164 Remove migration service 2020-09-02 11:26:26 +02:00
Pierre de La Morinerie
51d392a1dc models: require belong_to associations on dossier 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
2892fdbeef models: remove columns that have been deleted from db schema
These columns are gone, so we can't stop ignoring them.
2020-08-12 12:06:58 +02:00
Pierre de La Morinerie
6d28069539 models: generate annotations 2020-08-12 11:45:53 +02:00
Christophe Robillard
03e3e8fb1c rename Dossier#modifier_annotations!
give a more accurate name to the method

Co-authored-by: clemkeirua <clement@keiruaprod.fr>
2020-07-30 10:18:44 +02:00
clemkeirua
7e085c657d specific deactivation of rubocop DS/ApplicationName rule 2020-07-23 16:20:16 +02:00
Paul Chavard
9de917592b Add revisions models and relationships 2020-07-21 19:35:30 +02:00
Paul Chavard
b628169053 Remove unsused drop_down_list model 2020-07-16 15:29:01 +02:00
Christophe Robillard
f38e16e371 avoid n+1 queries 2020-07-08 18:15:15 +02:00