Commit bf1bf423 authored by Stephane Crozat's avatar Stephane Crozat

fix bug nombre de demandes excluant les demandes invalidées

parent a6fe503e
......@@ -108,7 +108,7 @@ INSERT INTO subscribe (utclogin,api,subdate) VALUES (
);
SELECT normcode, name, size, nbval, nbask, nbsub, open, resplogin, semester, year FROM vapi;
SELECT normcode, name, size, nbval, nbask, open, resplogin, semester, year FROM vapi;
SELECT * FROM vlocaluser;
SELECT utclogin, id, normcode, validation FROM vsubscription;
......
......@@ -5,6 +5,7 @@ SELECT
api AS subcountid,
COUNT(utclogin) AS countsub
FROM subscribe
WHERE validation IS NULL
GROUP BY api;
CREATE OR REPLACE VIEW vapi_valcount AS
......@@ -24,9 +25,8 @@ TO_CHAR(dbegin + duration-1,'TMday FMDD TMmonth') AS normdend,
TO_CHAR(dbegin, 'IW') AS week,
TO_CHAR(dbegin, 'yyyy') AS year,
semester(dbegin) AS semester,
COALESCE(countsub,0) AS nbsub,
COALESCE(countsub,0) AS nbask,
COALESCE(countval,0) AS nbval,
COALESCE(countsub,0)-COALESCE(countval,0) AS nbask,
CASE WHEN countval >= size THEN 0 ELSE 1 END AS open
FROM api LEFT JOIN vapi_subcount ON id=subcountid LEFT JOIN vapi_valcount ON id=valcountid
ORDER BY year, week, code;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment