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

color coding for answers #500

Merged
merged 8 commits into from
Sep 18, 2024
Merged

color coding for answers #500

merged 8 commits into from
Sep 18, 2024

Conversation

shraddha
Copy link
Collaborator

@shraddha shraddha commented Aug 6, 2024

Fixed the issue - Color-coding of the answers for pretest and posttest pages needs to be fixed. #499 (#499)

Fixed the issue - Color-coding of the answers for pretest and posttest pages needs to be fixed. #499 (#499)
@shraddha shraddha added the bug Something isn't working label Aug 6, 2024
@shraddha shraddha requested a review from raj-vlabs August 6, 2024 10:18
@shraddha shraddha self-assigned this Aug 6, 2024
Fixed the issue - Color-coding of the answers for pretest and posttest pages needs to be fixed. #499 (#499)
Copy link
Collaborator

@raj-vlabs raj-vlabs left a comment

Choose a reason for hiding this comment

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

I still see major problems with the code. Please make sure that you are submitting the final code for review.

}

populateQuestions();
addEventListener_explanations();
addEventListener_checkbox();
submitButton.addEventListener("click", showResults);

populateQuestions();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why have calls to these functions been repeated?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, it was a mistake I might have made while merging.

@shraddha shraddha requested a review from raj-vlabs August 12, 2024 09:40
@shraddha shraddha requested a review from priya100raman August 16, 2024 16:20
This fix is with reference to the issue : Form submission and Include screenshot - functionality needs fixing #13 (link - virtual-labs/svc-bug-report#13)
@@ -1,8 +1,11 @@
"use-strict";

// Ensure dataLayer is defined Globally before using it
window.dataLayer = window.dataLayer || [];
Copy link
Collaborator

Choose a reason for hiding this comment

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

dataLayer has not been used in the changed code anywhere. Why are we re-initializing it? This may affect other code which may be doing similar checks.
If you want to avoid errors which may arise due to pushing into an undefined dataLayer object, you may add a conditionalto check if dataLayer is defined before you push into it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This code was modified to fix the error mentioned in the issue #506
data_layer_error

I agree with you about adding a conditional check before pushing, and will modify the code accordingly. Thanks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Raj, I tried to re-create the error by removing the global setting commit, but somehow I am not able to reproduce the bug. Now, if I make changes with just conditional checks instead of global settings, I will not be able to test it. Kindly advice if I should go ahead with these changes, then I will commit accordingly.


// if answer is correct
if (userAnswer === currentQuestion.correctAnswer) {
// Color the correct answer lightgreen
Copy link
Collaborator

Choose a reason for hiding this comment

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

The code that was marking all options in black has been removed. What happens when the user submits a quiz once, then goes back, changes some of the options and submits it again.
In this case some of the wrong options would be marked red and others would be marked black.
Please test this scenario before we can move ahead with this PR.

Copy link
Collaborator Author

@shraddha shraddha Aug 29, 2024

Choose a reason for hiding this comment

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

In this case some of the wrong options would be marked red and others would be marked black.>>> yes, it does exactly the same. That way the user understands the number of wrong attempts made. If the user reaches the right answer, that will also made green. I have followed up the previous green-red coloring logic. I am not sure why we will make the other options black. It starts with black, and according to selection, the text color changes. If we have a restart quiz button, we can make all the answers black again. Please let me know if my understanding of the fix itself is wrong.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I kind of agree with your argument. Let's run it through Priya once to see what she thinks about it.

@shraddha shraddha linked an issue Sep 7, 2024 that may be closed by this pull request
fix for Rating of a lab is not shown at all.
(#522)
Removed the global initialization of dataLayer and added conditional checks for dataLayer.

Ref - #506
@raj-vlabs raj-vlabs merged commit b683f26 into master Sep 18, 2024
@raj-vlabs raj-vlabs deleted the modifications-2024 branch September 18, 2024 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants