Commit graph

11184 commits

Author SHA1 Message Date
Pierre de La Morinerie
be0e71c6c2
Merge pull request #5398 from betagouv/belongs-to-required-by-default
Rails : les relations `belongs_to` sont maintenant requises par défaut. (Pour une relation optionnelle, mentionner explicitement `belongs_to :table, optional: true`)
2020-08-18 17:43:32 +02:00
Pierre de La Morinerie
d77efec7a0 config: enable active_record.belongs_to_required_by_default 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
a7361fdbd3 models: require belong_to associations on mail templates 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
29e8c43e5e models: require belong_to associations on groupe_instructeur 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
5a7bd24fba models: require belong_to associations on type_de_champ
- Make `type_de_champ.procedure` a requirement;
- Move the procedure_id assignation to `before_validation` (otherwise
the record is invalid, and never gets saved);
2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
6328011f60 models: require belong_to associations on champ
- Make `champ.dossier` a requirement;
- Move the dossier_id assignation to `before_validation` (otherwise
the record is invalid, and never gets saved);
- Allow specs to only build the champ (instead of saving it to the
database), which bypasses the requirement to have a dossier.
2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
eb22dc9d8f models: require belong_to associations on module_api_carto 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
71d9774d58 models: require belong_to associations on trusted_device_token 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
d807700c7b models: require belong_to associations on traitement 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
059c147ffc models: require belong_to associations on service 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
ce53e219e0 models: require belong_to associations on procedure_presentation
Some tests are still failing
2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
802d3804f5 models: require belong_to associations on invite 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
fe8804f208 models: require belong_to associations on individual 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
afb1c33154 models: require belong_to associations on geo_area 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
aff2713032 models: require belong_to associations on follow 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
91619b16e8 models: require belong_to associations on feedback 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
79fcf5e814 models: require belong_to associations on exercice 2020-08-18 15:57:36 +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
01248022bf models: require belong_to associations on deleted_dossier 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
dd1bed9340 models: require belong_to associations on commentaire 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
32e55a6d37 models: require belong_to associations on avis 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
aefdd5d2a1 models: require belong_to associations on attestation_template 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
1ea4c2aa36 models: require belong_to associations on attestation 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
c1e2928ce7 models: require belong_to associations on assign_to 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
11456109c0 models: explicitly mark optional belongs_to relationship as so
This prepares making the `belongs_to` relationship required by default.
2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
31dfdbf993
Merge pull request #5475 from betagouv/api-entreprise-raise
Sauvegarder un établissement invalide remonte maintenant une erreur
2020-08-18 15:07:40 +02:00
Pierre de La Morinerie
7d4c748432 services: make etablissement save raise on error
Before, if saving the etablissement failed, the error would be ignored silently.
2020-08-18 14:56:40 +02:00
Pierre de La Morinerie
889bd31de0
Merge pull request #5451 from betagouv/cleanup-load-paths
Rails : mise à jour des chemins de chargement par défaut
2020-08-18 11:28:49 +02:00
Pierre de La Morinerie
ededf5c6c5 config: don't explicitely eager-load lib/
Rationale:

- `lib/` is supposed to contain code mostly independant from Rails;
- By default, Rails doesn't eager-load `lib/` anymore (this used to be
the case, but since a few releases).

If this commits triggers some errors, then these errors should be fixed
(rather that `lib/` being added again to the load path).
2020-08-18 11:02:09 +02:00
Pierre de La Morinerie
c514898b84 config: don't explicitely eager-load controllers/concerns
Per the documentation, Rails automatically loads `**/concerns` paths.

See https://guides.rubyonrails.org/autoloading_and_reloading_constants_classic_mode.html#autoload-paths-and-eager-load-paths
2020-08-18 11:02:09 +02:00
Pierre de La Morinerie
4f0d9afbd6
Merge pull request #5479 from betagouv/improve-factories
Amélioration mineures des factories
2020-08-13 18:19:04 +02:00
Pierre de La Morinerie
df2429d7ad factories: build type_de_champ instead of creating them
This allows to minimize the number of actual creations when only a
build is requested.
2020-08-13 17:39:49 +02:00
Pierre de La Morinerie
c8ec5c8846 factories: remove the Rubocop workaround 2020-08-13 17:39:49 +02:00
Pierre de La Morinerie
e523827213
Merge pull request #5476 from betagouv/fix-new-revision-spec
Les révisions d'une démarche sont renvoyées dans un ordre déterministe
2020-08-13 17:39:31 +02:00
Pierre de La Morinerie
c01d640997 models: return procedure revisions in deterministic order
Fixes a randomly-failing spec in spec/models/procedure_revision_spec.rb.
2020-08-13 17:27:37 +02:00
Kara Diaby
378fd508b4
Merge pull request #5480 from tchak/fix-geo-areas
improuve fix geo areas geometry task
2020-08-13 17:09:55 +02:00
Paul Chavard
5ad31518dc improuve fix geo areas geometry task 2020-08-13 16:00:17 +01:00
Pierre de La Morinerie
b9b0bc40b7
Merge pull request #5477 from betagouv/datetime_starts_pastyear
Usager : réduit l'amplitude des champs "Date et heure" de `1950 → 2100` à `L’année précédente → L’année actuelle + 50 ans`
2020-08-13 15:50:26 +02:00
Judith
bfabd3b6a5 Specs adapted 2020-08-13 13:41:45 +00:00
Judith
c27b2da90b datetime type de champ: changed the years range from [1950;2100] to [to current year - 1;
current year + 50] (or [entered_date; current_year + 50] if old date already entered) because:
The type_de_champ Datetime is used for close future dates and very close past dates (for accident declaration for ex.)
The select currently has a range from 1950 to 2100, so 70+ years not supposed to be used, leading to:
- many bad data entered (0000 or 1950 to not scroll)
- making it difficult for users to give the proper date (current date is lost in the middle of 149 others) so risk to be lazy and select a random one or genuinely make a mistake
2020-08-13 13:41:45 +00:00
Kara Diaby
fb28bdaa15
Merge pull request #5478 from tchak/fix-geo-areas
Fix geo areas with GeometryCollection or MultiPolygon
2020-08-13 14:10:14 +02:00
Paul Chavard
970aa627d2 Fix geo areas with GeometryCollection or MultiPolygon 2020-08-13 12:50:35 +01:00
LeSim
e4615490fe
Merge pull request #5473 from betagouv/externalize_deploy_target
Remove host references from public sources
2020-08-12 17:20:05 +02:00
simon lehericey
15d967439e Remove host references from public sources 2020-08-12 15:10:08 +00:00
Pierre de La Morinerie
93fb04cc36
Merge pull request #5474 from betagouv/dependabot/bundler/chartkick-3.4.0
Bump chartkick de la version 3.3.1 à 3.4.0
2020-08-12 17:09:01 +02:00
dependabot[bot]
78924d3e78
Bump chartkick from 3.3.1 to 3.4.0
Bumps [chartkick](https://github.com/ankane/chartkick) from 3.3.1 to 3.4.0.
- [Release notes](https://github.com/ankane/chartkick/releases)
- [Changelog](https://github.com/ankane/chartkick/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ankane/chartkick/compare/v3.3.1...v3.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-12 14:52:35 +00:00
krichtof
621012c33b
Merge pull request #5471 from betagouv/fix-tmpjob-dossierlastupdated
transform job in task for set dossiers_last_updated_at
2020-08-12 16:18:47 +02:00
Christophe Robillard
f2dcb61521 transform job in task for set dossiers_last_updated_at 2020-08-12 16:10:15 +02:00
Pierre de La Morinerie
5d3968a304
Merge pull request #5459 from betagouv/remove-ignored-columns
Suppression des colonnes précédemment retirées de la base de donnée
2020-08-12 12:18:18 +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