@@ -21,26 +21,27 @@ export const QuestionnaireByIdQueryKey = "questionnaireById";
21
21
* in that list have an order. Hub stores things in the document order not logical
22
22
* order. UI needs to have things in logical order.
23
23
*/
24
- function inPlaceSortByOrder ( q : Questionnaire ) {
25
- q . sections . sort ( ( a , b ) => a . order - b . order ) ;
26
- q . sections . forEach ( ( s ) => {
27
- s . questions . sort ( ( a , b ) => a . order - b . order ) ;
28
- s . questions . forEach ( ( q ) => {
29
- q . answers . sort ( ( a , b ) => a . order - b . order ) ;
30
- } ) ;
31
- } ) ;
32
- return q ;
33
- }
24
+ //TODO: this is not working, need to figure out why https://issues.redhat.com/browse/MTA-1907
25
+ // function inPlaceSortByOrder(q: Questionnaire) {
26
+ // q.sections.sort((a, b) => a.order - b.order);
27
+ // q.sections.forEach((s) => {
28
+ // s.questions.sort((a, b) => a.order - b.order);
29
+ // s.questions.forEach((q) => {
30
+ // q.answers.sort((a, b) => a.order - b.order);
31
+ // });
32
+ // });
33
+ // return q;
34
+ // }
34
35
35
36
export const useFetchQuestionnaires = ( ) => {
36
37
const { isLoading, data, error } = useQuery ( {
37
38
queryKey : [ QuestionnairesQueryKey ] ,
38
39
queryFn : getQuestionnaires ,
39
40
onError : ( error : AxiosError ) => console . log ( "error, " , error ) ,
40
- select : ( questionnaires ) => {
41
- questionnaires . forEach ( ( q ) => inPlaceSortByOrder ( q ) ) ;
42
- return questionnaires ;
43
- } ,
41
+ // select: (questionnaires) => {
42
+ // questionnaires.forEach((q) => inPlaceSortByOrder(q));
43
+ // return questionnaires;
44
+ // },
44
45
} ) ;
45
46
return {
46
47
questionnaires : data || [ ] ,
@@ -92,7 +93,7 @@ export const useFetchQuestionnaireById = (id: number | string) => {
92
93
queryKey : [ QuestionnaireByIdQueryKey , id ] ,
93
94
queryFn : ( ) => getQuestionnaireById < Questionnaire > ( id ) ,
94
95
onError : ( error : AxiosError ) => console . log ( "error, " , error ) ,
95
- select : ( q ) => inPlaceSortByOrder ( q ) ,
96
+ // select: (q) => inPlaceSortByOrder(q),
96
97
} ) ;
97
98
98
99
return {
0 commit comments