-
Notifications
You must be signed in to change notification settings - Fork 214
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
Sort scoreboard beyond third column, improve CUD validations #1925
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reviewpad
bot
added
medium
Pull request is medium
and removed
small
Pull request is small
labels
Jun 15, 2023
damianhxy
commented
Jun 15, 2023
reviewpad
bot
added
small
Pull request is small
and removed
medium
Pull request is medium
labels
Jun 15, 2023
reviewpad
bot
added
medium
Pull request is medium
and removed
small
Pull request is small
labels
Jun 16, 2023
damianhxy
changed the title
Add scoreboard sort beyond third column
Sort scoreboard beyond third column, improve CUD validations
Jun 16, 2023
najclark
approved these changes
Jun 21, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, testing behavior looks correct
NicholasMy
pushed a commit
to UB-CSE-IT/Autolab
that referenced
this pull request
Jan 3, 2024
…#1925) * Update styling * Allow columns beyond col 3 to be sorted * Update documentation * Remove unnecessary checks * Update colspec validations * Remove unnecessary error display * Add maxlength 32 to nickname field * Fix syntax of valid_nickname? validation * Display errors for edit page directly in flash * Skip validation if nickname is nil * Standardize new page with edit page * Update validation js * Add space in maxlength * Make error message consistent (cherry picked from commit e62ca22)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Summary generated by Reviewpad on 21 Jun 23 18:44 UTC
This pull request includes changes to several files. The file 'scoreboards.md' has a minor change, sorting all columns in descending order and tie-breaking by submission time. The view file 'app/views/course_user_data/new.html.erb' has several updates, including adding a javascript_include_tag and modifying the onclick function of the submit button. The Scoreboard view has also been updated in the 'scoreboard.rb' file in the 'app/models' directory, including a validation check for the column specification and refactored code to handle all scoreboard columns. Changes have been made to the
CourseUserDataController
in the Rails application, including modifying error messages and allowing for HTML in the flash[:error] message. The form validation function and nickname validation method have also been updated.Description
Motivation and Context
Currently, only the first three columns of any scoreboard is sorted (when using a custom column specification). This PR remedies that so all columns are now sorted.
Note: I don't expect this to break any scoreboard code, since scoreboards generally consist of numeric data. Even if they contain string data,
to_f
casts non-numeric strings to0.0
, which is as good as not sorting.Closes #970
Furthermore, the custom form validation for the nickname fields is currently broken and does not work. Validation errors are also not shown since a redirect takes place.
This PR fixes the validation code, shows errors in flashes instead, and adds more visual cues (e.g. set
maxlength
= 32, indicate in help text)How Has This Been Tested?
Install the following assessment (after unzipping):
randomlab_20230616.tar.zip
Submit any file using three different student accounts. View scoreboard.
Before
Specification:
{"scoreboard": [ {"hdr":"Problem 1"}, {"hdr":"Problem 2"}, {"hdr":"Problem 3"}, {"hdr":"Problem 4"}, {"hdr":"Problem 5"}, {"hdr":"Problem 6"} ] }
Observe:
PROBLEM 6
(noasc
ordesc
)Observe: last column not sorted (tiebreak by time)
After (Descending)
Specification:
{"scoreboard": [ {"hdr":"Problem 1"}, {"hdr":"Problem 2"}, {"hdr":"Problem 3"}, {"hdr":"Problem 4"}, {"hdr":"Problem 5"}, {"hdr":"Problem 6"} ] }
Observe:
PROBLEM 6 [desc]
Observe: last column sorted in descending order
After (Ascending)
Specification:
{"scoreboard": [ {"hdr":"Problem 1"}, {"hdr":"Problem 2"}, {"hdr":"Problem 3"}, {"hdr":"Problem 4"}, {"hdr":"Problem 5"}, {"hdr":"Problem 6", "asc": 1} ] }
Observe:
PROBLEM 6 [asc]
Observe: last column sorted in ascending order
Others
Column specification
true
-> get errorColspec must be a hash object
Colspec 451: unexpected token at '{hdr:"Problem 6"} ] }'
Form validation
12345678123456781234567812345678你好
)Updating via Scoreboard or Edit page
Creation
Types of changes
Checklist:
overcommit --install && overcommit --sign
to use pre-commit hook for linting