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

button to randomize individual seeds on set detail page for one user #2271

Merged
merged 3 commits into from
Jan 15, 2024

Conversation

Alex-Jordan
Copy link
Contributor

This is a first stab at making it easier to randomize seeds, as discussed in #1151.

In a Set Detail page for one user:

  • The seed field is changed to type='number' to give a quick way to shift a seed by 1 at a time, which I find helpful if there might be a need to revert to some previous seed.
  • This (inelegantly in the code) puts a button next to the seed input field that you can use to re-randomize the seed.

After any changes, the Save button still needs to be used to submit the form.

Screenshot 2023-12-05 at 10 28 55 AM

If this is on the right track, I will add a button somewhere at the top to randomize all of the seeds at once. If it is not too much clutter, there will be an option to only randomize those seeds with status less than 1.

A future PR will have a button on the "Set Detail page for multiple users" that randomizes seeds for all users and goes ahead with the action, reloading the page. And this PR will add a tool to Instructor Tools for doing the same thing, possible with multiple sets too.

@drgrice1
Copy link
Member

drgrice1 commented Dec 5, 2023

The button itself looks fine. I added a pull request to this branch with suggestions for code improvement. Most importantly the inline javascript is moved out of the Perl module, and into the htdocs/js/ProblemSetDetail/problemsetdetail.js file.

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.

Looks good. I am looking forward to the other aspects for randomizing for multiple users.

@Alex-Jordan
Copy link
Contributor Author

Now with a button to randomize all seeds for one user for one set.

I strongly suspect the javascript can be improved upon. One thing for sure is it looks up the checkbox state over and over within the loop. I couldn't work out how to do that better without getting js errors.

@Alex-Jordan Alex-Jordan force-pushed the randomize-seeds branch 2 times, most recently from f1ee4d3 to 6691680 Compare December 16, 2023 23:30
@Alex-Jordan
Copy link
Contributor Author

Rebased, including with the correction mentioned here.

This is as far as I plan to take this PR. The other tools I want to add for randomization can come later.

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.

Looks good for now. Lets get this in so @Alex-Jordan can continue with other related changes as planned.

Alex-Jordan and others added 3 commits January 9, 2024 20:28
Inline javascript is bad form.  There is already a javascript file
dedicated to the ProblemSetDetail.pm page, so put the javascript there
instead.

The return value of the Mojolicious::Plugin::TagHelpers `tag` method is
already a Mojo::ByteStream object.  The issue that causes the display to
not work is that the contents of the `div` are not, since they are just
bare strings concatentated together, and so they are html escaped.  So
use a Mojo::Collection that is joined by the empty string.  That also
returns a Mojo::ByteStream object, and so it is not html escaped. This
is also consistent with how I have done this sort of thing elsewhere in
the code.

Also remove what appears to be an errant `warn` statement.
@drgrice1 drgrice1 merged commit 2ed01cf into openwebwork:develop Jan 15, 2024
1 check passed
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.

3 participants