Commit 03f4beac authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

[FIX] Correction de la vue v_situ_depot_vc_valid_pres : calcul erroné de...

[FIX] Correction de la vue v_situ_depot_vc_valid_pres : calcul erroné de l'existence d'une validation.
parent eb97c333
Loading
Loading
Loading
Loading
+1 −0
Changes for CHANGELOG.md: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ Journal des modifications
- [FIX] Module Soutenance : lorsque plusieurs propositions de soutenances étaient enregistrées en BDD, ce n'était pas forcément la bonne qui était récupérée
- [FIX] Rôles HDR affichés à tort sur la fiche d'un établissement
- [FIX] Ajout d'un CED impossible
- [FIX] Correction de la vue v_situ_depot_vc_valid_pres : calcul erroné de l'existence d'une validation.

10.0.1
-----
+35 −0
Changes for doc/release-notes/v10/10.1.0/03_these.sql.sql: 35 added lines, 0 removed lines.
Original line number Diff line number Diff line
--
-- v10.1.0
--

-- Correction de la vue v_situ_depot_vc_valid_pres : calcul erroné de l'existence d'une validation.

create or replace view v_situ_depot_vc_valid_pres(id, these_id, individu_id, valide) as
WITH validations_attendues AS (
    SELECT a.these_id,
           a.individu_id,
           tv.id AS type_validation_id
    FROM acteur_these a
             JOIN role r ON a.role_id = r.id AND r.code::text = 'P'::text
             JOIN type_validation tv ON tv.code::text = 'CORRECTION_THESE'::text
    WHERE a.histo_destruction IS NULL
), validations_dt_existantes AS (
    SELECT DISTINCT vt.these_id,
                    vt.individu_id,
                    tv.id AS type_validation_id
    FROM validation_these vt
             join validation v on v.id = vt.validation_id and v.histo_destruction is null
             JOIN type_validation tv ON v.type_validation_id = tv.id AND tv.code::text = 'CORRECTION_THESE'::text
             JOIN acteur_these a ON vt.these_id = a.these_id AND vt.individu_id = a.individu_id AND a.histo_destruction IS NULL
             JOIN role r ON a.role_id = r.id AND r.code::text = 'P'::text
    WHERE vt.histo_destructeur_id IS NULL
)
SELECT (va.these_id || '_'::text) || va.individu_id AS id,
       va.these_id,
       va.individu_id,
       exists(select from validations_dt_existantes vdte
              where vdte.these_id = va.these_id
                and vdte.type_validation_id = va.type_validation_id
                and vdte.individu_id = va.individu_id)::integer as valide
FROM validations_attendues va
;
+1 −1
Changes for doc/release-notes/v10/v10.1.0.md: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -11,4 +11,4 @@

## 2. Dans la base de données

Exécutez dans l'ordre les scripts SQL présents dans le répertoire [10.1.0](10.1.0).
Exécutez dans l'ordre les scripts SQL présents dans le répertoire correspondant à la présente version.