Commit graph

205 commits

Author SHA1 Message Date
Christophe Robillard
0ec4c3d17b migrate attestation fiscale adapter to v4 2023-05-29 15:22:07 +02:00
krichtof
0051face93
Merge pull request #9014 from demarches-simplifiees/8859-default_zones
Etq admin, lors de la création ou modification d'une démarche, des zones par défaut me sont suggérées
2023-05-26 17:25:21 +00:00
Christophe Robillard
76a8b721ce add tva adapter and tva job 2023-05-26 13:37:20 +02:00
Christophe Robillard
f04e121a6f add extrait_kbis to handle nom_commercial and capital_social 2023-05-26 13:37:20 +02:00
Christophe Robillard
ba281d53cf migrate entreprise adapter to v3 2023-05-26 13:37:20 +02:00
Christophe Robillard
247ad49ab7 migrate attestation_sociale to v4 2023-05-24 11:52:43 +02:00
Christophe Robillard
ca922005f9 add admin update default zones job 2023-05-16 09:40:53 +02:00
Colin Darie
f6ebfe0e47
fix(dossier): sync search_terms after merge
Use a job instead of a lot of reloads
2023-05-09 18:49:52 +02:00
Paul Chavard
1d10e59e63 fix(commune): fix ‘undefined’ departement codes 2023-04-27 12:07:43 +02:00
Martin
9dec6f1611 correctif(procedure.declarative): ETQ administrateur d'une procedure declarative, certains de mes dossiers restent en construction [ex: l'object storage est down, le dossier reste bloqué] 2023-04-21 15:45:45 +02:00
Paul Chavard
a6e3ea4839 fix(dossier): normalize champs commune data 2023-04-07 16:02:13 +02:00
Colin Darie
43613009d6
fix(job): Cron::WeeklyOverviewJob simplified and respect dolist API rate limiting 2023-03-06 14:39:55 +01:00
krichtof
5840c8c7f9
Merge pull request #8711 from demarches-simplifiees/8708-demarches-publiques
Ne pas publier le descriptif de toutes les procedures sur datagouv
2023-03-01 10:09:47 +00:00
Christophe Robillard
9ff88db48c publish only some opendata procedures for datagouv
- only published or closed procedures
- only procedures with flag opendata
- only procedures with 4 or more dossiers
- only procedures without word "mail" in lien_site_web
- only procedures without word "intra" in lien_site_web
2023-02-28 17:02:08 +01:00
sebastiencarceles
f52554b5a3 review: update value with async fetch
1 - spec cover the job which fetches external data

2 - refactor the job with guard clauses

3 - delegate update operation to the champ itself

4 - annuaire education: override the update operation
to let the value be populated by the fetched data

5 - prefilling: don't fetch data synchronously
2023-02-28 14:53:08 +01:00
Martin
f4cc8078b4 amelioration(EmailEvent): purge les email_events vieux de plus de un mois
Update app/models/email_event.rb

Co-authored-by: Colin Darie <colin@darie.eu>

Update app/jobs/cron/purge_old_email_event_job.rb

Co-authored-by: Colin Darie <colin@darie.eu>
2023-02-06 10:35:57 +01:00
Lisa Durand
120fbb0ef7 Overload the finished_at 2023-02-01 17:06:04 +01:00
Lisa Durand
d0a131dc55 change the way we set the finished_at on batch operation job to fix alert display bug 2023-02-01 17:06:04 +01:00
Damien Le Thiec
3a8a50a216
Allow prefill pays type de champs (#8344)
* Allow prefill pays type de champs

* Avoid conditional prefil params for pays champ

* Clean pays data with batch update

* Fix bug and add test batch update pays value

* Improve performance batch_update_pays

* Fix associated country code problem

* Fix after party task name

* Format country name if needed in batch update
2023-01-18 12:52:38 +01:00
Colin Darie
784b0458fe feat(dolist): consolidate dispatched events with delivered emails 2023-01-18 09:56:40 +01:00
Martin
0aba708b34 correctif(spec): associe le dossier suivis a l'instructeur du batch operation. sinon c'est un autre instructeur qui est crée 2023-01-16 11:14:29 +01:00
Lisa Durand
db3085fa33 design : make filter buttons tertiary and dropdown secondary 2023-01-16 11:14:29 +01:00
Lisa Durand
06c6a4ab0c add action 'unfollow' to page 'suivis' 2023-01-16 11:14:29 +01:00
Lisa Durand
2f666b487e add action 'repasser en construction' to page 'suivis' 2023-01-16 11:14:29 +01:00
Damien Le Thiec
5e26acb0e1
Make date and datetime prefillable (#8304)
* Make date and datetime prefillable

* Format in ISO8601 format
2023-01-12 17:42:02 +01:00
Lisa Durand
25a7fa5a34 add bulk action 'follow' 2023-01-09 11:58:51 +01:00
Martin
018a94f43b correctif(batch_operation): empeche de changer l'etat d'un dossier en cas d'erreur. et s'assure de delinker le dossier en cas de dossier invalid 2023-01-05 16:20:18 +01:00
Lisa Durand
59468fe351 add justificatif_motivation field to batch operation accepter 2023-01-05 16:20:18 +01:00
Lisa Durand
1bc0609543 add motivation field to batch operation accepter 2023-01-05 16:20:18 +01:00
Lisa Durand
d7ebb67889 implement first step - accepte without motivation and PJ 2023-01-05 16:20:18 +01:00
Paul Chavard
378f3c5fb0 use join table instead of arrays 2023-01-05 16:20:18 +01:00
Paul Chavard
c4a30084fe refactor(virus_scan): remove lock 2023-01-04 12:12:11 +01:00
Paul Chavard
6e18090fb3 refactor(virus_scan_result): use column instead of metadata on blob 2023-01-04 12:12:11 +01:00
Christophe Robillard
edffd0a7a8 extract ds_opendata_enabled 2022-12-20 12:52:56 +01:00
Christophe Robillard
daa4411abe Revert "unschedule export demarches opendata"
This reverts commit da0738c661.
`ExportAndPublishDemarchesPubliqjesJob` is now schedulable
2022-12-20 12:52:56 +01:00
Lisa Durand
eea42aad6b fix linter 2022-12-15 10:04:25 +01:00
Lisa Durand
89730b485b add bulk action feature for 'passer_en_instruction' 2022-12-15 10:04:25 +01:00
Paul Chavard
243a8301bb fix(dossier): authorize passage en instruction if auto archive is on and is in the past 2022-12-14 22:16:13 +01:00
Paul Chavard
ed4d5cb36a refactor(demarche): make declarative demarche processing syncroneous 2022-12-06 11:41:25 +01:00
Martin
eaf72162da poc(batch_operation): some rewrite to avoid various conflict (when an instructeur try to create a job with an incompatible dossier regarding the current task). also soome cleanup to isole spec in least involved model 2022-12-06 11:28:48 +01:00
Martin
4266ab93c5 poc(batch_operation): track dossier processed safely 2022-12-06 11:28:48 +01:00
Martin
7df86c50fb poc(batch_operations_controller): implement simple [not yet with procedure_presentation] action to create a batch operation 2022-12-06 11:28:48 +01:00
Martin
b11dbafc59 poc(batch_operation_job): implement archive dossiers with async behaviour, lock, run_at, finished_at, failed_dossier_ids, success_dossier_ids 2022-12-06 11:28:48 +01:00
Kara Diaby
4d6ff768c4 Ajoute les dossiers déposés dans les statistiques Datagouv 2022-11-03 10:24:04 +01:00
Christophe Robillard
da0738c661 unschedule export demarches opendata 2022-09-30 07:26:48 +02:00
Martin
d9432ccd3b fix(etablissement.as_degraded_mode): backfill missing data via a cron 2022-09-23 15:12:25 +02:00
Colin Darie
6a4a9c8e03 fix(cron/procedure-declarative): don't auto accept a dossier still in degraded mode 2022-09-22 16:26:14 +02:00
Colin Darie
67cbc61e1e chore(services): update etablissement adresse & geocode when siret changes 2022-09-06 09:23:52 +02:00
Kara Diaby
058d6baae6 tests 2022-07-29 11:17:22 +02:00
Colin Darie
f05e9331a7 chore(entreprises): save etat_administratif from API 2022-07-25 10:58:02 +02:00
Martin
3e56fdd1d7 fix(export): when it takes more than 3 hours, exports are purge before being generated. make it possible to have an export that takes more than 3 hours and share this behaviour with kind of same class archive 2022-07-25 10:48:54 +02:00
Christophe Robillard
0e3e6eb62a add schedulable? class method to cron jobs 2022-07-21 21:54:15 +02:00
Christophe Robillard
bed6167010 use specific namespace for datagouv cron jobs 2022-07-21 21:54:15 +02:00
Christophe Robillard
b6c96301ef export and publish opendata demarches 2022-07-21 21:54:15 +02:00
Martin
7fb85c97cb feat(Administrateur::ArchivesControllers): add archives #index and #create for admin 2022-07-04 14:18:46 +02:00
Martin
ab04369c06 bug(DeclarativeProceduresJob.perform_now): fail all next procedure on one dossier failure 2022-06-10 14:59:36 +02:00
Christophe Robillard
f14cd7b022 remove warning mail for dubious procedures 2022-05-25 14:44:53 +02:00
Paul Chavard
cf8c084a59 refactor: extract download_and_zip in to a shared service 2022-04-12 14:54:54 +02:00
Martin
dbcf21a555 feat(archive): extract archive status management within job to simplify the main service as well as to isolate this part for a merge with exports csv/xslx [maybe?]
Update app/dashboards/archive_dashboard.rb

Co-authored-by: LeSim <mail@simon.lehericey.net>
2022-03-31 13:35:49 +02:00
Paul Chavard
51d7fd6190 test(dossier): update spec to use 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
24ff41d2c0 tests 2022-02-09 14:43:36 +01:00
Paul Chavard
0268511264 fix(manager): remove admins added for a day
fix #6855
2022-02-08 11:18:44 +01:00
Pierre de La Morinerie
8d89ae366b specs: minor cleanups 2021-11-23 08:07:07 +01:00
kara Diaby
1b27ab5aff tests 2021-11-05 13:32:21 +01:00
Paul Chavard
1888f74b10 Prevent double processing of declarative dossiers 2021-06-04 17:55:40 +02:00
François Vantomme
99ce5195bc Fix (API Entreprise): test fails randomly
Don't assume array order, just check that all values are present
2021-05-07 17:42:15 +02:00
Pierre de La Morinerie
fbfe5c3817 jobs: also retry native ActiveStorage's jobs on transient errors 2021-04-29 14:08:12 +02:00
Pierre de La Morinerie
684af77e35 jobs: extract an RetryOnTranscientErrors concern 2021-04-29 14:08:12 +02:00
simon lehericey
d552e364fc retry 5 times on integrity error and then block processing 2021-04-06 18:03:39 +02: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
96a832bc19 Add SerializerService 2021-03-02 12:42:22 +01:00
Pierre de La Morinerie
150ddab660 zeitwerk: Api -> API 2021-02-09 13:07:30 +01:00
Paul Chavard
a591d5528e Add job exception log methods to champ and dossier 2021-02-05 18:56:27 +01:00
Paul Chavard
41c3a98d7d Update Raven references to use Sentry 2021-01-28 19:46:36 +01:00
simon lehericey
650a598698 ensure a buggy procedure does not block the others from being closed 2021-01-19 10:42:16 +01:00
simon lehericey
5bc4fab0c4 exhaustive test of discarded_dossier_deletion_job 2020-12-16 15:00:26 +01:00
kara Diaby
c7643154d1 final optims after sim review 2020-12-16 15:00:26 +01:00
kara Diaby
f3c4040d2d add grace period to deleted dossiers 2020-12-16 15:00:26 +01:00
kara Diaby
f748ccfc9e Appelle l'API entreprise avec le token en Header 2020-12-10 17:49:49 +01:00
clemkeirua
513d4f6ff1 move all the cron jobs in a dedicated directory 2020-12-08 13:22:43 +00:00
simon lehericey
b187244a29 extract and refactor api errors 2020-12-04 17:07:30 +01:00
simon lehericey
05e9130634 refator test 2020-12-03 11:52:01 +01:00
simon lehericey
f56235c7ee retry exponentially on api entreprise timeout 2020-12-03 11:52:01 +01:00
simon lehericey
9eab310565 [#5675] for all api entreprise job, retry on 502, 503 2020-12-02 18:25:31 +01:00
simon lehericey
c563956a9f retry each day during 5 days to fetch attestation social 2020-10-28 15:53:58 +00:00
clemkeirua
245e9e59c7 do not run ApiEntreprise jobs on missing etablissements 2020-09-28 17:36:38 +02:00
simon lehericey
86b04d4275 Add a missing test on job retry to the excon err 2020-09-09 09:08:48 +00:00
Paul Chavard
d1e0b65658 update jobs specs to use revisions 2020-09-02 11:26:26 +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
Paul Chavard
bb5a90da76 fix active_revision_id -> active_revision.id 2020-07-23 15:07:25 +02:00
Pierre de La Morinerie
7a67f1a802 jobs: ignore missing blob during virus scan
We currently have many failed VirusScannerJob enqueued, because the
underlying blob is missing.

This PR fixes the issue by discarding the job in those cases (because if
the blob is gone, the job is never going to succeed).

The implementation is based on a similar issue encoutered by the
ActiveStorage::AnalyzeJob. See 06f8baf73c
2020-07-13 14:35:41 +02:00
Pierre de La Morinerie
b82c269cef specs: test de-serialization of job arguments
When the job is invoked directly, the serialization and de-serialization
of the job arguments is not actually tested.

Using `perform_later` inside a `perform_enqueued_jobs` allows to
exercise the serialization.
2020-07-13 14:31:28 +02:00
Christophe Robillard
954d41ce4e fetch effectifs mensuels for may month 2020-06-24 10:23:00 +02:00
Christophe Robillard
8df9ae3a8d ask only effectifs for april 2020-06-10 17:41:13 +02:00
Christophe Robillard
f4ebb5d107 create api_entreprise jobs 2020-05-20 11:09:54 +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
Paul Chavard
742cc15209 Use base CronJob 2020-03-31 12:25:46 +02:00
Paul Chavard
33bf2fe109 remove deprecated AutoReceiveDossiersForProcedureJob 2020-03-31 12:25:46 +02:00
Paul Chavard
5b5ae5a7a5 Do not send notifications or create operation logs on brouillon demarches 2020-03-25 15:04:52 +01:00