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

macros/graph/PGnauGraphics.pl doesn't use unique name, which can break tests. #1064

Open
somiaj opened this issue Apr 19, 2024 · 1 comment

Comments

@somiaj
Copy link
Contributor

somiaj commented Apr 19, 2024

The old checkbox_table and radio_table macros in macros/graph/PGnauGraphics.pl don't use a unique name, so if more than one problem is used with this macro on a test, the answers get confused since the name is fixed. I'm not sure on a proper fix (so opening up an issue), but here is my suggested fix (that works for my testing). I would suggest this could probably be worth an hotfix once a proper fix is found.

diff --git a/macros/graph/PGnauGraphics.pl b/macros/graph/PGnauGraphics.pl
index 728ba259..595f6866 100644
--- a/macros/graph/PGnauGraphics.pl
+++ b/macros/graph/PGnauGraphics.pl
@@ -124,12 +124,12 @@ sub checkbox_table {
                }
        }
 
+       $name = main::NEW_ANS_NAME();
        for ($i = 0; $i < $count; $i++) {
                $true = '';
                $val1 = "ans$i";
                $val2 = "labels$i";
                $val3 = "rule$i";
-               $name = "CheckBoxName$i";
                for ($j = 0; $j < $size; $j++) {
                        $letter = $ALPHABET[$j];
                        if ($$val2[$j] eq '') {
@@ -273,12 +273,12 @@ sub radio_table {
                }
        }
 
+       $name = main::NEW_ANS_NAME();
        for ($i = 0; $i < $count; $i++) {
                $true = '';
                $val1 = "ans$i";
                $val2 = "labels$i";
                $val3 = "rule$i";
-               $name = "CheckBoxName$i";
                for ($j = 0; $j < $size; $j++) {
                        $letter = $ALPHABET[$j];
                        if ($$val2[$j] eq '') {
@drgrice1
Copy link
Member

The proper fix is to move the macro into deprecated, and not use it.

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

No branches or pull requests

2 participants