Skip to content

Commit

Permalink
chore(soliguide): remove bad se-presenter
Browse files Browse the repository at this point in the history
When address is missing.
  • Loading branch information
vmttn committed Sep 27, 2024
1 parent b9cac0c commit 4560db2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ WITH lieux AS (

final AS (
SELECT
lieu_id AS "id",
_di_source_id AS "source",
position__coordinates__x AS "longitude",
position__coordinates__y AS "latitude",
position__additional_information AS "complement_adresse",
position__city AS "commune",
lieu_id AS "id",
_di_source_id AS "source",
position__coordinates__x AS "longitude",
position__coordinates__y AS "latitude",
position__additional_information AS "complement_adresse",
position__city AS "commune",
NULLIF(BTRIM(REGEXP_REPLACE(position__address, ', \d\d\d\d\d.*$', ''), ','), '') AS "adresse",
position__postal_code AS "code_postal",
position__postal_code AS "code_postal",
-- TODO: use position__city_code
-- currently the field contains a majority of postal codes...
-- update(2024-08-07) : this is still the case.
NULL AS "code_insee"
NULL AS "code_insee"
FROM lieux
ORDER BY 1
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,26 @@ final AS (
THEN UDF_SOLIGUIDE__NEW_HOURS_TO_OSM_OPENING_HOURS(open_services.hours)
ELSE UDF_SOLIGUIDE__NEW_HOURS_TO_OSM_OPENING_HOURS(lieux.newhours)
END AS "recurrence",
ARRAY(
SELECT DISTINCT m
FROM
UNNEST(
ARRAY_REMOVE(
CASE WHEN open_services.modalities__inconditionnel THEN ARRAY['telephoner'] END
|| CASE WHEN open_services.modalities__appointment__checked THEN ARRAY['telephoner', 'envoyer-un-mail'] END
|| CASE WHEN open_services.modalities__inscription__checked THEN ARRAY['telephoner', 'envoyer-un-mail'] END
|| CASE WHEN open_services.modalities__orientation__checked THEN ARRAY['telephoner', 'envoyer-un-mail', 'envoyer-un-mail-avec-une-fiche-de-prescription'] END,
NULL
)
) AS m
ARRAY_REMOVE(
ARRAY[
CASE
WHEN
open_services.modalities__inconditionnel
OR open_services.modalities__appointment__checked
OR open_services.modalities__inscription__checked
OR open_services.modalities__orientation__checked
THEN 'telephoner'
END,
CASE
WHEN
open_services.modalities__appointment__checked
OR open_services.modalities__inscription__checked
OR open_services.modalities__orientation__checked
THEN 'envoyer-un-mail'
END,
CASE WHEN open_services.modalities__orientation__checked THEN 'envoyer-un-mail-avec-une-fiche-de-prescription' END
],
NULL
) AS "modes_orientation_accompagnateur",
ARRAY_TO_STRING(
ARRAY[
Expand All @@ -175,18 +183,14 @@ final AS (
],
E'\n\n'
) AS "modes_orientation_accompagnateur_autres",
ARRAY(
SELECT DISTINCT m
FROM
UNNEST(
ARRAY_REMOVE(
CASE WHEN open_services.modalities__inconditionnel THEN ARRAY['se-presenter'] END
|| CASE WHEN open_services.modalities__appointment__checked THEN ARRAY['telephoner', 'envoyer-un-mail'] END
|| CASE WHEN open_services.modalities__inscription__checked THEN ARRAY['se-presenter', 'telephoner'] END
|| CASE WHEN open_services.modalities__orientation__checked THEN ARRAY['autre'] END,
NULL
)
) AS m
ARRAY_REMOVE(
ARRAY[
CASE WHEN (open_services.modalities__inconditionnel OR open_services.modalities__inscription__checked) AND lieux.position__address IS NOT NULL THEN 'se-presenter' END,
CASE WHEN open_services.modalities__appointment__checked OR open_services.modalities__inscription__checked THEN 'telephoner' END,
CASE WHEN open_services.modalities__appointment__checked THEN 'envoyer-un-mail' END,
CASE WHEN open_services.modalities__orientation__checked THEN 'autre' END
],
NULL
) AS "modes_orientation_beneficiaire",
ARRAY_TO_STRING(
ARRAY[
Expand Down

0 comments on commit 4560db2

Please sign in to comment.