Skip to content

Commit

Permalink
feat(data): remove duplicate fiche sp referenced in contributions (#2380
Browse files Browse the repository at this point in the history
)

* feat(data): remove duplicate fiche sp referenced in contributions

* add contributions in monorepo image

* fix import in test
  • Loading branch information
lionelB authored Feb 19, 2020
1 parent e1479fd commit 6ba133e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ COPY ./yarn.lock /app/yarn.lock

COPY ./packages/code-du-travail-data/package.json /app/packages/code-du-travail-data/package.json
COPY ./packages/code-du-travail-data/dataset/courrier-type/package.json /app/packages/code-du-travail-data/dataset/courrier-type/package.json
COPY ./packages/code-du-travail-data/dataset/contributions/package.json /app/packages/code-du-travail-data/dataset/contributions/package.json
COPY ./packages/code-du-travail-data/dataset/datafiller/package.json /app/packages/code-du-travail-data/dataset/datafiller/package.json
COPY ./packages/code-du-travail-data/dataset/fiches_ministere_travail/package.json /app/packages/code-du-travail-data/dataset/fiches_ministere_travail/package.json
COPY ./packages/code-du-travail-data/dataset/simulateurs/package.json /app/packages/code-du-travail-data/dataset/simulateurs/package.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import extractMdxContentUrl from "../extractMdxContentUrl";
const extractMdxContentUrl = require("../extractMdxContentUrl");

const tests = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ const extractMdxContentUrl = markdown => {
);
};

export default extractMdxContentUrl;
module.exports = extractMdxContentUrl;
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const uniqBy = require("lodash.uniqby");
const contributions = require("../contributions/contributions.data.json");
const extractMdxContentUrl = require("../contributions/extractMdxContentUrl");

const filter = fiches => {
const filteredFiches = fiches.filter(fiche => {
Expand All @@ -14,7 +16,9 @@ const filter = fiches => {
if (excludeFicheId.some(matchFilDAriane)) {
return false;
}

if (excludeContribFicheId.some(matchFilDAriane)) {
return false;
}
if (excludeDossierId.some(matchFilDAriane)) {
// Il existe des fiches que l'on souhaite garder, alors que
// l'on ne souhaite pas garder son dossier parent
Expand Down Expand Up @@ -179,3 +183,13 @@ const includeFicheId = [
"F34705",
"F34902"
];

/** Fiche SP referenced from a contribution */

const excludeContribFicheId = contributions
.map(({ answers }) => extractMdxContentUrl(answers.generic.markdown))
.filter(Boolean)
.map(url => {
const [, id] = url.match(/\/(\w+)$/);
return id;
});
1 change: 1 addition & 0 deletions packages/code-du-travail-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
},
"dependencies": {
"@cdt/data": "^4.3.0",
"@cdt/data...contributions": "^4.2.0",
"@cdt/data...datafiller": "^4.2.0",
"@cdt/data...prime-precarite": "^4.1.0",
"@cdt/data...simulateurs": "^4.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fetch from "isomorphic-unfetch";

import Answer from "../../src/common/Answer";
import Contribution from "../../src/contributions/Contribution";
import extractMdxContentUrl from "../../src/contributions/extractMdxContentUrl";
import extractMdxContentUrl from "@cdt/data...contributions/extractMdxContentUrl";
import { Layout } from "../../src/layout/Layout";
import Metas from "../../src/common/Metas";

Expand Down

0 comments on commit 6ba133e

Please sign in to comment.