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

When sorting achievements, make level achievements last. #2643

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

somiaj
Copy link
Contributor

@somiaj somiaj commented Dec 16, 2024

Level achievements need to be processed last, and currently an instructor can edit achievement numbers which could place some achievements after the level achievements.

Update the sortAchievements utility method to always place level achievements at the end of the list.

This was brought up in the review of #2579.

@drgrice1
Copy link
Member

I don't think this is the right way to go. The achievement "Number" is supposed to be its evaluation order.

I don't think this is a sorting issue at all. It is that line 143 in lib/WeBWorK/ContentGenerator/Achievements.pm and other places that skip level achievements in a for loop (like your added code in #2579) should use next instead of last. Skip the level achievements, but deal with the rest. The evaluation order doesn't matter for that processing.

Also, according to the help on the "Achievements Manager" page the level achievements need to be evaluated first, not last. So that probably needs to be fixed.

I think in general we need to kill the webwork2 achievements as they are, and start over. The design is to flawed to go forward. There really is no need for them to be Perl code executed in Safe. A versatile achievement system could certainly be implemented without that. Of course, for now we are stuck with what we have.

@somiaj
Copy link
Contributor Author

somiaj commented Dec 17, 2024

I went with this approach for updating the sorting order instead of changing the last to next because I couldn't think of any case that level achievements should be evaluated before any other achievements (also seems the help agrees with this assuming 'first' should have been 'last' was just a typo). I also didn't see anywhere in AchievementEvaluator.pm forcing the level achievements to be last outside of their order, so forcing the sort to put level achievements last will make sure that they are always evaluated last like the help probably should have stated, and also make the last statements work as expected. I think it was just always assumed level achievements should be last.

I can go with your proposal if you think it would be better to just support allowing level achievements to not be last, I just think this would cause the issue of students passing level boundaries and then not being awarded the correct level.

I agree a newer approach to achievements could be useful, I was just trying to apply a bandaid to what we currently have.

@somiaj somiaj force-pushed the sort-level-achievements-last branch from 57a03ab to 81ae183 Compare December 17, 2024 18:47
Level achievements need to be processed last, and currently an
instructor can edit achievement numbers which could place some
achievements after the level achievements.

Update the sortAchievements utility method to always place level
achievements at the end of the list.
@somiaj somiaj force-pushed the sort-level-achievements-last branch from 81ae183 to f28f78e Compare December 17, 2024 18:47
@somiaj
Copy link
Contributor Author

somiaj commented Dec 17, 2024

I also updated the help to state level achievements are processed last, not first.

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

Successfully merging this pull request may close these issues.

2 participants