Skip to content

render (hidden) label for assignments according to visibility setting (#7785)#7944

Open
philipkukulak wants to merge 1 commit into
masterfrom
issue-7785
Open

render (hidden) label for assignments according to visibility setting (#7785)#7944
philipkukulak wants to merge 1 commit into
masterfrom
issue-7785

Conversation

@philipkukulak
Copy link
Copy Markdown

@philipkukulak philipkukulak commented May 11, 2026

Proposed Changes

From an instructor/TA view, the visibility of an assignment is not correctly displayed if visible-from and/or visible-until settings are set because the labelling logic only covers the binary "visible or hidden" settings. The proposed changes correctly labels assignments based on whether or not they are visible to students in the dashboard view, the instructor/TA assignment list view, and the instructor/TA assignment list view dropdown menu.

Screenshots of your changes (if applicable) Screenshot 2026-05-11 at 11 35 25 AM Screenshot 2026-05-11 at 11 35 16 AM Screenshot 2026-05-11 at 11 35 04 AM Screenshot 2026-05-11 at 11 34 32 AM
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

n/a

@philipkukulak philipkukulak changed the title render (hidden) label for assignments according to visibility setting… render (hidden) label for assignments according to visibility setting (#7785) May 11, 2026
@coveralls
Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 25680949457

Coverage increased (+0.01%) to 91.74%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: 85 of 85 lines across 3 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 48760
Covered Lines: 45477
Line Coverage: 93.27%
Relevant Branches: 1870
Covered Branches: 971
Branch Coverage: 51.93%
Branches in Coverage %: Yes
Coverage Strength: 130.25 hits per line

💛 - Coveralls

Copy link
Copy Markdown
Collaborator

@david-yz-liu david-yz-liu left a comment

Choose a reason for hiding this comment

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

Nice work, @philipkukulak! I just left a few small comments.

view_flow.content.delete(content_key)
end

def assignment_hidden_label?(assignment)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In general, only very broadly applicable code should be added to application_helper.rb.

This method (assignment_hidden_label?) can be moved into the Assessment model as an instance method; I would rename it it to currently_hidden?.

false
end

def formatted_assignment_visibility_label(assignment, base_text)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Because this method is specifically tied to views, it's good to put it in a helper, but I would move it into a new assessments_helper.rb.

Note that the logic here doesn't just apply to assignments, but also to grade entry forms.

<% title = "#{assessment.parent_assignment.short_identifier} #{PeerReview.model_name.human}" %>
<% end %>
<% if assessment.is_hidden %>
<% if assessment.is_a?(Assignment) %>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The class check here isn't necessary; we can apply the same logic to grade entry forms


before do
travel_to(current_time)
create(:assignment, course: course, short_identifier: 'A_plain', description: 'Plain Visible')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You can create this assignment within the visibility_cases array above (include as a new key within each hash). I wouldn't recommend adding short_identifier and description fields, as these are extraneous to the test case.

Then further below, you can parameterize the test cases by calling it within a loop:

visibility_cases.each do |visibility_case|
  it ... <label> ... do
    get_as role, ...

    ...
  end
end

Similar comment for the test cases below.

Comment thread Changelog.md
- Fixed reserved interpolation key `%{format}` in `download_errors.unrecognized_format` locale string, renamed to `%{file_format}` (#7894)
- Fix version mismatch between container client and database server (#7916)
- Fixed filter Canvas Test Student from roster sync (#7926)
- Fixed `(hidden)` assignment labeling for assignments with `visible_on` and/or `visible_until` set (#7785)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

"assignments" -> "assessments"

Also, the number in the changelog entry is actually the PR number, not the issue number.

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