From 50f311316cd8a31d32a1cad7fa67ce1619cdd1a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laurent=20L=C3=A9cluse?= <laurent.lecluse@unicaen.fr>
Date: Thu, 10 Feb 2022 10:13:53 +0100
Subject: [PATCH] =?UTF-8?q?distinction=20pr=C3=A9vu/r=C3=A9alise=20pour=20?=
 =?UTF-8?q?le=20service=20et=20le=20r=C3=A9f=C3=A9rentiel?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 data/ddl/view/V_TBL_SERVICE.sql | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/data/ddl/view/V_TBL_SERVICE.sql b/data/ddl/view/V_TBL_SERVICE.sql
index b7de5e6ddb..deab555ce5 100644
--- a/data/ddl/view/V_TBL_SERVICE.sql
+++ b/data/ddl/view/V_TBL_SERVICE.sql
@@ -44,7 +44,10 @@ WHERE
 SELECT
   i.annee_id                                                             annee_id,
   i.id                                                                   intervenant_id,
-  si.service                                                             actif,
+  CASE WHEN t.type_volume_horaire_code = 'PREVU'
+    THEN si.service_prevu
+    ELSE si.service_realise
+  END                                                                    actif,
   t.service_id                                                           service_id,
   t.element_pedagogique_id                                               element_pedagogique_id,
   ti.id                                                                  type_intervenant_id,
@@ -78,7 +81,8 @@ GROUP BY
   i.structure_id,
   ti.id,
   ti.code,
-  si.service,
+  si.service_prevu,
+  si.service_realise,
   t.element_pedagogique_id,
   t.service_id,
   t.element_pedagogique_periode_id,
-- 
GitLab