@tricoteuses/senat 2.20.23 → 2.20.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/model/ameli.js +16 -5
- package/package.json +1 -1
package/lib/model/ameli.js
CHANGED
|
@@ -22,12 +22,16 @@ function auteurs(amendementId) {
|
|
|
22
22
|
])
|
|
23
23
|
.orderBy("ameli.amdsen.rng", "asc"));
|
|
24
24
|
}
|
|
25
|
-
function scrutin(amendementNum, sesann) {
|
|
25
|
+
function scrutin(amendementNum, sesann, lecassidt) {
|
|
26
26
|
return dbSenat
|
|
27
27
|
.selectFrom("dosleg.amescr")
|
|
28
|
-
.leftJoin("dosleg.scr",
|
|
28
|
+
.leftJoin("dosleg.scr", (join) => join
|
|
29
|
+
.onRef("dosleg.amescr.scrnum", "=", "dosleg.scr.scrnum")
|
|
30
|
+
.onRef("dosleg.amescr.sesann", "=", "dosleg.scr.sesann"))
|
|
31
|
+
.leftJoin("dosleg.date_seance", "dosleg.scr.code", "dosleg.date_seance.code")
|
|
29
32
|
.where("dosleg.amescr.amescrnum", "=", amendementNum)
|
|
30
33
|
.where("dosleg.amescr.sesann", "=", sesann)
|
|
34
|
+
.where("dosleg.date_seance.lecidt", "=", lecassidt)
|
|
31
35
|
.select(["dosleg.amescr.scrnum as scrutin_num"])
|
|
32
36
|
.limit(1)
|
|
33
37
|
.as("scrutin_num");
|
|
@@ -43,7 +47,9 @@ const findAllAmendementsQuery = dbSenat
|
|
|
43
47
|
.leftJoin("ameli.typses", "ameli.typses.id", "ameli.ses.typid")
|
|
44
48
|
.leftJoin("ameli.nat", "ameli.txt_ameli.natid", "ameli.nat.id")
|
|
45
49
|
.leftJoin("ameli.lec_ameli", "ameli.txt_ameli.lecid", "ameli.lec_ameli.id")
|
|
46
|
-
.leftJoin("dosleg.texte",
|
|
50
|
+
.leftJoin("dosleg.texte", (join) => join
|
|
51
|
+
.onRef("ameli.ses.ann", "=", "dosleg.texte.sesann")
|
|
52
|
+
.onRef("ameli.txt_ameli.numabs", "=", "dosleg.texte.texnum"))
|
|
47
53
|
.leftJoin("dosleg.lecass", "dosleg.texte.lecassidt", "dosleg.lecass.lecassidt")
|
|
48
54
|
.leftJoin("ameli.mot", "ameli.amd.motid", "ameli.mot.id")
|
|
49
55
|
.leftJoin("ameli.avicom", "ameli.amd.avcid", "ameli.avicom.id")
|
|
@@ -123,11 +129,16 @@ const findAllAmendementsQuery = dbSenat
|
|
|
123
129
|
"ameli.avigvt.lib as avis_gouvernement",
|
|
124
130
|
eb.fn.coalesce("ameli.sor.lib", "ameli.irr.libirr").as("sort"),
|
|
125
131
|
"ameli.amd.rev as revision",
|
|
126
|
-
concat(
|
|
132
|
+
concat(eb
|
|
133
|
+
.case()
|
|
134
|
+
.when("ameli.amd.num", "like", "%COM%")
|
|
135
|
+
.then(val("https://www.senat.fr/amendements/commissions/"))
|
|
136
|
+
.else(val("https://www.senat.fr/amendements/"))
|
|
137
|
+
.end(), ref("ameli.ses.ann"), val("-"), sql `(ameli.ses.ann + 1)`, val("/"), ref("ameli.txt_ameli.numabs"), val("/Amdt_"), ref("ameli.amd.num"), val(".html")).as("url"),
|
|
127
138
|
"ameli.grppol_ameli.lilcou as au_nom_de_groupe_politique",
|
|
128
139
|
"ameli.com_ameli.lil as au_nom_de_commission",
|
|
129
140
|
eb.case().when("ameli.cab.entid", "is not", null).then(true).else(false).end().as("auteur_est_gouvernement"),
|
|
130
|
-
scrutin(ref("ameli.amd.num"), ref("ameli.ses.ann")),
|
|
141
|
+
scrutin(ref("ameli.amd.num"), ref("ameli.ses.ann"), ref("dosleg.texte.lecassidt")),
|
|
131
142
|
auteurs(ref("ameli.amd.id")).as("auteurs"),
|
|
132
143
|
]);
|
|
133
144
|
export function findAllAmendements(fromSession) {
|