Fix HTML blank issues in TA/Mobius translations


  • Global Moderator

    MapleTA and Mobius sets the UI language based on the browser locale: language. For example Firefox set to French, will show TA/Mobius interface in French. 

    Issue: the unanswered HTML blank set the variable response to "No answer", but! it gets translated

    function setFeedback(response, answer){
                    if (response == "No answer" && answer == null) {  
                        /* not yet attempted  */
                        run([], 1);
                    } else if (answer == null) {
                        /* previously attempted */
                        run(response, 2);
                    } else if (answer != null) {
                        /* show correct answer in the gradebook */
                        run(answer, 3);
                    }
                };
    

    Fix:

    function setFeedback(response, answer){
                    var translations = ["No answer","Sin respuesta", "未解答", "Aucune réponse", "Keine Antwort", "Καμία απάντηση", "Nessuna Risposta", "解答なし", "답변 없음", "Brak odpowiedzi", "Sem resposta"];
                    if (translations.indexOf(response) >= 0 && answer == null) {  
                        /* not yet attempted  */
                        run([], 1);
                    } else if (answer == null) {
                        /* previously attempted */
                        run(response, 2);
                    } else if (answer != null) {
                        /* show correct answer in the gradebook */
                        run(answer, 3);
                    }
                };
    

    Some background for this:

    HTML blank has the following states:

    • Assignment: not answered, first attempt 
    • Assignment: not answered, not the first attempt (student browsed to a different question and came back)
    • Assignment: answered, not the first attempt (student browsed to a different question and came back)
    • Gradebook: students answer
    • Gradebook: correct answer
    • Preview: not answered, first attempt
    • Preview: answered, gradebook-like overview

     App can determine the state using the following variables:

    • interactiveMode
    • response
    • answer

    interactiveMode is true when question is either opened in the assignment or in the preview.

    response is either “No answer” (and translations), null or whatever your app returns with getResponse(). response is set to null when app is opened in the grade book to show the correct answer. In all other cases it's either "No response" (or translation) or whatever was previously returned with getResponse(). In the assignment, response is initialized with “No response” both on the first attempt as on every revisit of the question as long student didn’t interact with the app causing getResponse() to be called.

    answer is either null or whatever is set in the Correct-field of the blank.

    In the gradebook app is run twice, one for the left and one for the right pane. Apps are run in two separate iframes and cannot be interconnected easily. 


Log in to reply