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

disable editable fields if criterion released #7264

Merged
merged 18 commits into from
Oct 22, 2024

Conversation

anubhajoshi01
Copy link
Contributor

@anubhajoshi01 anubhajoshi01 commented Oct 10, 2024

Proposed Changes

(Describe your changes here. Also describe the motivation for your changes: what problem do they solve, or how do they improve the application or codebase? If this pull request fixes an open issue, use a keyword to link this pull request to the issue.)

On an Assignment's Criterion page, if the criterion is released, disable the input/editable fields, and disable the sortable list

Screenshots of your changes (if applicable)

When criterion is unreleased, still looks the same:

Light Mode

Screenshot 2024-10-13 at 12 06 08 PM

Dark Mode

Screenshot 2024-10-13 at 12 08 11 PM

When criterion IS released:

Light Mode

Screenshot 2024-10-13 at 12 06 36 PM

Dark Mode

Screenshot 2024-10-13 at 12 07 35 PM

Associated documentation repository pull request (if applicable)

Type of Change

(Write an X or a brief description next to the type or types that best describe your changes.)

Type Applies?
🚨 Breaking change (fix or feature that would cause existing functionality to change)
New feature (non-breaking change that adds functionality)
🐛 Bug fix (non-breaking change that fixes an issue) X
🎨 User interface change (change to user interface; provide screenshots) X
♻️ Refactoring (internal change to codebase, without changing functionality)
🚦 Test update (change that only adds or modifies tests)
📦 Dependency update (change that updates a dependency)
🔧 Internal (change that only affects developers or continuous integration)

Checklist

(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the [ ] into a [x] in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)

Before opening your pull request:

  • I have performed a self-review of my changes.
    • Check that all changed files included in this pull request are intentional changes.
    • Check that all changes are relevant to the purpose of this pull request, as described above.
  • I have added tests for my changes, if applicable.
    • This is required for all bug fixes and new features.
  • I have updated the project documentation, if applicable.
    • This is required for new features.
  • If this is my first contribution, I have added myself to the list of contributors.

After opening your pull request:

  • I have updated the project Changelog (this is required for all changes).
  • I have verified that the pre-commit.ci checks have passed.
  • I have verified that the CI tests have passed.
  • I have reviewed the test coverage changes reported by Coveralls.
  • I have requested a review from a project maintainer.

Questions and Comments

(Include any questions or comments you have regarding your changes.)

@anubhajoshi01 anubhajoshi01 marked this pull request as ready for review October 10, 2024 03:29
@coveralls
Copy link
Collaborator

coveralls commented Oct 10, 2024

Pull Request Test Coverage Report for Build 11431520026

Details

  • 0 of 1 (0.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 91.651%

Changes Missing Coverage Covered Lines Changed/Added Lines %
app/controllers/criteria_controller.rb 0 1 0.0%
Totals Coverage Status
Change from base Build 11429359232: 0.0%
Covered Lines: 40656
Relevant Lines: 43687

💛 - Coveralls

@anubhajoshi01 anubhajoshi01 marked this pull request as draft October 11, 2024 02:33
@anubhajoshi01 anubhajoshi01 marked this pull request as ready for review October 13, 2024 16:04
@anubhajoshi01 anubhajoshi01 requested review from david-yz-liu and removed request for david-yz-liu October 13, 2024 16:08
@@ -1,8 +1,15 @@
<div class='float-right'>

<% released = !criterion.results_unreleased? %>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is correct but a bit inefficient, since it'll be repeated for each criterion (and rubric level). Instead, try to figure out how the existing flash message "Cannot update criteria for an assignment with released marks." is being displayed, presumably conditioned on some boolean. That same boolean can be passed into this partial as a released variable, and you can use that directly. Same with the rubric levels.

On a related note, please modify the "Cannot update criteria for an assignment with released marks." so that it appears as an "info" rather than "error", since technically there's no error, we're just letting instructors know they can't change anything.

@@ -1,3 +1,5 @@
<% marks_released = flash[:notice].present? %>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rather than define this here, compute it once in the main (top-level) view that is initially rendered and that includes this partial, and then pass the boolean value into the partial as a local variable. Please do this for all partials.

@@ -9,16 +9,18 @@
@assignment.parent_assignment.short_identifier + ' ' + PeerReview.model_name.human :
@assignment.short_identifier) %>

<% marks_released = flash[:notice].present? %>
Copy link
Collaborator

Choose a reason for hiding this comment

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

As a note related to my above comment: It's good to define this variable here, since it's a top-level view.

However it's not ideal to rely on whether the flash is set or not, since there could be other messages we have. Instead, access @assignment directly to compute the boolean value.


<% if marks_released %>
<span class="button disabled"><%= t('rubric_criteria.level.add') %></span>
<% else %>
<%= link_to t('rubric_criteria.level.add'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Indent these lines (since they're now enclosed in an else block)

remote: true %>
remote: true,
disabled: marks_released
%>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Keep this on the preceding line (follow the existing style)

@@ -2,23 +2,24 @@
# Erb template for display rubric criterion levels in the assignment rubric manager
%>
<div class='level'>

Copy link
Collaborator

Choose a reason for hiding this comment

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

revert this change

@david-yz-liu david-yz-liu merged commit 1f0e1f8 into MarkUsProject:master Oct 22, 2024
6 checks 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