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

Exam mode: Fix displaying incorrect task in exam summary exercise #9294

Merged
merged 4 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,14 @@ export class ProgrammingExerciseInstructionComponent implements OnChanges, OnDes
// Insert anchor divs into the text so that injectable elements can be inserted into them.
// Without class="d-flex" the injected components height would be 0.
// Added zero-width space as content so the div actually consumes a line to prevent a <ol> display bug in Safari
acc.replace(new RegExp(escapeStringForUseInRegex(task), 'g'), `<div class="pe-task-${id.toString()} d-flex">&#8203;</div>`),
acc.replace(new RegExp(escapeStringForUseInRegex(task), 'g'), `<div class="pe-${this.exercise.id}-task-${id.toString()} d-flex">&#8203;</div>`),
problemStatementHtml,
);
}

private injectTasksIntoDocument = () => {
this.tasks.forEach(({ id, taskName, testIds }) => {
const taskHtmlContainers = document.getElementsByClassName(`pe-task-${id}`);
const taskHtmlContainers = document.getElementsByClassName(`pe-${this.exercise.id}-task-${id}`);

for (let i = 0; i < taskHtmlContainers.length; i++) {
const taskHtmlContainer = taskHtmlContainers[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"problemStatementBothFailedRendered": "<ol>\n<li><span class=\"bold\"><span id=step-icon-0></span> Implement Bubble Sort</span>: <span class=\"text-danger bold\">artemisApp.editor.testStatusLabels.noResult</span><br>\nImplement the method <code>performSort(List&lt;Date&gt;)</code> in the class <code>BubbleSort</code>. Make sure to follow the Bubble Sort algorithm exactly.</li>\n<li><span class=\"bold\"><span id=step-icon-1></span> Implement Merge Sort</span>: <span class=\"text-danger bold\">artemisApp.editor.testStatusLabels.noResult</span><br>\nImplement the method <code>performSort(List&lt;Date&gt;)</code> in the class <code>MergeSort</code>. Make sure to follow the Merge Sort algorithm exactly.</li>\n</ol>\n",
"problemStatementBothFailedHtml": "<ol>\n<li><span class=\"bold\"><span id=\"step-icon-0\"><fa-icon class=\"ng-fa-icon\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"times-circle\" class=\"svg-inline--fa fa-times-circle fa-w-16 fa-lg text-danger\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path fill=\"currentColor\" d=\"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm101.8-262.2L295.6 256l62.2 62.2c4.7 4.7 4.7 12.3 0 17l-22.6 22.6c-4.7 4.7-12.3 4.7-17 0L256 295.6l-62.2 62.2c-4.7 4.7-12.3 4.7-17 0l-22.6-22.6c-4.7-4.7-4.7-12.3 0-17l62.2-62.2-62.2-62.2c-4.7-4.7-4.7-12.3 0-17l22.6-22.6c4.7-4.7 12.3-4.7 17 0l62.2 62.2 62.2-62.2c4.7-4.7 12.3-4.7 17 0l22.6 22.6c4.7 4.7 4.7 12.3 0 17z\"></path></svg></fa-icon></span> Implement Bubble Sort</span>: <a data-tests=\"testBubbleSort\" class=\"test-status\"><span class=\"text-danger result\">artemisApp.editor.testStatusLabels.testFailing</span></a><br>\nImplement the method <code>performSort(List&lt;Date&gt;)</code> in the class <code>BubbleSort</code>. Make sure to follow the Bubble Sort algorithm exactly.</li>\n<li><span class=\"bold\"><span id=\"step-icon-1\"><fa-icon class=\"ng-fa-icon\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"check-circle\" class=\"svg-inline--fa fa-check-circle fa-w-16 fa-lg text-success\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path fill=\"currentColor\" d=\"M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 48c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m140.204 130.267l-22.536-22.718c-4.667-4.705-12.265-4.736-16.97-.068L215.346 303.697l-59.792-60.277c-4.667-4.705-12.265-4.736-16.97-.069l-22.719 22.536c-4.705 4.667-4.736 12.265-.068 16.971l90.781 91.516c4.667 4.705 12.265 4.736 16.97.068l172.589-171.204c4.704-4.668 4.734-12.266.067-16.971z\"></path></svg></fa-icon></span> Implement Merge Sort</span>: <span class=\"text-success bold\">artemisApp.editor.testStatusLabels.testPassing</span><br>\nImplement the method <code>performSort(List&lt;Date&gt;)</code> in the class <code>MergeSort</code>. Make sure to follow the Merge Sort algorithm exactly.</li>\n</ol>\n",
"problemStatementBubbleSortFailsRendered": "<ol>\n<li><span class=\"bold\"><span id=step-icon-0></span> Implement Bubble Sort</span>: <span class=\"text-danger bold\">artemisApp.editor.testStatusLabels.noResult</span><br>\nImplement the method <code>performSort(List&lt;Date&gt;)</code> in the class <code>BubbleSort</code>. Make sure to follow the Bubble Sort algorithm exactly.</li>\n<li><span class=\"bold\"><span id=step-icon-1></span> Implement Merge Sort</span>: <span class=\"text-danger bold\">artemisApp.editor.testStatusLabels.noResult</span><br>\nImplement the method <code>performSort(List&lt;Date&gt;)</code> in the class <code>MergeSort</code>. Make sure to follow the Merge Sort algorithm exactly.</li>\n</ol>\n",
"problemStatementBubbleSortNotExecutedHtml": "<ol>\n<li><div class=\"pe-task-0 d-flex\" ng-version=\"{{ANGULAR_VERSION}}\"><div class=\"guided-tour\"><!--container--><!--container--><fa-icon size=\"lg\" class=\"ng-fa-icon test-icon text-secondary\" ng-reflect-size=\"lg\" ng-reflect-icon=\"[object Object]\"><svg role=\"img\" aria-hidden=\"true\" focusable=\"false\" data-prefix=\"fas\" data-icon=\"circle-question\" class=\"svg-inline--fa fa-circle-question fa-lg\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path fill=\"currentColor\" d=\"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM169.8 165.3c7.9-22.3 29.1-37.3 52.8-37.3l58.3 0c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24l0-13.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1l-58.3 0c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z\"></path></svg></fa-icon><!--container--><span class=\"task-name\">Implement Bubble Sort</span><!--container--><span class=\"guided-tour test-status--linked text-secondary\">artemisApp.editor.testStatusLabels.totalTestsPassing: [{\"totalTests\":1,\"passedTests\":0}]</span><!--container--><!--container--></div></div> \nImplement the method <code>performSort(List&lt;Date&gt;)</code> in the class <code>BubbleSort</code>. Make sure to follow the Bubble Sort algorithm exactly. </li>\n<li><div class=\"pe-task-1 d-flex\" ng-version=\"{{ANGULAR_VERSION}}\"><div class=\"guided-tour success\"><fa-icon size=\"lg\" class=\"ng-fa-icon test-icon text-success\" ng-reflect-size=\"lg\" ng-reflect-icon=\"[object Object]\"><svg role=\"img\" aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"circle-check\" class=\"svg-inline--fa fa-circle-check fa-lg\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path fill=\"currentColor\" d=\"M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-111 111-47-47c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l64 64c9.4 9.4 24.6 9.4 33.9 0L369 209z\"></path></svg></fa-icon><!--container--><!--container--><!--container--><span class=\"task-name\">Implement Merge Sort</span><!--container--><span class=\"guided-tour test-status--linked text-success\">artemisApp.editor.testStatusLabels.totalTestsPassing: [{\"totalTests\":1,\"passedTests\":1}]</span><!--container--><!--container--></div></div> \nImplement the method <code>performSort(List&lt;Date&gt;)</code> in the class <code>MergeSort</code>. Make sure to follow the Merge Sort algorithm exactly.</li>\n</ol>",
"problemStatementBubbleSortNotExecutedHtml": "<ol>\n<li><div class=\"pe-3-task-0 d-flex\" ng-version=\"{{ANGULAR_VERSION}}\"><div class=\"guided-tour\"><!--container--><!--container--><fa-icon size=\"lg\" class=\"ng-fa-icon test-icon text-secondary\" ng-reflect-size=\"lg\" ng-reflect-icon=\"[object Object]\"><svg role=\"img\" aria-hidden=\"true\" focusable=\"false\" data-prefix=\"fas\" data-icon=\"circle-question\" class=\"svg-inline--fa fa-circle-question fa-lg\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path fill=\"currentColor\" d=\"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM169.8 165.3c7.9-22.3 29.1-37.3 52.8-37.3l58.3 0c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24l0-13.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1l-58.3 0c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z\"></path></svg></fa-icon><!--container--><span class=\"task-name\">Implement Bubble Sort</span><!--container--><span class=\"guided-tour test-status--linked text-secondary\">artemisApp.editor.testStatusLabels.totalTestsPassing: [{\"totalTests\":1,\"passedTests\":0}]</span><!--container--><!--container--></div></div> \nImplement the method <code>performSort(List&lt;Date&gt;)</code> in the class <code>BubbleSort</code>. Make sure to follow the Bubble Sort algorithm exactly. </li>\n<li><div class=\"pe-3-task-1 d-flex\" ng-version=\"{{ANGULAR_VERSION}}\"><div class=\"guided-tour success\"><fa-icon size=\"lg\" class=\"ng-fa-icon test-icon text-success\" ng-reflect-size=\"lg\" ng-reflect-icon=\"[object Object]\"><svg role=\"img\" aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"circle-check\" class=\"svg-inline--fa fa-circle-check fa-lg\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path fill=\"currentColor\" d=\"M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-111 111-47-47c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l64 64c9.4 9.4 24.6 9.4 33.9 0L369 209z\"></path></svg></fa-icon><!--container--><!--container--><!--container--><span class=\"task-name\">Implement Merge Sort</span><!--container--><span class=\"guided-tour test-status--linked text-success\">artemisApp.editor.testStatusLabels.totalTestsPassing: [{\"totalTests\":1,\"passedTests\":1}]</span><!--container--><!--container--></div></div> \nImplement the method <code>performSort(List&lt;Date&gt;)</code> in the class <code>MergeSort</code>. Make sure to follow the Merge Sort algorithm exactly.</li>\n</ol>",
Copy link
Contributor Author

@SimonEntholzer SimonEntholzer Sep 6, 2024

Choose a reason for hiding this comment

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

the only change here is changing "pe-task-0" to "pe-3-task-0" (programming exercise with id 3, and task with id 0) and "pe-task-1" to "pe-3-task-1"

"problemStatementEmptySecondTask": "1. [task][Bubble Sort](<testid>1</testid>) \n Implement the method. \n 2. [task][Merge Sort]() \n Implement the method.",
"problemStatementEmptySecondTaskNotExecutedHtml": "<ol>\n<li><div class=\"pe-task-0 d-flex\" ng-version=\"{{ANGULAR_VERSION}}\"><div class=\"guided-tour success\"><fa-icon size=\"lg\" class=\"ng-fa-icon test-icon text-success\" ng-reflect-size=\"lg\" ng-reflect-icon=\"[object Object]\"><svg role=\"img\" aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"circle-check\" class=\"svg-inline--fa fa-circle-check fa-lg\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path fill=\"currentColor\" d=\"M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-111 111-47-47c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l64 64c9.4 9.4 24.6 9.4 33.9 0L369 209z\"></path></svg></fa-icon><!--container--><!--container--><!--container--><span class=\"task-name\">Bubble Sort</span><!--container--><span class=\"guided-tour test-status--linked text-success\">artemisApp.editor.testStatusLabels.totalTestsPassing: [{\"totalTests\":1,\"passedTests\":1}]</span><!--container--><!--container--></div></div> \nImplement the method. </li>\n<li><div class=\"pe-task-1 d-flex\" ng-version=\"{{ANGULAR_VERSION}}\"><div class=\"guided-tour\"><!--container--><!--container--><fa-icon size=\"lg\" class=\"ng-fa-icon test-icon text-secondary\" ng-reflect-size=\"lg\" ng-reflect-icon=\"[object Object]\"><svg role=\"img\" aria-hidden=\"true\" focusable=\"false\" data-prefix=\"fas\" data-icon=\"circle-question\" class=\"svg-inline--fa fa-circle-question fa-lg\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path fill=\"currentColor\" d=\"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM169.8 165.3c7.9-22.3 29.1-37.3 52.8-37.3l58.3 0c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24l0-13.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1l-58.3 0c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z\"></path></svg></fa-icon><!--container--><span class=\"task-name\">Merge Sort</span><!--container--><!--container--><span class=\"text-secondary\">artemisApp.editor.testStatusLabels.noTests</span><!--container--></div></div> \nImplement the method.</li>\n</ol>",
"problemStatementEmptySecondTaskNotExecutedHtml": "<ol>\n<li><div class=\"pe-3-task-0 d-flex\" ng-version=\"{{ANGULAR_VERSION}}\"><div class=\"guided-tour success\"><fa-icon size=\"lg\" class=\"ng-fa-icon test-icon text-success\" ng-reflect-size=\"lg\" ng-reflect-icon=\"[object Object]\"><svg role=\"img\" aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"circle-check\" class=\"svg-inline--fa fa-circle-check fa-lg\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path fill=\"currentColor\" d=\"M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-111 111-47-47c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l64 64c9.4 9.4 24.6 9.4 33.9 0L369 209z\"></path></svg></fa-icon><!--container--><!--container--><!--container--><span class=\"task-name\">Bubble Sort</span><!--container--><span class=\"guided-tour test-status--linked text-success\">artemisApp.editor.testStatusLabels.totalTestsPassing: [{\"totalTests\":1,\"passedTests\":1}]</span><!--container--><!--container--></div></div> \nImplement the method. </li>\n<li><div class=\"pe-3-task-1 d-flex\" ng-version=\"{{ANGULAR_VERSION}}\"><div class=\"guided-tour\"><!--container--><!--container--><fa-icon size=\"lg\" class=\"ng-fa-icon test-icon text-secondary\" ng-reflect-size=\"lg\" ng-reflect-icon=\"[object Object]\"><svg role=\"img\" aria-hidden=\"true\" focusable=\"false\" data-prefix=\"fas\" data-icon=\"circle-question\" class=\"svg-inline--fa fa-circle-question fa-lg\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path fill=\"currentColor\" d=\"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM169.8 165.3c7.9-22.3 29.1-37.3 52.8-37.3l58.3 0c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24l0-13.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1l-58.3 0c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z\"></path></svg></fa-icon><!--container--><span class=\"task-name\">Merge Sort</span><!--container--><!--container--><span class=\"text-secondary\">artemisApp.editor.testStatusLabels.noTests</span><!--container--></div></div> \nImplement the method.</li>\n</ol>",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same here

"problemStatementPlantUMLWithTest": "@startuml\nclass Policy {\n<color:testsColor(<testid>1</testid>)>+configure()</color>\n<color:testsColor(<testid>2</testid>)>+testWithParenthesis()</color>}\n@enduml"
}
Loading