Commit graph

158 commits

Author SHA1 Message Date
Paul Chavard
2971100081 fix(dossier): do not try to rebase if procedure is not published 2023-02-02 10:11:46 +01:00
Paul Chavard
fc31ef6da3 chore(dossier): move concern spec to concern folder 2023-02-02 10:11:29 +01:00
Paul Chavard
dcbe16603a fix(dossier): fix parser with dashes 2023-01-31 10:40:48 +01:00
Colin Darie
51c1736d00 refactor(conditional): extract in a ChampConditionalConcern with tests 2023-01-26 09:06:30 +01:00
Sébastien Carceles
68ddae7382
feat(demarche): prefilling stats (#8436)
* force json content type for POST / PATCH / PUT

* add specs about stats dossiers funnel

* new endpoint to render stats about a procedure
2023-01-20 13:28:02 +00:00
Sébastien Carceles
0046338e6a
fix(prefill): don't mark the dossier as prefilled when it's not (#8464)
A dossier should not be marked as prefilled when it's not, meaning
when no prefill params are given.
2023-01-19 10:51:56 +00:00
Paul Chavard
26e02c7173 fix(template): trix will transform double spaces in   2023-01-05 13:23:24 +01:00
Sébastien Carceles
20136b7ac8
feat(demarche): create and prefill a dossier with POST request (#8233)
* add base controller for public api

* add dossiers controller with basic checks

* create the dossier

* ensure content-type is json

* prefill dossier with given values

* mark a dossier as prefilled

When a dossier is prefilled, it's allowed not to have a user.

Plus, we add a secure token to the dossier, which we will need later to set a
user after sign in / sign up.

* set user as owner of an orphan prefilled dossier

When a visitor comes from the dossier_url answered by the public api,
the dossier is orphan:
- when the user is already authenticated: they become the owner
- when the user is not authenticated: they can sign in / sign up / france_connect
and then they become the owner

So here is the procedure:
- allow to sign in / sign up / france connect when user is unauthenticated
- set dossier ownership when the dossier is orphan
- check dossier ownership when the dossier is not
- redirect to brouillon path when user is signed in and owner

* mark the dossier as prefilled when it's prefilled
(even with a GET request, because it will be useful later on, for
exmample in order to cleanup the unused prefilled dossiers)

* system spec: prefilling dossier with post request
2023-01-03 14:46:10 +01:00
Paul Chavard
0b10c73bcf feat(prefill): allow to prefill private annotations 2022-12-26 22:14:17 +00:00
Martin
dd74834689 amelioration(attestation.et.mail): desactive les tags sur les champs conditionnés et informe l'usager que ca arrivera 2022-12-19 09:28:46 +01:00
Paul Chavard
59bdd4bd92 fix(tags): relax parser roules 2022-12-14 17:53:36 +01:00
sebastiencarceles
4e1dff0dce fix schema about prefilled default 2022-12-14 15:44:27 +01:00
sebastiencarceles
373e8aeadb review: validate prefilled champs only 2022-12-08 15:27:39 +01:00
sebastiencarceles
1e21a3d3e1 review: query the db only once 2022-12-08 15:27:39 +01:00
sebastiencarceles
ab30af5fe5 review: move Prefillable to concern directory 2022-12-08 15:27:39 +01:00
Paul Chavard
e6288c39f2 refactor(dossier): champs -> champs_public 2022-11-10 22:44:39 +00:00
Eric Leroy-Terquem
aca2775874 remove routee? method 2022-11-04 12:03:44 +01:00
Eric Leroy-Terquem
5578115acf update routee? method 2022-11-04 12:03:43 +01:00
Paul Chavard
f109220df3 fix(dossier): test for non breaking space replacement in champ label 2022-10-21 16:34:19 +02:00
Paul Chavard
f2e8dba8e4 fix(dossier): tag can contain non breaking space 2022-10-21 16:34:19 +02:00
Paul Chavard
d7c5dcf8bb fix(dossier): a tag can be preceded by a - 2022-10-21 16:06:32 +02:00
Paul Chavard
432c4690b5 feat(tags): replace regexp based parser with a parser combinator 2022-10-05 11:25:37 +02:00
Paul Chavard
a88390c6d3 refactor(types_de_champ): use new types_de_champ factory 2022-08-02 16:21:33 +02:00
Paul Chavard
4d48055158 feat(tags): expose used_type_de_champ_tags 2022-07-07 23:23:17 +02:00
simon lehericey
5ebaf59fdb parent_id -> parent_stable_id 2022-07-05 11:53:18 +02:00
Paul Chavard
a36672239d refactor(revision): rename find_or_clone_type_de_champ 2022-05-31 08:58:53 +02:00
simon lehericey
fd4d543b20 fix test 2022-05-18 15:18:17 +02:00
Paul Chavard
2ba05bfb4f fix(dossier): use depose_at instead of en_construction_at 2021-12-06 15:49:17 +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
Paul Chavard
da49a6447f refactor(repetition): optimize and add a transaction around repetition add row 2021-10-28 14:54:33 +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
Christophe Robillard
896190b91e return nil when no traitement time 2021-06-17 16:31:53 +02:00
Christophe Robillard
887c5cb4a9 correct rubocop offenses 2021-06-17 16:31:53 +02:00
Christophe Robillard
bdf2f47eb9 fix specs for procedure stats 2021-06-17 16:31:53 +02:00
Christophe Robillard
a8840faadb move stats methods to appropriate concern class 2021-06-17 16:31:53 +02:00
Paul Chavard
9b0dae4cc2 Fix apostrophes ‘ -> ’ 2021-05-26 18:05:14 +02:00
Paul Chavard
21ee79669d Better labels in test 2021-05-25 11:43:38 +02:00
Paul Chavard
179bb5a9fe Apply suggestions from code review
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
2021-05-25 11:43:38 +02:00
Paul Chavard
acb277e650 Use stable_id when replacing tags 2021-05-25 11:43:38 +02:00
clemkeirua
f3e487bd9e replace filter+first with find 2020-09-25 12:53:11 +00:00
Paul Chavard
1488e0964b update models specs to use revisions 2020-09-02 11:26:26 +02:00
Christophe Robillard
a072d35211 use traitement model
when a dossier is terminated (accepte, refuse or classe_sans_suite),
we store now `processed_at` and `motivation` in a traitement instance
2020-07-08 18:15:15 +02:00
Pierre de La Morinerie
43569f687e specs: use fixture_file_upload rather than Rack::Test::UploadedFile
This is mostly for consistency (both styles were used before).

Note: we still have to use `Rack::Test::UploadedFile.new` in factories,
because of https://github.com/thoughtbot/factory_bot/issues/385.
2020-07-01 11:13:45 +02:00
Pierre de La Morinerie
4cb747fdb6 specs: always require rails_helper
Test helpers are separated between two files: spec_helper and
rails_helper. This separation is meant to allow tests that do not
require Rails (like testing standalone libs) to boot faster.

The spec_helper file is always loaded, through `--require spec_helper`
in the `.rspec` config file. When needed, the rails_helper file is
expected to be required manually.

This is fine, but:
- Many test files have a redundant `require 'spec_helper'` line;
- Many test files should require `rails_helper`, but don't.

Not requiring `rails_helper` will cause the Rails-concerned section of
the test environment not to be configured–which may cause subtle bugs
(like the test database not being properly initialized).

Moreover, Spring loads all the Rails files on preloading anyway. So the
gains from using only `spec_helper` are thin.

To streamline this process, this commit:
- Configures `.rspec` to require `rails_helper` by default;
- Remove all manual requires to spec_helper or rails_helper.

Reference: https://stackoverflow.com/questions/24145329/how-is-spec-rails-helper-rb-different-from-spec-spec-helper-rb-do-i-need-it
2020-03-31 12:48:32 +02:00
clemkeirua
48d2093577 tag 'groupe instructeur' uniquement si la procedure est routee 2020-02-20 14:48:14 +00:00
clemkeirua
059d80ea34 #4785 ajout d'une balise 'groupe instructeur' 2020-02-20 14:48:14 +00:00
clemkeirua
57a0973c99 added a test to show #4658 does not exist 2020-02-03 15:43:53 +01:00
Pierre de La Morinerie
5fc88eb6a2 specs: fix a flaky repetitions test
The test would sometime fail when the two fields are created in a
different order than expected.
2019-10-24 16:52:29 +02:00
Paul Chavard
b97cbd3402 Serialize champ repetition for tags
closes #4272
2019-09-12 17:23:18 +02:00
Paul Chavard
3b8d3b7967 Add Style/CollectionMethods to rubocop 2019-09-12 14:48:18 +02:00
clemkeirua
7eeddc0b79 using a shared example + scoped to state TERMINE 2019-07-17 11:53:16 +02:00
clemkeirua
b8fa567c81 ajout du tag 'lien document justificatif' 2019-07-17 11:53:16 +02:00
Mathieu Magnin
10d3ba10f2 Before save copy body in rich_body 2019-07-03 13:15:49 +02:00
simon lehericey
ee296f2b44 Use default format for date and datetime champ 2019-06-12 17:48:12 +02:00
clemkeirua
d0794f42d1 fix tag_substitution_concern links for lien attestation 2019-05-07 08:54:29 +02:00
clemkeirua
c98655be52 ellipsis on file input overflow 2019-05-07 08:54:29 +02:00
clemkeirua
0e26bda186 cleanup the tag substitution concern & uniformization 2019-05-07 08:54:29 +02:00
clemkeirua
e4259466b4 nettoyage du tag_substitution_concern 2019-05-07 08:54:29 +02:00
clemkeirua
f8a2598647 ajout du lien vers le justificatif dans la balise --lien attestation-- 2019-05-07 08:54:29 +02:00
clemkeirua
747dc505cc ajout d'un test 2019-05-07 08:54:29 +02:00
Frederic Merizen
b428406fc7 [Fix #3578] No tags for champs that cannot have user input anyway 2019-03-11 10:26:27 +01:00
Frederic Merizen
1d0156f9c6 [#3572] Add tests 2019-03-08 18:32:35 +01:00
clemkeirua
71bff0812c ajout d'un test pour caractériser le cas service = null 2019-02-21 12:34:53 +01:00
clemkeirua
236f73f838 ajout d'une balise pour le nom du service 2019-02-21 12:18:44 +01:00
Frederic Merizen
a255e61556 [#3356] Improve formatting for menus that only have a primary value 2019-02-05 17:35:30 +01:00
Frederic Merizen
a3d7c8de55 [Fix #3356] Add tags for primary menu only / secondary menu only 2019-02-05 17:35:30 +01:00
gregoirenovel
5fa5f2aa37 Bump development gems
- rubocop (0.61.1 → 0.62.0)
2019-01-05 11:47:55 +01:00
simon lehericey
e684cec516 DateTime.new => Time.zone.local 2018-10-26 10:10:20 +00:00
simon lehericey
2238e5bd9f Time.now => Time.zone.now 2018-10-26 10:10:20 +00:00
Pierre de La Morinerie
0526551e71 templates: update link to dossier 2018-09-27 17:22:59 +02:00
gregoirenovel
0c9628c180 Fix some files according the the .editorconfig rules 2018-09-20 16:23:09 +02:00
gregoirenovel
a87e79ac1f Update a test to comply with Rubocop rules 2018-09-20 16:23:09 +02:00
gregoirenovel
00ecae5f93 Procédure → Démarche 2018-09-05 15:46:24 +02:00
gregoirenovel
4b071ecf06 Use enum to the fullest with Dossier.states 2018-08-29 17:31:08 +02:00
gregoirenovel
2d3b553e4d Use enum to the fullest with TypeDeChamp.type_champs 2018-08-29 17:31:08 +02:00
Paul Chavard
753a81c2d3 Update tag substitution concern 2018-05-24 17:54:51 +02:00
Frederic Merizen
84c864ed11 [#1563] Add lien attestation link to closed mail template 2018-04-04 09:34:04 +02:00
Paul Chavard
9cc6d494a4 Spec STI loading champ/type de champ 2018-03-29 17:45:19 +02:00
Frederic Merizen
13d251d970 describe '#method' rather than describe '.method' for instance methods 2018-03-20 16:00:30 +01:00
Mathieu Magnin
b7de632d6c [Fix #1479] Create a sanitize email concern 2018-03-14 17:41:45 +01:00
gregoirenovel
e26f4148ff Bump development gems
- brakeman
- rubocop
- scss_lint
2018-03-06 16:17:22 +01:00
gregoirenovel
fe7f8da636 Revert "Bump development gems"
This reverts commit d6ad3fc3fd.
2018-03-06 15:11:26 +01:00
gregoirenovel
d6ad3fc3fd Bump development gems
- brakeman
- rubocop
- scss_lint
2018-03-06 10:36:35 +01:00
gregoirenovel
1b8b6a3274 TPS -> demarches-simplifiees.fr 2018-02-28 18:14:06 +01:00
Paul Chavard
0c1d529b61 Unify :type_de_champ public/private factories 2018-02-14 11:49:06 +01:00
Mathieu Magnin
dcb38d79a3 [Fix #1309] Datetime value should be print with yyyy-mm-dd format 2018-01-30 13:49:16 +01:00
Frederic Merizen
9b4ce1517c Use lambda instead of send for etablissement tag 2018-01-18 18:35:07 +01:00
Frederic Merizen
8f41ab89cf [#1203] Do not include champs privés in accusé de réception 2018-01-18 18:26:14 +01:00
Frederic Merizen
eebab14954 [Fix #1203] No début d’instruction tag in accusé de réception mails
Doesn’t make sense functionnally
2018-01-18 18:26:14 +01:00
Frederic Merizen
9f7ffddb31 [#1203] Allow filtering tags based on an arbitray status 2018-01-18 18:26:14 +01:00
Frederic Merizen
1282fc2113 [#1203] Use factory girl to instanciate model in spec 2018-01-18 18:26:14 +01:00
gregoirenovel
897a30da0c Enable the Layout/SpaceInsideBlockBraces cop 2018-01-18 10:53:34 +01:00
gregoirenovel
1e71188d4d Enable the Layout/IndentationConsistency cop 2018-01-15 22:33:13 +01:00
gregoirenovel
08ed400ec2 Enable the Layout/FirstArrayElementLineBreak cop 2018-01-15 22:14:38 +01:00
Frederic Merizen
56749769d6 [Fix #1186] Rename object to subject for mail templates 2018-01-09 16:00:31 +01:00
Frederic Merizen
7f040a5cf8 [Fix #1037] Add date tags to mail / attestation templates
- date de dépôt
- date de passage en instruction
2018-01-09 11:30:54 +01:00
Frederic Merizen
75a3d0f3db [#1110] use modern rather than legacy tags in default mail templates 2018-01-05 17:42:25 +01:00
Frederic Merizen
ab63f80080 [#1110] Motivation and date de décision are only tags for terminé dossiers 2018-01-05 16:35:29 +01:00
Frederic Merizen
8d77cd58c6 [#1110] Make linked procedure available to mail model 2018-01-05 12:48:07 +01:00
Frederic Merizen
ad0462f7ff [#1110] Port libellé procédure tag from mail templates 2018-01-05 11:51:08 +01:00