Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 480 | Rev 561 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 480 Rev 482
Línea 26... Línea 26...
26
        setError(false);
26
        setError(false);
Línea 27... Línea 27...
27
 
27
 
28
        // set form data
28
        // set form data
29
        const formData = new FormData();
29
        const formData = new FormData();
-
 
30
        formData.append("content", JSON.stringify(test.content));
-
 
31
        formData.append("status",
-
 
32
            formCompleted() ?
30
        formData.append("content", JSON.stringify(test.content));
33
                formPending() ?
-
 
34
                    backendVars.STATUS_PENDING :
-
 
35
                    backendVars.STATUS_COMPLETED :
Línea 31... Línea 36...
31
        formData.append("status", formCompleted() ? backendVars.STATUS_PENDING : backendVars.STATUS_DRAFT);
36
                backendVars.STATUS_DRAFT);
32
 
37
 
33
        // check if the form has at least one response
38
        // check if the form has at least one response
34
        if (leastOneAnswer()) {
39
        if (leastOneAnswer()) {
Línea 70... Línea 75...
70
    const leastOneAnswer = () => {
75
    const leastOneAnswer = () => {
71
        let answer = false;
76
        let answer = false;
72
        test.content.map((section) => {
77
        test.content.map((section) => {
73
            section.questions.map((question) => {
78
            section.questions.map((question) => {
74
                //Validate if the answer is not empty
79
                //Validate if the answer is not empty
75
                if (question.answer!=""  || question.answer.length != 0) {
80
                if (question.answer != "" || question.answer.length != 0) {
76
                    answer = true;
81
                    answer = true;
77
                }
82
                }
78
            });
83
            });
79
        })
84
        })
80
        return answer;
85
        return answer;
81
    }
86
    }
Línea -... Línea 87...
-
 
87
 
-
 
88
    /**
-
 
89
     * Validate if there are "Open" type questions
-
 
90
     * @returns 
-
 
91
     */
-
 
92
    const formPending = () => {
-
 
93
        let pending = false;
-
 
94
        test.content.map((section) => {
-
 
95
            section.questions.map((question) => {
-
 
96
                if (question.type == "open" || question.type == "rating-open"  || question.type == "rating-range" ) {
-
 
97
                    pending = true;
-
 
98
                }
-
 
99
            });
-
 
100
        })
-
 
101
        return pending;
Línea 82... Línea 102...
82
 
102
    }
83
 
103
 
84
    /**
104
    /**
85
     * Cancel test and send to the list of forms
105
     * Cancel test and send to the list of forms