Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ingester): suppression de code lié à la fusion de la méta #1378

Merged
merged 2 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,85 +28,4 @@ describe("getCcSupported", () => {

expect(supportedCCs).toEqual(["1234", "5678"]);
});

it("should return list of supported CCs with old metallurgie agreements", () => {
const allContributions: any[] = [
{
questionIndex: 4,
contentType: "ANSWERS",
idcc: "1234",
},
{
questionIndex: 4,
contentType: "UNKNOWN",
idcc: "5678",
},
];

const contribution: any = {
questionIndex: 4,
contentType: "ANSWERS",
idcc: "0000",
};

const supportedCCs: string[] = getCcSupported(
allContributions,
contribution
);

expect(supportedCCs).toEqual([
"1234",
"5678",
"0054",
"0650",
"0714",
"0822",
"0828",
"0829",
"0860",
"0863",
"0878",
"0911",
"0937",
"0948",
"0965",
"0979",
"1059",
"1159",
"1274",
"1315",
"1365",
"1369",
"1387",
"1472",
"1560",
"1564",
"1577",
"1592",
"1604",
"1626",
"1628",
"1634",
"1635",
"1732",
"1813",
"1885",
"1902",
"1966",
"2003",
"2126",
"2221",
"2266",
"2542",
"2579",
"2615",
"2630",
"2700",
"2755",
"2992",
"3053",
"3209",
"3231",
]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,149 +3,11 @@ import {
DocumentElasticWithSource,
} from "@socialgouv/cdtn-types";

// TODO: à enlever lorsqu'on supporte la nouvelle CC de la métallurgie (3248)
const OLD_METALLURGIE_INDEX_4 = [
"0054",
"0650",
"0714",
"0822",
"0828",
"0829",
"0860",
"0863",
"0878",
"0911",
"0937",
"0948",
"0965",
"0979",
"1059",
"1159",
"1274",
"1315",
"1365",
"1369",
"1387",
"1472",
"1560",
"1564",
"1577",
"1592",
"1604",
"1626",
"1628",
"1634",
"1635",
"1732",
"1813",
"1885",
"1902",
"1966",
"2003",
"2126",
"2221",
"2266",
"2542",
"2579",
"2615",
"2630",
"2700",
"2755",
"2992",
"3053",
"3209",
"3231",
];
// TODO: à enlever lorsqu'on supporte la nouvelle CC de la métallurgie (3248)
const OLD_METALLURGIE_INDEX_23 = [
"0054",
"0650",
"0714",
"0822",
"0827",
"0828",
"0829",
"0836",
"0860",
"0863",
"0878",
"0887",
"0898",
"0899",
"0911",
"0914",
"0920",
"0923",
"0930",
"0934",
"0937",
"0943",
"0948",
"0965",
"0979",
"0984",
"1007",
"1059",
"1159",
"1164",
"1274",
"1315",
"1353",
"1365",
"1369",
"1387",
"1472",
"1525",
"1560",
"1564",
"1572",
"1576",
"1577",
"1578",
"1592",
"1604",
"1626",
"1627",
"1628",
"1634",
"1635",
"1732",
"1813",
"1867",
"1885",
"1902",
"1912",
"1960",
"1966",
"1967",
"2003",
"2126",
"2266",
"2294",
"2489",
"2542",
"2579",
"2615",
"2630",
"2700",
"2755",
"2980",
"2992",
"3209",
"3231",
];
export const getCcSupported = (
allContributions: DocumentElasticWithSource<ContributionDocumentJson>[],
genericContrib: DocumentElasticWithSource<ContributionDocumentJson>
): string[] => {
const ccSupported = allContributions
return allContributions
.filter((v) => v.questionIndex === genericContrib.questionIndex)
.map((v) => v.idcc);
const filteredOldMetallurgieAgreements =
genericContrib.questionIndex === 4
? OLD_METALLURGIE_INDEX_4
: genericContrib.questionIndex === 23
? OLD_METALLURGIE_INDEX_23
: [];
return [...ccSupported, ...filteredOldMetallurgieAgreements];
};
Loading