Skip to content

Commit

Permalink
fix(frontend): reove cdt and dulpicate contribution from /contenus (#345
Browse files Browse the repository at this point in the history
)

closes #305
  • Loading branch information
lionelB committed Feb 26, 2021
1 parent ea9935c commit d471d1c
Showing 1 changed file with 31 additions and 26 deletions.
57 changes: 31 additions & 26 deletions targets/frontend/src/pages/contenus/index.js
Expand Up @@ -31,39 +31,43 @@ import { useMutation, useQuery } from "urql";

const searchDocumentQuery = `
query documents($source: String, $search: String!, $published: [Boolean!]!, $offset: Int = 0, $limit: Int = 50) {
documents(
where: {
_and: {
source: {_eq: $source}
title: {_ilike: $search }
is_published: {_in: $published}
}
documents(where: {
_not: {
document: {_has_key: "split"}
}
offset: $offset,
limit: $limit,
order_by:[{source: asc}, {slug: asc}]
)
{
id:initial_id
cdtnId:cdtn_id
_and: {
source: {_eq: $source, _neq: "code_du_travail"}
title: {_ilike: $search}
is_published: {_in: $published}
}
},
offset: $offset, limit: $limit, order_by: [{source: asc}, {slug: asc}]) {
id: initial_id
cdtnId: cdtn_id
title
source
isPublished: is_published
}
documents_aggregate(
where: {
_and: {
source: {_eq: $source},
title: {_ilike: $search}
is_published: {_in: $published}
}
documents_aggregate(where: {
_not: {
document: {_has_key: "split"}
}
_and: {
source: {_eq: $source, _neq: "code_du_travail"}
title: {_ilike: $search},
is_published: {_in: $published}
}
}) {
aggregate {
count
}
)
{
aggregate { count }
}
sources: documents_aggregate(distinct_on: source) {
sources: documents_aggregate(
distinct_on: source
where: {source: {_neq: "code_du_travail"}}) {
nodes {
source
}
Expand All @@ -84,7 +88,8 @@ mutation publication($cdtnId:String!, $isPublished:Boolean!) {

const documentSources = [
[SOURCES.CCN, getLabelBySource(SOURCES.CCN)],
[SOURCES.CDT, getLabelBySource(SOURCES.CDT)],
// there is too many cdt documents which pollute the output
// [SOURCES.CDT, getLabelBySource(SOURCES.CDT)],
[SOURCES.CONTRIBUTIONS, getLabelBySource(SOURCES.CONTRIBUTIONS)],
[SOURCES.SHEET_MT_PAGE, getLabelBySource(SOURCES.SHEET_MT)],
[SOURCES.SHEET_SP, getLabelBySource(SOURCES.SHEET_SP)],
Expand Down

0 comments on commit d471d1c

Please sign in to comment.