Skip to content

Commit

Permalink
fix: inject highlights on contributions (#1107)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-maillot authored Nov 9, 2023
1 parent 97b25d0 commit ca7d70a
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions shared/elasticsearch-document-adapter/src/cdtnDocuments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,24 +195,30 @@ export async function* cdtnDocumentsGen() {
{}
);

// we keep track of the idccs used in the contributions
// in order to flag the corresponding conventions collectives below
const contribIDCCs = updateContributionsAndGetIDCCs(contributions, ccnData);

yield {
documents: contributions.map(
({ answers, breadcrumbs, ...contribution }: any) => {
const newAnswer = answers;
if (newAnswer.conventions) {
newAnswer.conventions = answers.conventions.map((answer: any) => {
const highlight = ccnListWithHighlight[answer.idcc];
const highlight = ccnListWithHighlight[parseInt(answer.idcc)];
return {
...answer,
...(highlight ? { highlight } : {}),
};
});
}

if (newAnswer.conventionAnswer) {
const highlight =
ccnListWithHighlight[parseInt(newAnswer.conventionAnswer.idcc)];
if (highlight) {
newAnswer.conventionAnswer = {
...newAnswer.conventionAnswer,
highlight,
};
}
}
const obj = addGlossaryToAllMarkdownField({
...contribution,
answers: {
Expand All @@ -230,6 +236,10 @@ export async function* cdtnDocumentsGen() {
};

logger.info("=== Conventions Collectives ===");
// we keep track of the idccs used in the contributions
// in order to flag the corresponding conventions collectives below
const contribIDCCs = updateContributionsAndGetIDCCs(contributions, ccnData);

const ccnQR =
"Retrouvez les questions-réponses les plus fréquentes organisées par thème et élaborées par le ministère du Travail concernant cette convention collective.";

Expand Down

0 comments on commit ca7d70a

Please sign in to comment.