@omniumretail/component-library 1.1.76 → 1.1.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -167,7 +167,7 @@ Primary.args = {
|
|
|
167
167
|
"Subject": "This is a Subject",
|
|
168
168
|
"Description": "This is a description",
|
|
169
169
|
"Grade": "50",
|
|
170
|
-
"Answer":
|
|
170
|
+
"Answer": []
|
|
171
171
|
},
|
|
172
172
|
{
|
|
173
173
|
"Id": "35562A64-A24B-425A-A345-560238CA2468",
|
|
@@ -175,7 +175,7 @@ Primary.args = {
|
|
|
175
175
|
"Subject": "This is a Subject",
|
|
176
176
|
"Description": "This is a description",
|
|
177
177
|
"Grade": "25",
|
|
178
|
-
"Answer":
|
|
178
|
+
"Answer": ["1"],
|
|
179
179
|
"IsMultipleChoise": false
|
|
180
180
|
},
|
|
181
181
|
{
|
|
@@ -184,7 +184,7 @@ Primary.args = {
|
|
|
184
184
|
"Subject": "This is a Subject",
|
|
185
185
|
"Description": "This is a description",
|
|
186
186
|
"Grade": "25",
|
|
187
|
-
"Answer":
|
|
187
|
+
"Answer": [],
|
|
188
188
|
"IsMultipleChoise": true
|
|
189
189
|
}
|
|
190
190
|
]
|
|
@@ -84,15 +84,6 @@ const hasCategory = (currentKey: string, categories: Category[], direction: 'nex
|
|
|
84
84
|
return !!category;
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
-
const getTitleWithQuestionCount = (category: any): string => {
|
|
88
|
-
const questionCount = category?.Data?.Questions?.length;
|
|
89
|
-
const answeredQuestions = category?.Data?.Questions?.filter((question: any) => question.Answer !== null && question.Answer !== undefined && question.Answer !== '').length;
|
|
90
|
-
|
|
91
|
-
return questionCount
|
|
92
|
-
? `${category.Title} - ${answeredQuestions} / ${questionCount}`
|
|
93
|
-
: category.Title;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
87
|
export const CategoryResponse = React.forwardRef((props: CategoryResponse, ref) => {
|
|
97
88
|
const { data } = props;
|
|
98
89
|
|
|
@@ -128,6 +119,16 @@ export const CategoryResponse = React.forwardRef((props: CategoryResponse, ref)
|
|
|
128
119
|
form.setFieldsValue(initial);
|
|
129
120
|
};
|
|
130
121
|
|
|
122
|
+
const getTitleWithQuestionCount = (category: any): string => {
|
|
123
|
+
const questionCount = category?.Data?.Questions?.length;
|
|
124
|
+
const answeredQuestions = category?.Data?.Questions?.filter
|
|
125
|
+
((question: any) => question.Answer !== null && question.Answer !== undefined && question.Answer !== '' && question.Answer.length > 0).length;
|
|
126
|
+
|
|
127
|
+
return questionCount
|
|
128
|
+
? `${category.Title} - ${answeredQuestions} / ${questionCount}`
|
|
129
|
+
: category.Title;
|
|
130
|
+
};
|
|
131
|
+
|
|
131
132
|
const handleLabelClick = (category: any, index: number) => {
|
|
132
133
|
setSelectedCategory(category);
|
|
133
134
|
updateInitialValues(category.Data);
|
|
@@ -173,7 +174,13 @@ export const CategoryResponse = React.forwardRef((props: CategoryResponse, ref)
|
|
|
173
174
|
const updatedQuestions = initialValues.Questions.map((question: any, index: number) => {
|
|
174
175
|
return {
|
|
175
176
|
...question,
|
|
176
|
-
Answer:
|
|
177
|
+
Answer: !props.addButtons
|
|
178
|
+
? values.Questions[index].Answer
|
|
179
|
+
: Array.isArray(values.Questions[index].Answer)
|
|
180
|
+
? values.Questions[index].Answer
|
|
181
|
+
: values.Questions[index].Answer
|
|
182
|
+
? [values.Questions[index].Answer]
|
|
183
|
+
: [],
|
|
177
184
|
Note: values.Questions[index].Note,
|
|
178
185
|
IsMultipleChoise: values.Questions[index].IsMultipleChoise,
|
|
179
186
|
Files: fileLists[`${selectedCategory.Data.CategoryId}_${index}`] || [], // Include files in the form data
|