Commit graph

1371 commits

Author SHA1 Message Date
simon lehericey
809d991819 add champ_value 2022-06-17 14:53:27 +02:00
simon lehericey
daaa54b6f0 add n_ary operators 2022-06-17 14:53:27 +02:00
simon lehericey
698eff0a50 add equal operator 2022-06-17 14:53:27 +02:00
simon lehericey
ebe95b83fa add compatibility checks 2022-06-17 14:53:27 +02:00
simon lehericey
a98a6d6d1e add binary operators 2022-06-17 14:53:27 +02:00
simon lehericey
6ebfc505c4 add empty 2022-06-17 14:53:27 +02:00
simon lehericey
58da4805fa add constant 2022-06-17 14:53:27 +02:00
Paul Chavard
65bd996f2a refactor(types_de_champ_editor): remove old react editor 2022-06-17 11:04:09 +02:00
Martin
56f7133799 fix(procedure_presentation): can not present a 'virtual field' like depose_since
fix(data): add migration to remove fields depose_since from existing procedure presentation
2022-06-14 09:02:37 +02:00
Paul Chavard
95a1ea1047 feat(procedure_presentation): add since date filters 2022-06-09 13:01:22 +01:00
Martin
d39b3b09ed fix(webhook.perform): ensure to enqueue job with current state/updated_at for consistency reason 2022-06-01 15:54:55 +02:00
Martin
cb890343ff feat(targeted_user_link): add targeted user link to wrap expert invitation in order to avoid access issue when the expert is connected with another account
feat(user.merge): ensure to merge user.targeted_user_link

Update app/models/targeted_user_link.rb

Co-authored-by: LeSim <mail@simon.lehericey.net>

Update app/models/targeted_user_link.rb

Co-authored-by: LeSim <mail@simon.lehericey.net>

Update app/models/targeted_user_link.rb

Co-authored-by: LeSim <mail@simon.lehericey.net>

feat(db/create_targeted_user_links): ensure not null with fk
2022-05-31 14:50:31 +02:00
Paul Chavard
c0a253078c fix(revision): fix clone démarches with repetitions 2022-05-31 13:28:56 +02:00
Paul Chavard
02675a104d fix(revision): fix tests to use new revison system 2022-05-31 08:58:53 +02:00
Paul Chavard
a36672239d refactor(revision): rename find_or_clone_type_de_champ 2022-05-31 08:58:53 +02:00
Christophe Robillard
fd98247b48 [manager] add list of dubious procedures 2022-05-25 14:44:53 +02:00
Pierre de La Morinerie
8936461d5b app: cache the duration estimate for published procedures 2022-05-25 10:39:18 +02:00
Pierre de La Morinerie
3e91a16895 app: display estimated fill duration on procedure description 2022-05-25 10:39:15 +02:00
simon lehericey
8ce080bd3e updated_at pb 2022-05-24 15:38:50 +02:00
simon lehericey
db5d291acd complete spec and alternative implem 2022-05-24 15:38:50 +02:00
simon lehericey
4c19a127d6 add rebase specs 2022-05-24 15:38:50 +02:00
simon lehericey
b3ce124aa8 move rebase spec to its own file 2022-05-24 15:38:50 +02:00
Paul Chavard
0817731d6a refactor(dossier): rebase to use new revisions 2022-05-24 15:38:50 +02:00
Martin
51f0be1034 clean(deadcode): remove dead methods 2022-05-24 14:23:40 +02:00
Martin
d0599dd36b bug(root): test root 2022-05-24 14:23:40 +02:00
Paul Chavard
b635952b2f refactor(revision): types_de_champ for export 2022-05-23 18:36:18 +02:00
simon lehericey
c5a0fd4349 use children_of on validation repetition is not empty 2022-05-20 09:24:05 +02:00
Paul Chavard
24d47eb6d3 bug(revision): revising child type de champ create duplicate coordinate 2022-05-18 19:32:56 +02:00
simon lehericey
fd4d543b20 fix test 2022-05-18 15:18:17 +02:00
simon lehericey
633f0d1ce5 remove_repetition 2022-05-18 12:12:25 +02:00
simon lehericey
4d97f6aa8c types_de_champ_for_revision 2022-05-18 11:40:34 +02:00
Paul Chavard
cdd597db19 refactor(dossier): fix champ repetition factories 2022-05-18 11:24:14 +02:00
simon lehericey
5767c9b97e fix test 2022-05-18 10:11:31 +02:00
Paul Chavard
b6ea44f7e7 refactor(revision): remove type_de_champ#revision_id 2022-05-17 11:31:49 +02:00
simon lehericey
10fff77d69 spec: split cases 2022-05-16 16:51:49 +02:00
simon lehericey
a26a662df4 spec: move one level up 2022-05-16 16:51:49 +02:00
Paul Chavard
d7678c4389 Revert "Merge pull request #7295 from tchak/rollback-attempt"
This reverts commit 24b37c230d, reversing
changes made to 08b90b9173.
2022-05-13 17:17:23 +02:00
Paul Chavard
4c26e34c79 Revert "Merge pull request #7270 from betagouv/remove_type_de_champ_v2"
This reverts commit 41b6f8f51b, reversing
changes made to 79d5946ab6.
2022-05-11 20:03:42 +02:00
Paul Chavard
08caa122dd Revert "Merge pull request #7280 from betagouv/move_type_de_champ_v2"
This reverts commit 08b90b9173, reversing
changes made to bc9a90bd08.
2022-05-11 20:03:33 +02:00
simon lehericey
df91fd1180 move_type_de_champ new style 2022-05-11 16:54:26 +02:00
simon lehericey
795513e093 spec: clean 2022-05-11 16:54:26 +02:00
simon lehericey
58c3b6b16a fix spec : datetime is present in more recent revision 2022-05-11 15:59:17 +02:00
simon lehericey
b6c2aa30f4 reorder the siblings after deletion 2022-05-11 15:59:17 +02:00
simon lehericey
6bf52b1f99 remove children shared between 2 revisions 2022-05-11 15:59:16 +02:00
simon lehericey
285f402483 spec: add test case 2022-05-11 15:59:16 +02:00
simon lehericey
b889d18217 spec: use children_of 2022-05-11 15:59:16 +02:00
Martin
bf277d4802 bug(export): expect dossiers_for_export not to include dossiers brouillon
fix(export.dossiers_for_export): add missing visible_by_administration
2022-05-10 16:09:12 +02:00
simon lehericey
d2509e7492 add procedure_revision children_of 2022-05-10 14:52:57 +02:00
simon lehericey
cb4c35e797 spec: add special case for repetition_type_de_champ 2022-05-06 12:37:59 +02:00
simon lehericey
45f5cd3f4a spec: split procedure creation 2022-05-06 12:37:59 +02:00
simon lehericey
02fc25af23 spec: more procedure creation split 2022-05-06 11:23:10 +02:00
simon lehericey
6d38a44f1f spec: be clear we talk about draft 2022-05-06 11:23:10 +02:00
simon lehericey
c1d0256687 spec: split procedure creation 2022-05-06 11:23:10 +02:00
simon lehericey
becdd4a0ed spec: refactor 2022-05-06 11:23:10 +02:00
simon lehericey
d33e7c8cab spec: another isolated type_de_champ_repetition 2022-05-06 10:34:40 +02:00
Martin
8a6c3bbec0 fixup! bug(type_de_champ.repetition): on repetition, when there is a TypeDeChamp::Commune, champs for export should contain 2 entries [one with commune (postal_code), the other for commune (code_insee)]. 2022-05-06 09:38:45 +02:00
Martin
b1340586de bug(type_de_champ.repetition): on repetition, when there is a TypeDeChamp::Commune, champs for export should contain 2 entries [one with commune (postal_code), the other for commune (code_insee)]. 2022-05-06 09:38:45 +02:00
Paul Chavard
4523c0590c fix(dossier): champs repetable in champs private 2022-05-04 15:57:25 +02:00
simon lehericey
35ae011b59 remove duplicate test case (see tdc_0) 2022-05-04 13:16:12 +02:00
simon lehericey
96eec7e566 refactor spec 2022-05-04 13:16:12 +02:00
simon lehericey
37e01ea399 re introduce revision_types_de_champ 2022-05-04 13:16:12 +02:00
simon lehericey
a2947751e2 add scope to query old admins 2022-05-03 12:14:02 +02:00
simon lehericey
ea361643be types_de_champ -> types_de_champs_public 2022-05-03 11:05:24 +02:00
Martin
be090a1bec feat(administrateur/procedure#create): allow admin to add a lien to the DPO, allow user to consult link to dpo. enhance spec on _procedure_footer.html
Update spec/views/users/_procedure_footer.html.haml_spec.rb

Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
2022-04-27 15:09:02 +02:00
Paul Chavard
23b60c87e9 fix(procedure): cloned procedure should not have auto_archive_on
fix #7149
2022-04-22 10:48:31 +02:00
simon lehericey
9fd5219751 fix sort in procedure presentation 2022-04-15 12:21:39 +02:00
simon lehericey
23707d6033 ignore file not found error when cloning procedure 2022-04-14 13:46:16 +02:00
Paul Chavard
83a8d87e95 i18n(procedure_presentation): translate fields 2022-04-14 11:38:01 +02:00
Paul Chavard
d14e132305 feat(export): add zip format support 2022-04-12 14:54:54 +02:00
Paul Chavard
90dd5bc9c5 fix(dossiers): dossier extend_conservation actually works 2022-04-08 13:40:28 +02:00
Paul Chavard
e82dc9c8b5 feat(exports): add ability to create exports with filters 2022-04-06 17:08:38 +02:00
simon lehericey
200e8680d5 add uniq index on attestation dossier_id 2022-04-05 15:43:21 +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
c07e0fc13e fix(Dossier.processed_in_month): ensure proper usage via method sig instead of defensive programming style 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
6da54936b7 refactor(procedure_presentation): use internal reference to instructeur 2022-04-05 09:42:23 +02:00
Paul Chavard
706c648be8 refactor(procedure): remove unused code 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
Kara Diaby
b2bcc34cfd tests 2022-03-31 15:48:18 +02:00
Pierre de La Morinerie
31bd05f835 models: inverse the direction of the User role associations 2022-03-22 07:58:44 +01:00
Pierre de La Morinerie
56edba37bc specs: make the ProcedurePresentation#sorted_ids test more robust
Before the Dossiers were already created in the correct order, so the
sorting wasn't really tested.
2022-03-22 07:58:44 +01:00
Paul Chavard
c60a8970f1 perf(dossier): memoize champ.sections on dossier 2022-03-11 00:15:53 +01:00
Paul Chavard
51d7fd6190 test(dossier): update spec to use visible_by_administration 2022-03-10 14:29:40 +01:00
Pierre de La Morinerie
087e438eb6 models: delete AdministrateursInstructeur when destroying Instructeur
By default, `has_and_belongs_to_many` properly deletes the record in
the join table.

However, as the association is declared manually with a
`has_many / through`, it doesn't delete the joined record automatically.

As we also lack a foreign-key contraint on the join table, that means
a dangling record remains in the join table.

To fix this, let's declare it a proper `has_and_belongs_to_many`
association, which will let the join record be deleted automatically
on destroy.
2022-03-02 11:26:53 +01:00
Pierre de La Morinerie
e32c9a9f94 models: don't attempt to format invalid phone numbers
This is a defensive-programming measure, because formatting an
invalid phone number may truncate some leading numbers.
2022-03-02 09:57:03 +00:00
Pierre de La Morinerie
f35d18cd5c models: stop truncating DROM phone numbers
Fix #6996
2022-03-02 09:57:03 +00:00
Pierre de La Morinerie
5150e33212 models: ensure DROM phone numbers are valid
They were accepted before, because they were 'possible' – but now
they are explicitely considered as valid.
2022-03-02 09:57:03 +00:00
Pierre de La Morinerie
71e1b6c973 models: delete AdministrateursProcedure when destroying Administrateur
By default, `has_and_belongs_to_many` properly deletes the record in
the join table.

However, as the association is declared manually with a
`has_many / through`, it doesn't delete the joined record automatically.

As we also lack a foreign-key contraint on the join table, that means
a dangling record remains in the join table.

To fix this, let's declare it a proper `has_and_belongs_to_many`
association, which will let the join record be deleted automatically
on destroy.
2022-03-01 16:58:04 +01:00
Paul Chavard
2d396fcfb7 feat(dossier): rebase dossiers en construction and en instruction 2022-02-18 17:08:38 +01:00
Paul Chavard
50f095a5c6 test(user): fix unstable spec 2022-02-17 14:45:53 +01:00
Paul Chavard
76b1b85fa7 fix(attestation_template): add revision diff support 2022-02-11 08:45:32 +01:00
Paul Chavard
e269077c40 refactor(attestation_template): cleanup relationships 2022-02-11 08:45:32 +01:00
Paul Chavard
88e80e9e32
Merge pull request #6901 from adullact/feature/6859-jwt-token-expiration
[API Entreprise] Ajout du support des jetons JWT sans clé d'expiration
2022-02-10 11:48:39 +01:00
Kara Diaby
24ff41d2c0 tests 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
François Vantomme
eba9a87123
refactor(API Entreprise): raise an error on blank token 2022-02-07 15:18:16 +01:00
Pierre de La Morinerie
e6cf07b810 stats: move date formatting out of the Stat model
Before this commit, the monthly dossiers count was serialized into the
Stat record using human-formatted dates, as:

```ruby
s.dossiers_in_the_last_4_months = {
  "octobre 2021"=>409592,
  "novembre 2021"=>497823,
  "décembre 2021"=>38170,
  "janvier 2022"=>0
}
```

Turns out the ordering of keys in a serialized hash is not guaranteed.
After a round-trip to the database, the keys will be wrongly sorted.

Instead we want to save raw Date objects, which will preserve the
ordering. The date formatting can be applied at display-time by the
controller.

Fix #6848
2022-02-02 14:13:53 +01:00
Pierre de La Morinerie
ca58e60dc0 validators: rename revisions namespace to types_de_champ 2022-02-01 12:37:16 +01:00
Pierre de La Morinerie
d680602c84 models: validate private types_de_champ 2022-02-01 12:37:16 +01:00
Pierre de La Morinerie
e8e37cce15 models: refactor the types_de_champ validators
Context: we want to validate public and private types_de_champ
separately.

Before we validated the whole revision (and then validators themselves
enumerated all champs, public and private).

Now we validate the actual public types_de_champ, which will let us
validate separately the private types_de_champ.
2022-02-01 12:37:16 +01:00
Paul Chavard
4e7733e571 Revert "feat(attestation): revise attestations"
This reverts commit e413872530.
2022-01-25 18:26:34 +01:00
Kara Diaby
c9f402aa5b tests 2022-01-25 11:46:05 +01:00
Martin
47fa95a577 feat(MonAvisEmbedValidator): allow mon avis button without title 2022-01-24 15:56:29 +01:00
Paul Chavard
e413872530 feat(attestation): revise attestations 2022-01-19 18:00:37 +01:00
Paul Chavard
c1cb89bb44 fix(revision): changed? conflicts with rails method 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
Kara Diaby
bdcb0ca0e9 tests 2022-01-12 15:49:38 +01:00
Paul Chavard
4e779f445d fix(instructeur): copy notifications settings from previous groupe instructeur
fix #6763
2021-12-23 13:55:25 +01:00
François Vantomme
14e0c68266 feat(api particulier): add MESRI field 2021-12-16 16:45:18 +01:00
maatinito
0a31c8bc79 refactor date_trunc queries using groupdate gem 2021-12-14 08:50:11 +01:00
Martin
4b2e858a1a fix(mon_avis_embed_validator): enhance regexp 2021-12-13 14:49:40 +01:00
Paul Chavard
c7b1dc7f87 fix(bulk_messages): destroy bulk messages with procedures 2021-12-09 16:16:40 +01:00
François Vantomme
6ab8ac0662 feat (api particulier): add Pole emploi field 2021-12-08 10:36:25 +01:00
François Vantomme
2110ef072c feat(api particulier): add DGFiP field 2021-12-07 11:03:05 +01:00
Paul Chavard
5e0f8a5816 task(type_de_champ): migrate type_de_champ parent_id 2021-12-06 21:45:54 +01:00
Paul Chavard
2ba05bfb4f fix(dossier): use depose_at instead of en_construction_at 2021-12-06 15:49:17 +01:00
Martin
a9413f9b12 feat(manager): add procedure_expires_when_termine_enabled to administrate 2021-12-06 07:49:59 +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
2dfbc70d41 feat(instructeur#dossiers_count_summary): add counter for expirants. ignore brouillon 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
Pierre de La Morinerie
b7d17b0989 models: validate that no drop-downs are empty on publishing
Disallow publishing a procedure containing drop-downs with no selectable
values.
2021-12-02 09:00:37 +01:00
François Vantomme
8fc14faa2a
fix(stat): enforce time travel when dealing with relative dates 2021-12-01 17:09:30 +01:00
Pierre de La Morinerie
99c77046d2 models: improve error message for invalid champs
Avoid prepending the message with 'Draft revision '
2021-11-30 13:34:41 +01:00
Pierre de La Morinerie
52b0fbf9b7 models: validate repetitions on publishing 2021-11-30 13:34:41 +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
970e43efb8 feat(stats#index): update Stat model to also query DossierDeleted in stats computation
tech(question): discard_and_keep_track! ; are we really keeping track with default_scope { kept } ?

feat(stats): add DeletedDossier in Stat computations

Revert "tech(question): discard_and_keep_track! ; are we really keeping track with default_scope { kept } ?"

This reverts commit d1155b7eeaaf1a9f80189e59667e109541fcb089.

feat(stats): support deleted_dossiers for last_four_months_hash and cumulative_hash. extract sanitize query & merge hashes in methdos

clean(rubocop): lint with rubocop

Update db/migrate/20211126080118_add_index_to_deleted_at_to_deleted_dossiers.rb

Co-authored-by: LeSim <mail@simon.lehericey.net>

fix(rubocop): avoid uneeded allocation

fix(migration): add concurrent index with expected synthax

fix(brakeman): add ignore message since group date_trunc evaluation is used by only ourself
2021-11-26 13:29:40 +01:00
Paul Chavard
d847775c68 feat(traitements): add depose_at to dossiers 2021-11-25 12:57:55 +03:00
Pierre de La Morinerie
e5f5440663 models: explicitely save procedure's new revision
Deep-cloned objects have all their relationships stale. Thus, for a
newly deep-cloned revision, `revision.types_de_champs` returns `[]`,
even when it actually has associated types de champ.

This causes consecutive champs creations and re-ordering to fail in
subtle ways, like:

```
procedure.draft_revision.add_type_de_champ(…)
procedure.publish_revision!
procedure.draft_revision.add_type_de_champ(…)
procedure.draft_revision.move_type_de_champ(…) # this will fail
```

As `publish_revision!` created a new stale revision, moving the type
de champ fails because not all existing champs are found until the
object is refreshed.

We don't hit this path in production, because usually only a single
operation is made in a request.

To fix this, save the new revision before associating it as the draft
procedure.

(Another option would be to `reload` the revision after creation, but
this seems better contained and matches the name of the method.)
2021-11-25 08:49:17 +01:00
mfo
e7d9d047fe
Merge branch 'main' into 6649-etq-usager-instructeur-rendre-la-suppression-plus-visible 2021-11-24 14:07:32 +01:00
Pierre de La Morinerie
970c3e4b2b specs: avoid executing business logic in Procedure factory
Calling business logic in a factory is a code-smell, because it
usually requires the object to be saved into database, and may have
unintended consequences when the business logic is changed.

Also, this allows to just build a published procedure, without saving it
to the database.
2021-11-23 08:07:07 +01:00
Pierre de La Morinerie
774ef00f8e specs: improve dossier_spec#build_default_individual 2021-11-23 08:07:07 +01:00
Pierre de La Morinerie
8d89ae366b specs: minor cleanups 2021-11-23 08:07:07 +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
mfo
1d174df2ec
Merge branch 'main' into 6624/etq-instructeur-je-souhaite-supprimer-des-messages-envoyes-par-erreur 2021-11-16 16:37:15 +01:00
Martin
8bbd77f89f refactor(mail.delay): use simplier implementation using after_action to prevent email delivery with delay 2021-11-16 15:12:05 +01:00
simon lehericey
e3c1e19424 include hidden dossier in merge 2021-11-15 23:14:41 +01:00
Martin
c68fa2d7f3 feat(Commentaire.notify_user): wait 5 minutes before sending email to user when instructor write a commentaire. leaving some space for instructor to destroy his message 2021-11-15 15:38:57 +01:00
Martin
5b72bdec7e fix(Commentaire.sent_by?): &.email compared to nil could sent by true when nil==nil, avoid this one 2021-11-15 12:01:56 +01: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
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
da49a6447f refactor(repetition): optimize and add a transaction around repetition add row 2021-10-28 14:54:33 +02:00
Paul Chavard
c4b93f8d4a fix(groupe_instructeur): unfollow dossiers when removed from groupe instructeur 2021-10-28 14:45:52 +02:00
simon lehericey
7935e42109 Add merge log 2021-10-28 14:39:13 +02:00
simon lehericey
3328c9a132 merge move invite as well 2021-10-28 14:39:13 +02:00
simon lehericey
f2ccb39912 merge destroys the old role and account 2021-10-28 14:39:13 +02:00
simon lehericey
c725999582 move merge method to user 2021-10-28 14:39:13 +02:00
Paul Chavard
1393b7b07b fix(rebase): fix repetition champ rebase 2021-10-28 13:27:53 +02:00
Pierre de La Morinerie
a2b91c8ec6 factories: cleanup Administrateur, Instructeur and Expert factories
This changes:

- avoids relying on application code to create mock objects,
- allows to build Administrateur or Instructeurs without saving them.
2021-10-26 12:03:30 +02:00
Pierre de La Morinerie
0ff95df221 specs: improve speed of phone_champ_spec
Re-use the same champ for each test. This is safe, and makes the test
go from 4s to 1s.
2021-10-26 12:03:30 +02:00
Pierre de La Morinerie
fccf75710a specs: avoid creating uneeded champs on geo_area
It makes the test much faster.
2021-10-26 12:03:30 +02:00
Paul Chavard
1561ea82f6 fix(transfer): manually nullify staled transfers references 2021-10-21 13:54:26 +02:00
Paul Chavard
2a3a9dd822 feat(revisions): rebase dossiers brouillons 2021-10-20 17:26:09 +02:00
Paul Chavard
67e98f79c9 feat(revisions): add stable_id to changes 2021-10-20 17:25:34 +02:00
simon lehericey
866df74706 merge admin 2021-10-19 16:12:42 +02:00
simon lehericey
f6879eba60 associate_user take a target email 2021-10-14 14:47:50 +02:00
simon lehericey
09f828a6a2 create_merge_token! 2021-10-14 14:47:50 +02:00
simon lehericey
34862f41e0 Add fci valid_for_merge 2021-10-14 14:47:50 +02:00
simon lehericey
6826bf03b0 Sign in with a user linked by france connect sub (openid)
instead of looking linked user by email because :

- follows FC recommendation to fetch ds account by openid
- the email is not a valid key as many user can share the same FCI email.

The following scenario is now working

A user A (email: 1@mail.com) uses FC to connect to DS
=> It is connected as 1@mail.com

Another user B (email: generic@mail.com) uses FC to connect
=> It is connected as generic@mail.com

The first user A change its FC email to generic@mail.com and connect to DS
=> It is still connected as 1@mail.com
2021-10-14 14:47:50 +02:00
simon lehericey
87de9e38c6 allow draft to be saved with invalid cnaf champ 2021-10-12 14:27:20 +02:00
simon lehericey
40d0cfcdc4 add champ validation 2021-10-12 14:27:20 +02:00
simon lehericey
c76d1043fa add cnaf champ 2021-10-12 14:27:20 +02:00
simon lehericey
7c65571fca add case when the old_expert or old_instructeur is nil 2021-10-12 11:04:06 +02:00
simon lehericey
ec8ccad465 typo 2021-10-12 11:03:34 +02:00
simon lehericey
d7e621d167 beef up the merge methods 2021-10-07 15:51:31 +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
simon lehericey
1000417bc9 update notifications_for_dossier used in dossier show 2021-10-05 12:05:43 +02:00
simon lehericey
65911b7680 update with_notifications dossiers scope (used in procedure index and show) 2021-10-05 12:05:43 +02:00
Ismael MOUSSA S
bdbb4deb87 ADD FILE_MAX_SIZE constant to set allow file size limit 2021-09-21 12:04:56 -05:00
simon lehericey
6c6205e188 a cloned procedure to a different admin does not keep api_particulier token and scopes 2021-09-16 09:30:11 +02:00
Pierre de La Morinerie
586f8ec543 models: improve password complexity specs 2021-09-09 09:40:39 -05:00
Paul Chavard
d6cbdf2a48 feat(dossier): add dossier transfer models 2021-09-08 14:39:46 +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
simon lehericey
367f508e2e linked_drop_down_list: empty primary => empty secondary 2021-09-07 10:09:18 +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
8f2e0660d3 add spec for dossier with commune 2021-08-19 08:04:47 +02:00
Christophe Robillard
e06f11f33f add code insee libelle for commune export 2021-08-19 08:04:47 +02:00
Christophe Robillard
4a6c22d6a6 export code insee for commune champ 2021-08-19 08:04:47 +02:00
simon lehericey
b29bae4707 a procedure has an encrypted api_particulier_token
Co-authored-by: François VANTOMME <akarzim@gmail.com>
2021-07-30 11:18:44 +02:00
kara Diaby
9c976c6b71 fixup! tests 2021-07-27 19:38:21 +02:00
Paul Chavard
64cfb4d64e Fix sort with revisions 2021-07-23 10:57:04 +02:00
Paul Chavard
388fb39eb5 Fix false positive blank champ warnings 2021-07-22 10:45:25 +02:00
Paul Chavard
ac0f50b488 Improuve champ blank check 2021-07-22 10:45:25 +02:00
Pierre de La Morinerie
32ab2f0a80 instructeur: limit the maximum size of a filter value
This prevents the URL from exceeding the max size, and
causing '414: Request-URI too large' errors.
2021-07-20 14:49:48 +02:00
Pierre de La Morinerie
40b3ea8ad6
Revert "Instructeurs : limitation de la valeur d'un filtre à 100 caractères" 2021-07-13 18:19:46 +02:00
Pierre de La Morinerie
3c8a88a660 instructeur: limit the maximum size of a filter value
This prevents the URL from exceeding the max size, and
causing '414: Request-URI too large' errors.
2021-07-08 16:17:22 +02:00
Christophe Robillard
bc07a875eb integrate a mininum weight for the average dossier weight
before this commit, the average dossier weight took account only pieces
justificatives. With this commit, we add a minimum weight for other
files included in an archive like pdf_export, log operations,
attachments added to traitements. This minimum weight is set arbitrary,
from the observation of some random procedures in production
2021-07-06 15:58:45 +02:00
Paul Chavard
0ca5e1abe2 Preview should reflect revision changes 2021-06-24 11:39:49 +02:00
Paul Chavard
8b2c2c6466 Handle carte layers changes 2021-06-24 11:39:49 +02:00
Paul Chavard
35eccb5630 Show separate blocks for types de champ and annotation changes 2021-06-23 09:40:07 +02:00
Paul Chavard
19195008e8 Expose removed types_de_champ in exports 2021-06-23 09:40:07 +02:00
simon lehericey
eadae7af6b show all available tdc for procedure presentation 2021-06-23 09:40:07 +02:00
Paul Chavard
8d49b5556a test revision changes 2021-06-23 09:40:07 +02:00
Paul Chavard
f238710044 Add last_month export 2021-06-23 09:23:10 +02:00
Christophe Robillard
7851d6b1cc archives: count archived dossiers 2021-06-18 08:59:13 +02:00
Pierre de La Morinerie
12d17bc245 spec: fix Timecop.freeze without Timecop.return
Time was frozen without being un-frozen at the end of the spec.

This caused a spec in `Procedure#publish_or_reopen!` to fail randomly.

Fixed by using the `Timecop.freeze do` form, which unfreezes after the
execution of the block.
2021-06-17 17:36:43 +02:00
Christophe Robillard
896190b91e return nil when no traitement time 2021-06-17 16:31:53 +02:00