Skip to content
New issue

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

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

Already on GitHub? # to your account

[#916] Add display only to config.js, modify data expand #999

Merged
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
2 changes: 1 addition & 1 deletion backend/api/v1/v1_forms/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ class Meta:
fields = [
'id', 'form', 'question_group', 'name', 'text', 'order', 'meta',
'api', 'type', 'required', 'rule', 'option', 'dependency',
'attributes'
'display_only', 'attributes'
]


Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/approvals/ApprovalDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ const ApprovalDetail = ({
return {
...qg,
question: qg.question
.filter((item) => !item.displayOnly)
.filter((item) => !item?.display_only)
.map((q) => {
const findValue = res.data.find(
(d) => d.question === q.id
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/manage-data/DataDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const DataDetail = ({
.then((res) => {
const data = questionGroups.map((qg) => {
const question = qg.question
.filter((item) => !item.displayOnly)
.filter((item) => !item?.display_only)
.map((q) => {
const findData = res.data.find((d) => d.question === q.id);
return {
Expand Down
11 changes: 8 additions & 3 deletions frontend/src/pages/submissions/BatchDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ const BatchDetail = ({ expanded, setReload, deleting, handleDelete }) => {
return uiText[activeLang];
}, [activeLang]);

const questionGroups = window.forms.find((f) => f.id === expanded.form)
?.content?.question_group;
const questionGroups = window.forms
.find((f) => f.id === expanded.form)
?.content?.question_group?.filter(
(qg) =>
qg.question?.length ===
qg.question.filter((q) => !q?.display_only).length
);

useEffect(() => {
if (questionGroups) {
Expand All @@ -29,7 +34,7 @@ const BatchDetail = ({ expanded, setReload, deleting, handleDelete }) => {
return {
...qg,
question: qg.question
.filter((item) => !item.displayOnly)
.filter((item) => !item?.display_only)
.map((q) => {
const findValue = res.data.find(
(d) => d.question === q.id
Expand Down