Skip to content

Conversation

@achitti2812
Copy link
Collaborator

No description provided.

@github-actions
Copy link

github-actions bot commented Dec 9, 2025

2 Warnings
⚠️ There are no test changes in this PR.
⚠️ Schema changes detected without a corresponding DB migration.

Generated by 🚫 Danger

@github-actions
Copy link

github-actions bot commented Dec 9, 2025

🚨 RSpec Tests Report

All tests passed.

rescue_from ActiveRecord::RecordNotFound, with: :institution_not_found
def action_allowed?
has_role?('Instructor')
has_role?('Instructor') || has_role?('Administrator')
Copy link
Member

Choose a reason for hiding this comment

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

Instead of using the disjunction in a lot of action_allowed methods, I believe there is a has_instructor_privileges? method that implements the disjunction.

# Role IDs
STUDENT_ID = 1
TEACHING_ASSISTANT_ID = 2
# Role IDs (must match db/seeds.rb)
Copy link
Member

Choose a reason for hiding this comment

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

Should there be a db table with these correspondences?

super(options.merge({ only: %i[id name parent_id] }))
end
end
end
Copy link
Member

Choose a reason for hiding this comment

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

Please add an EOL

STUDENT_ID = 1
TEACHING_ASSISTANT_ID = 2
# Role IDs (must match db/seeds.rb)
SUPER_ADMINISTRATOR_ID = 1
Copy link
Member

Choose a reason for hiding this comment

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

Could this just be SUPER_ADMINISTRATOR, etc.? All files would need to be refactored to effect this change, but it would enhance readability. But, would it lead to namespace conflicts? If it doesn't cause name conflicts, it would be worth doing.

delegate :administrator?, to: :role
delegate :super_administrator?, to: :role

def self.instantiate(record)
Copy link
Member

Choose a reason for hiding this comment

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

Please refactor, according to the recommendations in https://chatgpt.com/share/694abed0-f590-800d-ac2a-4d87911c5de3.

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