@tricoteuses/senat 2.19.8 → 2.20.0

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.
@@ -219,7 +219,7 @@ export function findAllDossiers() {
219
219
  return findAllDossiersQuery.stream();
220
220
  }
221
221
  export function createActesLegislatifs(dossier) {
222
- const actesLegislatifs = (dossier["lectures"] || []).map((lecture) => {
222
+ const actesLegislatifs = (dossier["lectures"] || []).flatMap((lecture) => {
223
223
  const lecturesAssemblee = (lecture["lectures_assemblee"] || []).map((lectureAss) => {
224
224
  const codeParent = getCodeActeLecture(dossier["code_nature_dossier"], lecture["type_lecture"], lectureAss["assemblee"]);
225
225
  const textesWithCodeActe = (lectureAss["textes"] || []).map((texte) => ({
@@ -163,8 +163,22 @@ export async function retrieveCriXmlDump(dataDir, options = {}) {
163
163
  const seanceTs = Date.parse(yyyymmdd.slice(0, 4) + "-" + yyyymmdd.slice(4, 6) + "-" + yyyymmdd.slice(6, 8));
164
164
  if (seanceTs < cutoff) {
165
165
  // Check if some file exists sarting with CRSSN{yyyymmdd} in transformed dir
166
- const someFile = (await fs.readdir(transformedSessionDir)).find((fn) => fn.startsWith(`CRSSN${yyyymmdd}`));
167
- if (someFile) {
166
+ const files = await fs.readdir(transformedSessionDir);
167
+ const dayFiles = files.filter((fn) => fn.startsWith(`CRSSN${yyyymmdd}-`) && fn.endsWith(".json"));
168
+ if (dayFiles.length > 0) {
169
+ // Link existing files to agendas
170
+ for (const fn of dayFiles) {
171
+ const match = fn.match(/^CRSSN(\d{8})-(.+)\.json$/);
172
+ const slot = match?.[2];
173
+ const crPath = path.join(transformedSessionDir, fn);
174
+ try {
175
+ const cr = await fs.readJSON(crPath);
176
+ await linkCriSlotIntoAgendaGrouped(dataDir, yyyymmdd, slot, cr.uid, cr, session);
177
+ }
178
+ catch (e) {
179
+ console.warn(`[AGENDA] [${session}] Could not link existing CR into grouped for ${yyyymmdd} ${slot}:`, e);
180
+ }
181
+ }
168
182
  continue;
169
183
  }
170
184
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tricoteuses/senat",
3
- "version": "2.19.8",
3
+ "version": "2.20.0",
4
4
  "description": "Handle French Sénat's open data",
5
5
  "keywords": [
6
6
  "France",