Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

include the Bn string in a radio buttons answer hash #494

Merged
merged 1 commit into from
Oct 30, 2020

Conversation

Alex-Jordan
Copy link
Contributor

An answer hash for radio buttons might currently look like:

         "AnSwEr0001" : {
            "_filter_name" : "dereference_array_ans",
            "ans_label" : "AnSwEr0001",
            "ans_message" : "",
            "ans_name" : "AnSwEr0001",
            "correct_ans" : "The Fundamental ... of Calculus",
            "correct_ans_latex_string" : "\\text{The Fundamental ... of Calculus}",
            "correct_value" : "The Fundamental ... of Calculus",
            "done" : "1",
            "error_flag" : "",
            "error_message" : "",
            "ignoreInfinity" : "1",
            "ignoreStrings" : "1",
            "original_student_ans" : "",
            "preview_latex_string" : "",
            "preview_text_string" : "",
            "score" : "0",
            "showEqualErrors" : "1",
            "showTypeWarnings" : "1",
            "showUnionReduceWarnings" : "1",
            "student_ans" : "",
            "studentsMustReduceUnions" : "1",
            "type" : "Value (parserRadioButtons)",
            "typeMatch" : "Value::Real"
         }

Nothing indicates the value attribute of the HTML button input corresponding to the correct choice. This edit adds to the hash like:

            "correct_choice" : "B1",

Copy link
Member

@taniwallach taniwallach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested quickly and works as intended. As there is no other use of a hash key called correct_choice it should not interfere with anything.

@taniwallach
Copy link
Member

@drgrice1 would you take a look - and then we can hopefully merge this...

Copy link
Member

@drgrice1 drgrice1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I see nothing wrong with this pull request, I am not certain of its necessity. If a custom checker is used you can already obtain this value using $correct->value (assuming $correct is what you name the first argument passed to the checker sub routine).

@drgrice1
Copy link
Member

I also observed that you can obtain this value from the answer hash without this pull request via the correct_value key (using $ansHash->{correct_value}->value).

@taniwallach
Copy link
Member

I also observed that you can obtain this value from the answer hash without this pull request via the correct_value key (using $ansHash->{correct_value}->value).

I think @Alex-Jordan wanted to make it cleanly accessible for use in systems which use WeBWorK to render problems as a back-end, in which case the putting it at the root level of the answer hash probably makes things easier for someone parsing a JSON-ified version of the answer hash.

@Alex-Jordan do you still think this proposed change is helpful?

@Alex-Jordan
Copy link
Contributor Author

Alex-Jordan commented Oct 30, 2020 via email

@drgrice1
Copy link
Member

Okay. Sounds good. I will merge this then.

@drgrice1 drgrice1 merged commit a0da682 into openwebwork:develop Oct 30, 2020
@taniwallach
Copy link
Member

@Alex-Jordan -Thanks for the clarification. It's good to get some of these pending PRs merged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants