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(contributions): correction des contributions avec une fiche SP #1501

Merged
merged 1 commit into from
Nov 5, 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 @@ -11,7 +11,7 @@ query getContribsWithSp($ficheSpIds: [String!]) {
order
seo_title
}
content_fiche_sp: document {
content_fiche_sp: document_fiche_sp {
initial_id
document
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ query contribution_answer($id: uuid) {
slug
}
}
contentFichesSpDocument: document {
contentFichesSpDocument: document_fiche_sp {
cdtnId: cdtn_id
title
source
Expand Down
4 changes: 2 additions & 2 deletions targets/frontend/src/modules/contribution/api/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const getContributionAnswerById = gql`
cdtn_references {
cdtn_id
}
content_fiche_sp: document {
content_fiche_sp: document_fiche_sp {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le problème vient de cette relation. On venait mettre le document dans content_fiche_sp sauf que le document c'est le document de la contrib dans la table documents et non de la fiche SP.
De ce fait, au query, on récupère le cdtn_id de la contrib au lieu de la fiche SP.

initial_id
document
}
Expand All @@ -70,7 +70,7 @@ export const getGenericAnswerByQuestionId = gql`
order
seo_title
}
content_fiche_sp: document {
content_fiche_sp: document_fiche_sp {
initial_id
document
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ object_relationships:
- name: document
using:
foreign_key_constraint_on: cdtn_id
- name: document_fiche_sp
using:
foreign_key_constraint_on: content_service_public_cdtn_id
Comment on lines +18 to +20
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il manquait la relation vers la fiche SP dans hasura.

- name: question
using:
foreign_key_constraint_on: question_id
Expand Down
Loading