@tricoteuses/senat 2.16.7 → 2.16.8

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/loaders.js CHANGED
@@ -42,8 +42,15 @@ function* iterLoadSenatItems(dataDir, dataName, legislatureOrSession, subDir, {
42
42
  if (log) {
43
43
  console.log(`Loading file: ${filePath}…`);
44
44
  }
45
- const itemJson = fs.readFileSync(filePath, { encoding: "utf8" });
46
- const item = JSON.parse(itemJson);
45
+ let item;
46
+ try {
47
+ const itemJson = fs.readFileSync(filePath, { encoding: "utf8" });
48
+ item = JSON.parse(itemJson);
49
+ }
50
+ catch (err) {
51
+ console.warn(`[iterLoadSenatItems] skipped invalid JSON: ${filePath} (${err.message})`);
52
+ continue;
53
+ }
47
54
  const filePathFromDataset = filePath.substring(filePath.indexOf(dataName) + dataName.length);
48
55
  yield {
49
56
  item,
@@ -114,20 +114,13 @@ const findAllAmendementsQuery = dbSenat
114
114
  concat(val("https://www.senat.fr/amendements/"), ref("ameli.ses.lil"), val("/"), ref("ameli.txt_ameli.numabs"), val("/Amdt_"), ref("ameli.amd.numabs"), val(".html")).as("url"),
115
115
  "ameli.grppol_ameli.lilcou as au_nom_de_groupe_politique",
116
116
  "ameli.com_ameli.lil as au_nom_de_commission",
117
- eb
118
- .case()
119
- .when("ameli.cab.entid", "is not", null)
120
- .then(true)
121
- .else(false)
122
- .end()
123
- .as("auteur_est_gouvernement"),
124
- auteurs(ref("ameli.amd.id")).as("auteurs")
125
- ]);
117
+ eb.case().when("ameli.cab.entid", "is not", null).then(true).else(false).end().as("auteur_est_gouvernement"),
118
+ auteurs(ref("ameli.amd.id")).as("auteurs"),
119
+ ])
120
+ .distinctOn("ameli.amd.id");
126
121
  export function findAllAmendements(fromSession) {
127
122
  if (fromSession !== undefined) {
128
- return findAllAmendementsQuery
129
- .where("ameli.ses.ann", ">=", fromSession)
130
- .stream();
123
+ return findAllAmendementsQuery.where("ameli.ses.ann", ">=", fromSession).stream();
131
124
  }
132
125
  return findAllAmendementsQuery.stream();
133
126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tricoteuses/senat",
3
- "version": "2.16.7",
3
+ "version": "2.16.8",
4
4
  "description": "Handle French Sénat's open data",
5
5
  "keywords": [
6
6
  "France",