@tricoteuses/senat 2.15.4 → 2.15.6
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/datasets.js
CHANGED
|
@@ -220,6 +220,7 @@ export const datasets = {
|
|
|
220
220
|
],
|
|
221
221
|
votsen: [
|
|
222
222
|
{ name: "idx_scrnum", columns: ["scrnum"] },
|
|
223
|
+
{ name: "idx_sesann", columns: ["sesann"] },
|
|
223
224
|
{ name: "idx_titsencod", columns: ["titsencod"] },
|
|
224
225
|
{ name: "idx_stavotidt", columns: ["stavotidt"] },
|
|
225
226
|
{ name: "idx_posvotcod", columns: ["posvotcod"] },
|
package/lib/model/scrutins.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { jsonArrayFrom } from "kysely/helpers/postgres";
|
|
2
2
|
import { dbSenat } from "../databases";
|
|
3
3
|
import { rtrim, toDateString } from "./util";
|
|
4
|
-
function votes(scrutinNum, scrutinDate) {
|
|
4
|
+
function votes(scrutinNum, scrutinSession, scrutinDate) {
|
|
5
5
|
return jsonArrayFrom(dbSenat
|
|
6
6
|
.selectFrom("dosleg.votsen")
|
|
7
7
|
.leftJoin("dosleg.titsen", "dosleg.titsen.titsencod", "dosleg.votsen.titsencod")
|
|
8
8
|
.leftJoin("dosleg.stavot", "dosleg.stavot.stavotidt", "dosleg.votsen.stavotidt")
|
|
9
9
|
.leftJoin("dosleg.posvot", "dosleg.posvot.posvotcod", "dosleg.votsen.posvotcod")
|
|
10
|
-
.leftJoin("sens.sen", "dosleg.votsen.senmat", "sens.sen.senmat")
|
|
11
10
|
.leftJoin("sens.memgrppol", (join) => join
|
|
12
11
|
.onRef("sens.memgrppol.senmat", "=", "dosleg.votsen.senmat")
|
|
13
12
|
.onRef("sens.memgrppol.memgrppoldatdeb", "<=", scrutinDate)
|
|
@@ -16,7 +15,7 @@ function votes(scrutinNum, scrutinDate) {
|
|
|
16
15
|
eb("sens.memgrppol.memgrppoldatfin", "is", null)
|
|
17
16
|
])))
|
|
18
17
|
.where("dosleg.votsen.scrnum", "=", scrutinNum)
|
|
19
|
-
.where("
|
|
18
|
+
.where("dosleg.votsen.sesann", "=", scrutinSession)
|
|
20
19
|
.select([
|
|
21
20
|
"dosleg.votsen.senmat as matricule_votant",
|
|
22
21
|
"dosleg.votsen.senmatdel as matricule_delegant",
|
|
@@ -65,7 +64,7 @@ const findAllScrutinsQuery = dbSenat
|
|
|
65
64
|
"scr.scrconsea as nombre_contre_seance",
|
|
66
65
|
"scr.scrpou as nombre_pour",
|
|
67
66
|
"scr.scrpousea as nombre_pour_seance",
|
|
68
|
-
votes(ref("scr.scrnum"), ref("scr.scrdat")).as("votes"),
|
|
67
|
+
votes(ref("scr.scrnum"), ref("scr.sesann"), ref("scr.scrdat")).as("votes"),
|
|
69
68
|
misesAuPoint(ref("scr.scrnum")).as("mises_au_point"),
|
|
70
69
|
])
|
|
71
70
|
.$narrowType();
|
|
@@ -8,7 +8,7 @@ import { parseAgendaFromFile } from "../model/agenda";
|
|
|
8
8
|
import { getSessionsFromStart } from "../types/sessions";
|
|
9
9
|
import { ID_DATE_FORMAT } from "./datautil";
|
|
10
10
|
import { commonOptions } from "./shared/cli_helpers";
|
|
11
|
-
import {
|
|
11
|
+
import { fetchWithRetry } from "./shared/util";
|
|
12
12
|
import { groupNonSPByTypeOrganeHour, groupSeancePubliqueBySlot } from "../utils/reunion_grouping";
|
|
13
13
|
const optionsDefinitions = [
|
|
14
14
|
...commonOptions,
|
|
@@ -29,7 +29,7 @@ class AgendaError extends Error {
|
|
|
29
29
|
async function retrieveAgendas(dataDir, sessions) {
|
|
30
30
|
console.log(`[AGENDA] Retrieving agendas for sessions ${sessions.join(", ")}`);
|
|
31
31
|
const agendaRootDir = path.join(dataDir, AGENDA_FOLDER);
|
|
32
|
-
|
|
32
|
+
fs.ensureDirSync(agendaRootDir);
|
|
33
33
|
const originalAgendaDir = path.join(agendaRootDir, DATA_ORIGINAL_FOLDER);
|
|
34
34
|
fs.ensureDirSync(originalAgendaDir);
|
|
35
35
|
const transformedAgendaDir = path.join(agendaRootDir, DATA_TRANSFORMED_FOLDER);
|
|
@@ -39,9 +39,11 @@ async function retrieveAgendas(dataDir, sessions) {
|
|
|
39
39
|
for (const session of sessions) {
|
|
40
40
|
const originalAgendaSessionDir = path.join(originalAgendaDir, `${session}`);
|
|
41
41
|
fs.ensureDirSync(originalAgendaSessionDir);
|
|
42
|
+
fs.emptyDirSync(originalAgendaSessionDir);
|
|
42
43
|
const transformedAgendaSessionDir = path.join(transformedAgendaDir, `${session}`);
|
|
43
44
|
if (options["parseAgenda"]) {
|
|
44
45
|
fs.ensureDirSync(transformedAgendaSessionDir);
|
|
46
|
+
fs.emptyDirSync(transformedAgendaSessionDir);
|
|
45
47
|
}
|
|
46
48
|
const fifteenDaysFromNow = new Date();
|
|
47
49
|
fifteenDaysFromNow.setDate(fifteenDaysFromNow.getDate() + 15); // Don't download agendas more than 15 days in the future
|