Skip to content

Manage submissions page shows progress for regrading selected submissions #2278

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

coder6583
Copy link
Contributor

@coder6583 coder6583 commented Mar 10, 2025

Description

When a submission is being graded, a clock icon replaces the score. There is a message on top of the page that tells the user to either check the jobs page or refresh the page so that they update the score. The message only goes away when there is no more submissions that are being graded.
image

Motivation and Context

Currently, when the user pressed the regrade selected button on Manage Submissions, it is unclear when the regrade all ended. The only way a user knows if the regrade has finished is if they go to the jobs page and see that all the jobs have finished running. This was a problem raised in issue #2223, by 213 and 122 TAs.

How Has This Been Tested?

I followed these steps:

  1. Create a new assessment with an autograder setup incorrectly, such as a problem missing
  2. Submit some files
  3. After the submission has been graded, add the missing problem to the assessment
  4. Regrade those submissions that have the wrong scores
  5. Check that when the submissions are being regraded, a clock icon appears instead of the score
  6. Refresh the page until the message on the top of the page disappears
  7. Check that the scores have been updated to a correct score.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have run rubocop and erblint for style check. If you haven't, run overcommit --install && overcommit --sign to use pre-commit hook for linting
  • My change requires a change to the documentation, which is located at Autolab Docs
  • I have updated the documentation accordingly, included in this PR

Other issues / help required

One issue with my implementation is that all submissions that are currently graded will have the status of being regraded. Therefore, if I regrade all submissions, then another user decides to submit a new file while the regrade is running, the message will only go away when that new submission also finishes grading. One way I thought of to address this issue is just making the clock icons and the yellow message a default feature regardless of if a regrade is going on or not. Therefore, if an instructor goes to Manage Submissions while a student creates a new submission, the instructor will see on the page that one grading process is going on.

Copy link
Contributor

coderabbitai bot commented Mar 10, 2025

📝 Walkthrough

Walkthrough

The pull request introduces a new yellow color variable ($autolab-yellow) and a corresponding CSS class (.regrade-refresh) for styling elements related to regrading. It modifies the regradeBatch method in the autograde controller to remove success notifications. The submissions controller's index method is updated to handle grading submissions and track them using a new array. The submissions view is enhanced to display a regrading status message and adjust score displays based on whether submissions are currently being graded.

Changes

File(s) Change Summary
app/assets/stylesheets/_variables.scss
app/assets/stylesheets/style.css.scss
Added new color variable $autolab-yellow: #f7e788 and introduced the .regrade-refresh CSS class with properties for text color, background (semi-transparent yellow), border styling, padding, and font weight.
app/controllers/assessment/autograde.rb Modified regradeBatch method to remove handling of successful regrading notifications and associated flash message.
app/controllers/submissions_controller.rb Updated the index method to initialize a grading jobs array, handle exceptions, and collect submission IDs for grading into @grading_submissions.
app/views/submissions/index.html.erb Added a conditional block to render a regrading status message with the .regrade-refresh class and modified score display logic based on grading status.

Suggested reviewers

  • KesterTan
  • 20wildmanj

Possibly related PRs

  • Autograder improvements #2209: The changes in the main PR, specifically the addition of the $autolab-yellow variable, are directly utilized in the new .regrade-refresh class in the style.css.scss file, which references this variable for styling, indicating a strong connection.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 62b239f and f8d4764.

📒 Files selected for processing (3)
  • app/controllers/assessment/autograde.rb (0 hunks)
  • app/controllers/submissions_controller.rb (1 hunks)
  • app/views/submissions/index.html.erb (2 hunks)
💤 Files with no reviewable changes (1)
  • app/controllers/assessment/autograde.rb
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/controllers/submissions_controller.rb
  • app/views/submissions/index.html.erb

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
app/views/submissions/index.html.erb (1)

206-221: Nice enhancement of the score display logic.

The modified score display logic appropriately handles the case where a submission is being regraded by showing a clock icon instead of the score. This visual feedback helps users understand which submissions are currently being processed.

Consider adding a tooltip to the clock icon to explicitly state that the submission is being regraded, which would further improve user understanding.

- <%= link_to "<i class='tiny material-icons'>access_time</i>".html_safe,
-             { controller: "jobs", action: "getjob", id: submission.jobid } %>
+ <%= link_to "<i class='tiny material-icons'>access_time</i>".html_safe,
+             { controller: "jobs", action: "getjob", id: submission.jobid },
+             { title: "This submission is being regraded" } %>
app/controllers/submissions_controller.rb (3)

24-25: Improve readability with a ternary operator

The current if-else structure could be more concise. Simplify this using a ternary operator for better readability.

-    @regrading = if params[:regrading].nil?
-                   false else params[:regrading] end
+    @regrading = params[:regrading].nil? ? false : params[:regrading]
🧰 Tools
🪛 RuboCop (1.73)

[warning] 25-25: Odd else layout detected. Did you mean to use elsif?

(Lint/ElseLayout)


24-25: Consider type conversion for the regrading parameter

The code doesn't convert params[:regrading] to a boolean, which might lead to unexpected behavior since params are strings. A string like "false" would be evaluated as truthy.

-    @regrading = if params[:regrading].nil?
-                   false else params[:regrading] end
+    @regrading = !params[:regrading].nil? && params[:regrading].to_s.downcase == 'true'
🧰 Tools
🪛 RuboCop (1.73)

[warning] 25-25: Odd else layout detected. Did you mean to use elsif?

(Lint/ElseLayout)


29-40: Consider pagination or filtering in the TangoClient API call

Fetching all jobs from TangoClient might become inefficient if there are many jobs. Consider working with the TangoClient team to implement filtering or pagination if this becomes a performance issue.

If TangoClient supports filtering by assessment ID or course ID, you could reduce the number of jobs fetched and improve performance.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 073183d and 3943177.

📒 Files selected for processing (5)
  • app/assets/stylesheets/_variables.scss (1 hunks)
  • app/assets/stylesheets/style.css.scss (1 hunks)
  • app/controllers/assessment/autograde.rb (1 hunks)
  • app/controllers/submissions_controller.rb (1 hunks)
  • app/views/submissions/index.html.erb (2 hunks)
🧰 Additional context used
🪛 RuboCop (1.73)
app/controllers/submissions_controller.rb

[warning] 25-25: Odd else layout detected. Did you mean to use elsif?

(Lint/ElseLayout)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (8)
app/assets/stylesheets/_variables.scss (1)

28-28: Good addition of a named color variable.

Adding the $autolab-yellow variable follows the project's established pattern of defining semantic color variables, which promotes consistency and makes future style changes easier.

app/assets/stylesheets/style.css.scss (1)

1722-1730: Well-structured styling for the new regrade notification.

The .regrade-refresh class is properly implemented with appropriate styling that matches the UI design patterns used elsewhere in the application. Good use of the newly defined $autolab-yellow variable for color consistency.

app/views/submissions/index.html.erb (1)

53-60: Good implementation of regrading status message.

The conditional block displays a helpful message with the count of submissions being regraded and provides clear navigation options for users to check progress or refresh the page. This directly addresses the issue mentioned in the PR description where TAs were confused about regrade status.

app/controllers/assessment/autograde.rb (2)

120-123: Suppress success notifications in favor of status display.

Commenting out the success notification is acceptable since you're replacing it with a more persistent and informative status display on the submissions page. This change helps improve the user experience by providing continuous feedback about regrading status.


128-128: Good implementation of redirect with regrading parameter.

The addition of the regrading: 'true' parameter to the redirect allows the view to conditionally display the regrading status message, creating a cohesive user experience throughout the regrading process.

app/controllers/submissions_controller.rb (3)

29-40: Approve the TangoClient job fetching implementation

Good implementation of fetching live jobs with proper error handling for TangoClient exceptions.


47-49: Approve the submission tracking logic

The code correctly identifies submissions that are currently being regraded by checking if their job ID is in the list of active jobs.


52-54: Good fallback to handle empty regrading submissions

This is a good safety check that ensures the regrading status is reset if no submissions are actually being regraded, avoiding confusion in the UI.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3943177 and 89380f2.

📒 Files selected for processing (1)
  • app/controllers/submissions_controller.rb (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (3)
app/controllers/submissions_controller.rb (3)

29-43: LGTM - Error handling for TangoClient jobs

The exception handling for TangoClient.jobs is appropriate. The code properly catches exceptions and displays an error message to the user.


50-52: LGTM - Identifying regrading submissions

This code correctly identifies which submissions are currently being regraded by checking if their job IDs exist in the active jobs from TangoClient.


55-57: LGTM - Fallback for empty regrading submissions

This is a good failsafe to avoid displaying the regrading message when no submissions are actually being regraded, providing a better user experience.

@KesterTan KesterTan requested review from a team and jhs-panda and removed request for a team March 11, 2025 05:54
Copy link
Contributor

@jhs-panda jhs-panda left a comment

Choose a reason for hiding this comment

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

I think the functionality is a bit broken? I am submitting with Proxylab (takes a long time to run so can test the regrade update properly).

After regrading some submissions and letting them finish running (no jobs left), I regraded one more submission that was not previously regraded. At this point, the Jobs list is empty and none of the submissions have the timer.
The "current regrading" count includes some submissions that were already regraded, and these submissions had the timer marking even though the jobs had already been run and did not show up on the Jobs list "waiting" or "running" sections. Eventually, after some refreshing, the timer symbol and regrading message disappear.
Screen Shot 2025-04-01 at 2 58 20 AM
Screen Shot 2025-04-01 at 2 58 40 AM
It also seems like each time this error occurs, the same submissions are considered "regrading again" even though they weren't.

Let me know if you can't replicate it and I'll try with another assessment/set of submissions. Looking at your code it doesn't seem obvious why this happening and tbh it isn't that big of a deal, but it could be confusing for instructors.

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