-
Notifications
You must be signed in to change notification settings - Fork 227
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
Refactor Assessment name rules, remove config file requirement #1987
Conversation
…le can't be loaded, run robocop
WalkthroughWalkthroughWalkthroughThe changes in this pull request primarily focus on improving the handling and validation of assessment names and configuration files in an Autolab application. The changes allow for more flexibility in assessment names, including the use of hyphens and underscores. The configuration files for each assessment are now uniquely named, and the code handles exceptions when loading these files. The user interface and documentation have been updated to reflect these changes. Changes
Assessment against linked issues (Beta)
TipsChat with CodeRabbit Bot (
|
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.
Review Status
Actionable comments generated: 5
Configuration used: CodeRabbit UI
Files ignored due to filter (2)
- spec/fixtures/assessments/homework02-illegal-assessment-name.tar
- spec/fixtures/assessments/homework02-legal-name-no-config.tar
Files selected for processing (10)
- app/controllers/assessment/autograde.rb (1 hunks)
- app/controllers/assessments_controller.rb (10 hunks)
- app/controllers/scoreboards_controller.rb (1 hunks)
- app/helpers/assessment_autograde_core.rb (2 hunks)
- app/models/assessment.rb (7 hunks)
- app/models/oauth_device_flow_request.rb (1 hunks)
- app/models/user.rb (1 hunks)
- app/views/assessments/_edit_basic.html.erb (1 hunks)
- docs/lab.md (1 hunks)
- spec/controllers/assessments_controller_spec.rb (6 hunks)
Files skipped from review due to trivial changes (3)
- app/controllers/scoreboards_controller.rb
- app/models/user.rb
- docs/lab.md
Additional comments: 23
app/models/oauth_device_flow_request.rb (1)
- 6-7: No changes have been made in these lines. The validations for
device_code
,user_code
,requested_at
, andoauth_application
remain the same.app/views/assessments/_edit_basic.html.erb (1)
- 26-30: The addition of the "Reload Course Config" link is a good feature for user convenience. However, it's important to ensure that the
:reload
action is properly defined and secured in the controller to prevent unauthorized access or misuse. Also, the sentence "In the case that" seems to be incomplete and may confuse users. Please complete the sentence or remove it if it's not necessary.- In the case that
app/controllers/assessment/autograde.rb (1)
- 31-35: The new code introduces a conditional check for whether the assessment uses a unique module name. If it does, it requires the unique config file path. If not, it requires the original config file path. This change seems to be in line with the PR summary, which mentions that module names no longer need to match assessment names and that unique identifiers are used instead. However, it's important to ensure that the
use_unique_module_name
attribute and theunique_config_file_path
method are properly defined and return the expected values. Also, consider handling the case where the required file does not exist or cannot be loaded due to an error. This could be done by wrapping therequire_relative
calls in a begin-rescue block and handling theLoadError
exception.begin if (@assessment.use_unique_module_name) require_relative(@assessment.unique_config_file_path) else require_relative(Rails.root.join("assessmentConfig", "#{@course.name}-#{@assessment.name}.rb")) end rescue LoadError => e # Handle the error, e.g., log it or display a user-friendly message endspec/controllers/assessments_controller_spec.rb (3)
4-4: The
render_views
directive is added. This directive tells RSpec to render views (in addition to running the controller methods) when running the controller specs. This can be useful if you want to test the full stack, including routing, controllers, and views, but it can slow down your tests. Make sure this is the intended behavior.83-83: No significant changes, the line is identical to the old hunk.
114-120: The test now checks if the unique config file exists after the assessment is created and if it contains the unique config module name. It also cleans up the created config file after the test. This is a good practice as it verifies the creation of the config file and its content, and also ensures that test artifacts are cleaned up.
app/models/assessment.rb (8)
128-150: The new methods
unique_config_file_path
,unique_config_backup_file_path
,config_module_name
,unique_config_module_name
, anduse_unique_module_name
are introduced to handle unique configuration files for each assessment. This is a good approach to isolate each assessment's configuration and avoid potential conflicts. However, it's important to ensure that these unique files are properly cleaned up when they are no longer needed to avoid cluttering the file system.204-215: The
construct_default_config_file
method has been updated to useunique_source_config_file_path
instead ofsource_config_file_path
. This change aligns with the new approach of using unique configuration files for each assessment. The method also replaces the placeholders##NAME_CAMEL##
and##NAME_LOWER##
in the default configuration file withunique_config_module_name
andname
respectively. This ensures that the default configuration file is properly customized for each assessment.226-269: The
load_config_file
method has been significantly updated to handle the migration of old source configuration files to the new unique configuration files. The method checks if the old source configuration file exists and if its path is different from the new unique source configuration file path. If both conditions are met, the method reads the old source configuration file, renames the module name in the file if it doesn't match the new unique naming scheme, writes the updated source to the new unique source configuration file path, and renames the old source configuration file to a backup file. This is a good approach to ensure backward compatibility while transitioning to the new unique configuration files. However, it's important to handle any potential exceptions that might occur during file operations to avoid data loss or corruption.406-413: The new methods
unique_source_config_file_path
andsource_config_file_backup_path
are introduced to handle the paths of the unique source configuration files and their backup files. This aligns with the new approach of using unique configuration files for each assessment.436-438: The new method
unique_source_config_module_name
is introduced to return the name of the unique source configuration module. This aligns with the new approach of using unique configuration files for each assessment.448-461: The
reload_config_file
method has been updated to handle the removal of the previously loaded unique configuration module and the loading of the unique configuration file. This ensures that the latest version of the unique configuration file is always loaded.462-467: The
config_file_updated?
method has been updated to check the last modified time of the unique configuration file instead of the old source configuration file. This ensures that the method correctly determines if the unique configuration file has been updated.634-636: The
sanitized_name
method has been updated to remove both periods and hyphens from the name. This change aligns with the new naming rules that allow assessment names to contain hyphens and underscores.app/controllers/assessments_controller.rb (9)
114-121: The new regex for validating assessment names is more permissive, allowing for underscores and hyphens in addition to lowercase letters and digits. This change aligns with the PR summary and seems to be a deliberate decision. However, it's important to ensure that this change doesn't introduce any unexpected behavior elsewhere in the codebase where assessment names are used. For example, if assessment names are used in URLs, hyphens and underscores could potentially cause issues.
175-175: The requirement for an assessment Ruby file in the tarball has been removed. This change is consistent with the PR summary, which mentions that the requirement for config files has been removed. However, it's important to verify that this doesn't break any functionality that depends on the presence of an assessment Ruby file.
295-314: The logic for validating and sanitizing assessment names has been updated. The new logic allows for hyphens and underscores in addition to lowercase letters and digits, and it removes special characters from the display name to create the assessment name. This change aligns with the PR summary and seems to be a deliberate decision. However, it's important to ensure that this change doesn't introduce any unexpected behavior elsewhere in the codebase where assessment names are used.
364-369: Exception handling has been added for reloading the course config file. This is a good practice as it prevents the application from crashing if an error occurs during the reload. However, it's important to ensure that the error is handled appropriately and that the user is informed of the issue.
508-513: The code now deletes unique config files and unique config backup files when an assessment is destroyed. This is a good practice as it helps to keep the file system clean and prevents orphaned files from accumulating. However, it's important to ensure that these files are not needed elsewhere in the application before they are deleted.
525-539: Exception handling has been added for loading the config file. This is a good practice as it prevents the application from crashing if an error occurs during the load. However, it's important to ensure that the error is handled appropriately and that the user is informed of the issue.
792-792: The rescue clause has been updated to also catch
SyntaxError
exceptions. This is a good practice as it allows the application to handle syntax errors in the config file gracefully.830-830: The code now writes the config source to a unique source config file path instead of the source config file path. This change aligns with the PR summary, which mentions that module names no longer need to match the assessment names. However, it's important to ensure that this change doesn't introduce any unexpected behavior elsewhere in the codebase where the config file path is used.
1061-1087: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [1028-1084]
The logic for validating assessment tar files has been updated. The new logic checks for the presence of an assessment YAML file but no longer checks for an assessment Ruby file. This change aligns with the PR summary, which mentions that the requirement for config files has been removed. However, it's important to verify that this doesn't break any functionality that depends on the presence of an assessment Ruby file.
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- spec/controllers/assessments_controller_spec.rb (6 hunks)
Additional comments: 5
spec/controllers/assessments_controller_spec.rb (5)
1-7: The
render_views
method is used to render views in the controller tests. This is a good practice as it allows you to test the controller and view together. However, it can slow down your tests if used across all controller tests. Consider using it only in specific tests where necessary.13-62: The "Create Assessment" context has been added to test the creation of assessments when the user is an instructor. It includes two test cases: one for rejecting bad assessment display names and another for sanitizing assessment display names. The tests seem to cover the main scenarios and are well written.
159-179: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [64-178]
The "Export and Import Roundtrip" context has been updated with additional test cases for handling assessment import and export. These include handling nil tarfile, bad tarfile, yaml file name mismatch, legal assessment name, broken yaml file, any module name, module with bad syntax, and mismatched same name error. The tests are comprehensive and cover a wide range of scenarios.
146-152: The test case "handles legal assessment name" has been updated to expect a success flash message. This is in line with the PR summary, which mentions that the assessment naming rules have been relaxed.
163-177: The test case "handles any module name" has been updated to expect a success flash message. This is in line with the PR summary, which mentions that module names no longer need to match assessment names.
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- app/controllers/assessments_controller.rb (10 hunks)
Additional comments: 10
app/controllers/assessments_controller.rb (10)
114-120: The validation of the assessment name has been updated to allow hyphens and underscores in addition to the existing rules. Ensure that this change is reflected in all places where assessment names are validated or used. Also, make sure that the documentation link provided is up-to-date and correctly explains the new naming rules.
174-174: The error message has been updated to remove the mention of an assessment ruby file. Ensure that this change is consistent with the new functionality and does not confuse users.
294-313: The validation of the assessment name during assessment creation has been updated to allow hyphens in addition to the existing rules. The assessment name is sanitized by removing special characters and spaces. If the sanitized name does not match the required identifier structure, an error is displayed and the user is redirected to the install assessment action. Ensure that this change is reflected in all places where assessment names are validated or used. Also, make sure that the documentation link provided is up-to-date and correctly explains the new naming rules.
363-368: Error handling has been added to handle errors when reloading the course config file. If an error occurs, the reload view is rendered. This is a good practice as it improves the robustness of the application.
507-512: Additional file deletions have been added for unique configuration files when an assessment is destroyed. This is a good practice as it ensures that all related files are cleaned up when an assessment is deleted.
524-538: Error handling has been added to handle errors when loading the config file. If an error occurs, an appropriate error message is displayed and the user is redirected to the appropriate page based on their authorization level. This is a good practice as it improves the robustness of the application and provides useful feedback to the user.
791-791: Error handling has been added to handle errors when reloading the config file. If an error occurs, the reload view is rendered. This is a good practice as it improves the robustness of the application.
829-832: The file path for the assessment config file has been updated to use the unique file path. This is a good practice as it ensures that each assessment has its own unique config file, preventing conflicts between different assessments.
1027-1030: No changes have been made in this hunk. It's just a comment explaining the purpose of the
valid_asmt_tar
method.1063-1083: The validation of the assessment name during assessment import has been updated to allow hyphens in addition to the existing rules. If the assessment name is invalid or the assessment yaml file does not exist, an appropriate error message is displayed. Ensure that this change is reflected in all places where assessment names are validated or used. Also, make sure that the documentation link provided is up-to-date and correctly explains the new naming rules.
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.
Review Status
Actionable comments generated: 3
Configuration used: CodeRabbit UI
Files selected for processing (5)
- app/controllers/assessments_controller.rb (11 hunks)
- app/helpers/assessment_autograde_core.rb (2 hunks)
- app/models/assessment.rb (8 hunks)
- app/views/assessments/_edit_basic.html.erb (1 hunks)
- docs/lab.md (1 hunks)
Files skipped from review due to trivial changes (1)
- app/views/assessments/_edit_basic.html.erb
Additional comments: 22
docs/lab.md (4)
394-396: The added explanation about why Autolab is not able to stream stdout output during autograding is clear and informative. It provides useful links for users to understand how to flush the buffer in different programming languages.
400-413: The instructions for importing assessments via tar and file system are clear and concise. It's good that you've mentioned the minimum requirements for an assessment.
417-441: The rules for assessment naming in Autolab, including valid and invalid assessment names, are well explained. This will help users avoid errors when naming their assessments.
442-445: The added information about generating the assessment "name" based on the "display name" and the restrictions on special characters is useful. It's good that you've mentioned what happens when a valid "name" cannot be generated.
app/models/assessment.rb (8)
46-50: The new constants
VALID_NAME_REGEX
andVALID_NAME_SANITIZER_REGEX
are added for validating and sanitizing the assessment name. Ensure that these regex patterns are correct and meet the requirements.126-151: The methods
config_file_path
,unique_config_file_path
,config_backup_file_path
,unique_config_backup_file_path
,config_module_name
,unique_config_module_name
, anduse_unique_module_name
are added or modified to handle the unique naming of config files. Ensure that these methods are correctly implemented and used throughout the codebase.202-218: The
construct_default_config_file
method is updated to use the unique source config file path. Ensure that the default config file is correctly constructed and the assessment information is correctly updated.224-270: The
load_config_file
method is updated to handle the migration of old source config file paths and the renaming of module names. Ensure that the config file is correctly loaded and the raw scores are invalidated when the config file is updated.404-414: The methods
source_config_file_path
andunique_source_config_file_path
are added or modified to handle the unique source config file path. Ensure that these methods are correctly implemented and used throughout the codebase.434-439: The methods
source_config_module_name
andunique_source_config_module_name
are added to handle the unique source config module name. Ensure that these methods are correctly implemented and used throughout the codebase.446-471: The
reload_config_file
andconfig_file_updated?
methods are updated to handle the reloading of the unique config file and checking if the config file is updated. Ensure that the config file is correctly reloaded and the updated check is correctly performed.632-636: The
sanitized_name
method is added to sanitize the assessment name by removing hyphens and dots. Ensure that the assessment name is correctly sanitized.app/controllers/assessments_controller.rb (10)
114-120: The error message is informative and provides a link to the documentation for more details. Good practice.
174-174: The error message is clear and provides the user with the necessary information to correct the issue.
266-266: Good use of logging to help debug issues.
377-382: Good use of exception handling when reloading the course config file. It's important to handle potential errors in this operation to prevent the application from crashing.
521-526: Good practice to clean up and delete unnecessary files when destroying an assessment.
538-552: Good use of exception handling when loading the config file. The error messages are informative and provide the user with the necessary information to correct the issue.
805-805: Good use of exception handling when loading the config file. It's important to handle potential errors in this operation to prevent the application from crashing.
843-843: Good practice to write the uploaded config file to the assessment's unique source config file path.
1041-1044: The comment provides a clear explanation of what a valid assessment tar file should look like. This is helpful for understanding the following code.
1077-1097: The code is validating the assessment tar file and providing informative error messages if the validation fails. This is good practice.
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- spec/controllers/assessments_controller_spec.rb (6 hunks)
Additional comments: 3
spec/controllers/assessments_controller_spec.rb (3)
1-7: The
render_views
method is used to render views in the controller tests. This is a good practice as it allows you to test the controller and view together.13-62: The "Create Assessment" test suite has been added to test the creation of assessments when the user is an instructor. It includes two test cases: one for rejecting bad assessment display names and another for sanitizing assessment display names. The test cases are well-written and cover the necessary scenarios.
159-179: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [64-178]
The "Export and Import Roundtrip" test suite has been updated with additional test cases for handling assessment import and export. These test cases cover various scenarios such as successful import of an exported assessment, handling of nil tarfile, bad tarfile, yaml file name mismatch, legal assessment name, broken yaml file, any module name, module with bad syntax, and mismatched same name error. These test cases are comprehensive and cover a wide range of scenarios.
LGTM, was able to follow the steps outlined without issues |
The module name for config files under that path appear to be "#{sanitized_name}".camelize |
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.
Generally LGTM, other than some bugs and nits noted
This is probably because for new assessments there doesn't exist an id yet? Regardless, the actual config file that gets written to |
…ile if they both had names that mapped to pre-PR config file name
LGTM |
…ab#1987) * begin refactoring naming rules for assessments * continue working on file acceptance * add testing * fix autograde * work on backwards compatibility / revertibility * keep working on implementing revertability * Fix some code creating assessmentConfigFile before assessment id created * Add documentation to naming rules * add line about assessment name uniqueness * update error messages * fix tests * add error handling code to redirect user in case assessment config file can't be loaded, run robocop * address AI code review * remove redundant flash * Fix text * Fix reload assessment config button text * Add more error handling, revamp regex string to better reflect valid ruby module names, add better sanitization for display name -> name conversion, fix docs to reflect actually valid assessment names. * fix test * Address nits * Fix issue where assessment could affect another assessment's config file if they both had names that mapped to pre-PR config file name * Delete config/oauth_config.yml * Delete diff.patch * Delete assessment.patch * remove unnecessary files * more removals (cherry picked from commit 422ac9b)
* Lint views/submissions (#1969) * Begin linting views/submissions * finish linting views/submissions * address issues in code_viewer * Prevent spoofing the author of an annotation (#1985) * Prevent spoofing the author of an annotation (cherry picked from commit d2ab510) * Remove submitted_by from createAnnotation * Update link to docs in PR template (#1991) Fix link to docs * Hide irrelevant cud fields for students (#1988) * Show edit CUD button for students * Hide irrelevant CUD fields from students * Lint views/autograders, fix help-block gap from input (#1963) * lint views/autograders, fix help block gap from input * update form path * Lint views/announcements and Touch-up UI (#1957) * lint views/announcements and touch-up UI * address nits * Add erblint to overcommit and github actions (#1994) * update erb-lint config, overcommit config to enable erb-lint as a pre-commit hook, run erblint --lint-all * update github actions to run erb-lint during linting phase * update pull request template to include erblint check * Display Grace Day usage on submission history table, improve management of assessment penalty settings (#1990) * Display of grace days used * Fix calculation of effective_late_penalty and effective_version_penalty * Show course default values when applicable * Show warning messages when late submissions allowed but config does not make sense * Fix tests * Update wording * Improve formatting * Revert changes to effective penalties * Simplify check * Add toggles * Update wording on courseFields * Fix version threshold logic * Correctly set version threshold to blank when using course default * Clear / default values when checkbox clicked * Remove bottom padding * Improve UI when checkboxes selected * Address AI nits * Handle malformed scoreboard results from autograder, fix error handling for scoreboards (#1982) * begin fixing broken redirects * add code to check that entries are arrays, return flash error if not valid entry * fix spacing * address nit * Add logging * Click into submissions from gradebook score (#1998) * Clickable gradebook scores * Only scores have links --------- Co-authored-by: kestertan <[email protected]> * Switch mossnet clean to use rails root instead of tilde expansion (#1997) use Rails root join function instead of ~/ to make sure moss clean script works across systems * Merge pull request from GHSA-h8wq-ghfq-5hfx * fixes * Add validation for handout, writeup, and handin_directory * Avoid use of and * Check that handout/writeup exists before checking path (#2001) Move present? check to front * Adds warning when assessment.rb file upload isn't a .rb file (#1999) * preliminary working version * only validates .rb files --------- Co-authored-by: Damian Ho <[email protected]> * Refactor Assessment name rules, remove config file requirement (#1987) * begin refactoring naming rules for assessments * continue working on file acceptance * add testing * fix autograde * work on backwards compatibility / revertibility * keep working on implementing revertability * Fix some code creating assessmentConfigFile before assessment id created * Add documentation to naming rules * add line about assessment name uniqueness * update error messages * fix tests * add error handling code to redirect user in case assessment config file can't be loaded, run robocop * address AI code review * remove redundant flash * Fix text * Fix reload assessment config button text * Add more error handling, revamp regex string to better reflect valid ruby module names, add better sanitization for display name -> name conversion, fix docs to reflect actually valid assessment names. * fix test * Address nits * Fix issue where assessment could affect another assessment's config file if they both had names that mapped to pre-PR config file name * Delete config/oauth_config.yml * Delete diff.patch * Delete assessment.patch * remove unnecessary files * more removals * Suppress confirmation dialog on edit assessment page when no changes made (#2004) * Extract logic, call functions directly * Remove extraneous space * Remove another extraneous space * Display submission version in gradebook (#2005) * First Commit: version info is on gradebook as new columns * Second commit: only add a ver column after each assignment * Delete database.docker.yml * Delete schema.rb * Deleted debug code * change gitignore to original version * Address nits * Fix tooltips * Simplify version logic * Stop overwriting headerCssClass * Fix tooltip for not_yet_submitted * Handle nil aud * Add version to gradebook CSV export * Render tooltips onMouseEnter too * Simplify version header * Simplify logic * Increase gradebook width --------- Co-authored-by: SimonMen65 <[email protected]> Co-authored-by: Simon Men <[email protected]> * Don't clear assessment penalty fields on initial load (#2006) * Don't clear on initial load * Remove extraneous spaces * No line breaks when generating base64 strings (#2008) * fix bug for long strings * Update base64.js using new TextEncoder * Show all courses for MOSS (#2015) * Show all courses, restore filter * Address AI nits * Fix use of autocomplete attribute * Add newline * Simplify toggleOptions implementation * Fix style of isArchive checkboxes * Correct use of javascript_include_tag * Fix failing test * Update styling of warning * Extract dropdown logic, use OR for filtering * Add newline * Add spacing between dropdowns * Use find instead of children, check for selector existence * Removed name from assessment yml (#1993) * Removed name from assessment yml * Modified test after removing name from assessment yml * Removed unnecessary test for wrong assessment name * Removed yml name check in assessments_controller --------- Co-authored-by: Nicholas Clark <[email protected]> * Account for hooks in viewFeedback instead of feedback output (#2003) * preliminary working version * resolve merge conflicts * use submission.scores instead of feedback array * don't show non autograded scores in autograded scores tab * rabbit ai suggestions * more rabbit.ai nits * make finishedAutograding not an instance variable * Remove element overlapping scrollbar hitbox (#2009) * Remove element overlapping scrollbar hitbox * Move style to annotation.scss --------- Co-authored-by: Damian Ho <[email protected]> * Attachment categories (#1983) * Add category_name field and update course attachment UI * Improve styling of list items * Remove anchor link for unreleased badge, simplify delete button logic * Hide assessment attachments from course landing page * Add release_at field, remove released field * Fix tests * Add fixtures * Simplify variable names * Remove bullet points * Group buttons together * Make font-family consistent * Hide category for assessment attachments * Add cancel button, remove delete button, improve styling * Improve migration to be backwards compatible / reversible * Use update instead of update_attribute * Display when attachment will be released * Update tests * Simplify code * Use Time instead of DateTime * Add download icon for students * Vertically align icons * Hide assessment attachments from course attachment index * Add vertical space above release date * Passwordless temporary login (#1984) * Passwordless temporary login created * Login using devise * User is not signed in before changing password * Removing unneeded files * Removing changes to user.rb * Removing unneeded files * Resetting password does not log you out * Added mailer * Added/removed newlines * Changed naming * Added checks for nil user or params * Error handling for passwords * Removed email after password reset * Added documentation * Updated documentation * Moved documentation to features * Renamed to admin-features * Added link in mkdocs.yml * Visual cue for assessments (#2016) * Add dates to assessment card * Add CSS formatting for date * Fix margin and card sizes to be more pretty * Show all students on gradesheet (#2019) * add course members with blank info if no submissions found * add email for no submission users * update bg color * Move submission version logic to be handled by AUD (#2024) * Move submission version logic to be handled by AUD * update migration variable naming * fix unit tests, version number for new auds * fix coderabbit issues * add version number to schema * change schema timestamp * Use ActiveStorage for attachments, add attachment size limit (#2023) * 1810 Use ActiveStorage for attachments * 1864 Add backwards compatibility to ActiveStorage Attachments * 1872 Add size limit to attachments * Set mime_type * Remove require * redirect to index on error * Rails 6.1.7.6 Migration (#2037) * Initial update to 6.1.7.6 * Lock fomantic-ui-sass to 2.8.8.1 * Update schema.rb * Avoid locking setup-ruby version * Include net-http in Gemfile to avoid errors * Run rubocop * Lock uri to 0.10.0 * Fix lint issue * Fix course_number values for roster export * Use flash for drop warning * Properly display submission errors * Only show invalid assessment warning to instructors * Ensure gradebook search bar renders correctly for CAs * Filter by lecture too when CA views section * Only show missing submissions from section if CA filters by section * Update tests * Better handling for submission errors * More specific error handling for save_entries * Better error display for statistics page * Return 404 for popover on non-existent submission * load Archive in files that use its methods * Update Ruby to 3.2.2, Misc fixes (#2040) * Update Ruby to 3.2.2 - update Capybara config so that it works with new ruby version and so that js can be enabled again on selenium test - update releaseSectionGrades redirect to go to viewGradesheet for CA's section - add some more status text / more informative flash when instructor drops student - redact tango key in getjob * Address nits, update bundler / github integration * add arm64-darwin-23 to platforms * fix users nit * Bump uri from 0.10.0 to 0.10.3 (#2039) Bumps [uri](https://github.com/ruby/uri) from 0.10.0 to 0.10.3. - [Release notes](https://github.com/ruby/uri/releases) - [Commits](ruby/uri@v0.10.0...v0.10.3) --- updated-dependencies: - dependency-name: uri dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update old migrations for Ruby 3 (#2044) Use splat on old migrations * Remove grading deadline (#2014) * Initial removal of grading_deadline * Add brackets around arguments to grading_complete? * Consistency fixes * Migration to remove grading deadline * Add guards to migration * Rename grading_complete? to grades_released? * Address issues from v2.8.0 testing, misc fixes/changes (#2038) * Fix command for promoting a user to admin * Extract aria/collapsible code, switch to path helpers * Automatically open first accordion * Fix docs for Tango info endpoint * Create user directory on autograde_done * Coalesce accordions, simplify js, remove admin options * Update doorkeeper translations * Remove extraneous quotes * Remove redundant / useless assessment nil check * Fix error display when calling downloadAll on invalid assessment * Simplify failure redirect logic for downloadAll * Deduplicate logic for autograde feedback path and handin file path * Remove unused ass_dir variable * Remove redundant gitignores * Uncoalesce accordions * Fix redirects for invalid assessment Previously, calling downloadAll with an invalid assessment led to infinite redirects * Update the API to allow retrieving group members (#1956) * Add a param to the index groups api to retriee group members * Add api show endpoint for groups * Update docs * Update api docs for groups#show * Compact group members api response * Move fetching group json to a private method * Remove empty line --------- Co-authored-by: Damian Ho <[email protected]> * Update index and show docs for Groups API (#2045) Update index and show docs * Main Table UI Changes (#1886) * Start Manage Submissions * Center checkbox in manage submission table (#1868) fix checkbox issue * Main Table UI * Updates with selecting students and buttons * Add Score Popup Icon * Icon spacing and codebase style --------- Co-authored-by: Michelle Liu <[email protected]> * Add sorting icons to new manage submissions (#1890) * change icon to swap_vert, hide for file and actions headers * change icon on diff sort * Adds Score Details (#1893) * Adds score details without styling * address general styling for score details * refactor code * address pr issues * bring back css * bring back div * add back class names * add back icons * addressed nits * address nits --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Joey Wildman <[email protected]> Co-authored-by: Nicholas Myers <[email protected]> Co-authored-by: Damian Ho <[email protected]> Co-authored-by: Kester <[email protected]> Co-authored-by: kestertan <[email protected]> Co-authored-by: SimonMen65 <[email protected]> Co-authored-by: Simon Men <[email protected]> Co-authored-by: Ugo <[email protected]> Co-authored-by: Nicholas AJ Clark <[email protected]> Co-authored-by: Nicholas Clark <[email protected]> Co-authored-by: lykimchee <[email protected]> Co-authored-by: Joanna Ge <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Umar Alkafaween <[email protected]> Co-authored-by: Victor Huang <[email protected]>
Summary
Summary generated by Reviewpad on 06 Nov 23 22:44 UTC
This pull request includes the following changes:
homework02-illegal-assessment-name.tar
has been deleted.app/views/assessments/_edit_basic.html.erb
, a heading<h4>Assessment Config</h4>
has been added, thehelp_text
of thef.file_field
has been modified, and a<div>
containing a link to reload the assessment config has been added. These changes enhance the file by providing additional information and functionality related to the assessment configuration.spec/controllers/assessments_controller_spec.rb
has been updated with test cases for creating assessments, handling invalid display names, and testing the export and import roundtrip feature. Various methods in theassessments_controller.rb
file have been modified to handle assessment name validation, file cleanup, error handling, and unique names and paths for assessment config files.autograde.tar
has been added in therandomlab
directory. The file is a binary file and its contents differ from the previous version.randomlab.rb
has been added in therandomlab
directory. The file defines the moduleRandomlab
and includesAssessmentBase
. It also contains a methodassessmentInitialize
and initializes the instance variable@problems
with an empty array.autograde-Makefile
has been added in therandomlab
directory. The Makefile extracts the contents of theautograde.tar
file, changes the directory torandom
, and executes a script calleddriver.sh
.randomlab/randomlab.rb
has been modified to include a require statement for "AssessmentBase.rb" and define theRandomlab
module with a new methodassessmentInitialize
. The method calls thesuper
method fromAssessmentBase
with two arguments.driver.sh
has been added in therandomlab/random
directory. The file is a bash script that generates random numbers and prints them in a JSON format.app/controllers/assessments_controller.rb
has been modified to update error messages, handle file cleanup, load and reload config files, and validate assessment names and special characters.app/models/user.rb
has been modified to remove thereturn
keyword beforeauthentication&.user if authentication&.user
in several methods, ensuring that the methods always return the value ofauthentication.user
if it exists.app/helpers/assessment_autograde_core.rb
has been modified to raise anAutogradeError
for missing problems and handle the requirement of the assessment config file path.app/models/course.rb
has been modified to update the validation syntax forvalidates :requested_at
andvalidates_associated :oauth_application
.app/controllers/assessment/autograde.rb
has been modified to dynamically require configuration files based on assessment and course names.These are the main changes across the diff. Let me know if you need further assistance or if there are any specific areas you would like to focus on.
Description
"#{sanitized_name}_#{id}".camelize
, so that assessment config files are unique among all assessmentsassessments/new
Motivation and Context
Closes #1943
Closes #1393
How Has This Been Tested?
This PR requires Autolab to be restarted in order to work
New assessment:
courses/$course_name/$assessment_name/
and that config file has module name of"#{sanitized_name}_#{id}".camelize
Existing assessment:
assessmentConfig
folder, there should exist "course-assessment.rb" and "course-assessment-${id}.rb" files, and "course-assessment-${id}.rb" should have a module name of"${assessment name}${id}"
Import Assessment:
from the documentation, those with valid names should be created successfully, those with invalid names should fail to create (try also names such as "../", see that creation fails)
tar import: Import the tar file below, see that it successfully imports, generates a new assessment config file in the assessment folder and it also generated in the assessmentConfig folder
bareminimum.tar.zip
Try importing the tar file below, see that it fails to import
badasmt.tar.zip
Take an existing assessment, copy the folder, rename the folder /
assessment.yml
/name
field inassessment.yml
to a name that is valid, see that it imports successfullyTake an existing assessment, copy the folder, rename the folder /
assessment.yml
/name
field inassessment.yml
to a name that is invalid, see that it cannot be importedrun docs locally, see that documentation looks good
Types of changes
Checklist:
overcommit --install && overcommit --sign
to use pre-commit hook for linting