Merge pull request #5718 from betagouv/dev

2020-11-04-01
This commit is contained in:
Keirua 2020-11-04 17:49:50 +01:00 committed by GitHub
commit 331159b767
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -633,7 +633,7 @@ class Procedure < ApplicationRecord
def dossiers_count_for_instructeur(instructeur)
query = <<-EOF
SELECT
COUNT(*) FILTER ( WHERE "dossiers"."state" in ('en_construction', 'en_instruction') and (("follows"."id" IS NULL) or ("follows"."instructeur_id" = :instructeur_id and "follows"."unfollowed_at" < :now)) and not "dossiers"."archived") AS a_suivre,
COUNT(*) FILTER ( WHERE "dossiers"."state" in ('en_construction', 'en_instruction') and "follows"."id" IS NULL and not "dossiers"."archived") AS a_suivre,
COUNT(*) FILTER ( WHERE "dossiers"."state" in ('en_construction', 'en_instruction') and "follows"."instructeur_id" = :instructeur_id and not "dossiers"."archived" and "follows"."unfollowed_at" IS NULL) AS suivis,
COUNT(*) FILTER ( WHERE "dossiers"."state" in ('accepte', 'refuse', 'sans_suite') and not "dossiers"."archived" ) AS termines,
COUNT(*) FILTER ( WHERE "dossiers"."state" != 'brouillon' and not "dossiers"."archived" ) AS total,
@ -652,6 +652,7 @@ class Procedure < ApplicationRecord
LEFT OUTER JOIN
"follows"
ON "follows"."dossier_id" = "dossiers"."id"
AND "follows"."unfollowed_at" IS NULL
WHERE
"dossiers"."hidden_at" IS NULL
AND "assign_tos"."instructeur_id" = :instructeur_id