-
Notifications
You must be signed in to change notification settings - Fork 172
E2566 Finish Due Dates #234
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
base: main
Are you sure you want to change the base?
Conversation
Generated by 🚫 Danger |
|
🚨 RSpec Tests Report |
efg
left a comment
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.
Please try to reduce the size of your code by 90%+. It would be much clearer if it was shorter and easy to grasp by just reading through it once.
| activity_permissible?(:drop_topic) | ||
| end | ||
|
|
||
| # Check activity permissions for a specific deadline type |
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.
This method should be removed completely. The deadline type has nothing to do with whether an activity is permissible. Whether an activity is permissible is entirely determined by the submission_allowed_id, review_allowed_id, etc. Leaving this method in the code will simply confuse anyone who needs to maintain or extend this code.
| current_deadline_for(action) | ||
| end | ||
|
|
||
| # Check if a specific action is currently allowed based on deadlines |
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.
This code seems repetitious. I wonder if there is a good way to simplify it, perhaps using metaprogramming. Be careful; ask an LLM.
| end | ||
| end | ||
|
|
||
| # Get all currently allowed actions |
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.
I see no reason that this method would ever be needed. The currently allowed actions are determined by the ..._allowed fields in the next due date. Collecting them together serves no purpose that I can imagine.
| actions | ||
| end | ||
|
|
||
| # Check if any actions are currently allowed |
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.
Again, I can't imagine how this method would ever be useful. If an assignment is Finished (i.e., all of its due_dates are in the past), no actions are currently allowed. If the available_to_students bit is set and it has future due dates, some action is always allowed. I can think of no counterexamples in the history of Expertiza. Please remove it.
| allowed_actions.any? | ||
| end | ||
|
|
||
| # Get permission summary for all actions |
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.
Again, I can think of no use for this method. It should be removed.
app/models/deadline_right.rb
Outdated
| scope :with_penalty, -> { where(name: 'Late') } | ||
| scope :without_penalty, -> { where(name: 'OK') } | ||
|
|
||
| # Class methods for finding deadline rights |
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.
I am not sure whether the following methods would be needed. Please try to think of where they would be called. It's plausible that they would be helpful, but unless we can see a use, I think it's better not to include them.
app/models/deadline_right.rb
Outdated
| end | ||
| end | ||
|
|
||
| # Comparison methods |
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.
I'm pretty sure this would never be used.
app/models/deadline_right.rb
Outdated
| permission_level <=> other.permission_level | ||
| end | ||
|
|
||
| # Method to seed the deadline rights (for use in migrations/seeds) |
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.
It seems to me that seeding code should not be in classes within the application. Probably more appropriate for test classes. Ask an LLM.
app/models/deadline_right.rb
Outdated
| valid_right_names.include?(name.to_s) | ||
| end | ||
|
|
||
| # Statistics methods |
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.
YAGNI, I think.
app/models/deadline_type.rb
Outdated
| scope :quiz_types, -> { where(name: ['quiz']) } | ||
| scope :administrative_types, -> { where(name: ['drop_topic', 'signup', 'team_formation']) } | ||
|
|
||
| # Class methods for finding deadline types |
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.
How would you envision these methods being used? If it's not clear, they should not be included.
|
🚨 RSpec Tests Report |
1 similar comment
|
🚨 RSpec Tests Report |
| # Shift deadlines of a specific type | ||
| def shift_deadlines_of_type(deadline_type_name, time_delta) | ||
| # Shift deadlines of a specific type by a time interval | ||
| def shift_deadlines_of_type(deadline_type_name, time_interval) |
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.
I would only expect the time interval to be expressed in DAYS. I think that using "days" as identifier names and in the calculation would improve the readability of this method.
| end | ||
|
|
||
| # Check if deadlines are properly ordered (submission before review, etc.) | ||
| # Check if deadlines are in proper chronological order |
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.
I don't think this method is useful. You can put them in order with a single statement. If you wanted them to be in order, you'd just sort them. Please remove this method.
| activities | ||
| end | ||
|
|
||
| # Check if this deadline is currently active (allows some action) |
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.
I don't see any need for this method. All deadlines allow for something to be done, in my experience. I also don't think it's necessary to check whether ANYTHING can be done ... just whether a specific action can be performed.
| teammate_review: permission_status_for(:teammate_review), | ||
| active: active?, | ||
| closed: closed? | ||
| active: active? |
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.
Please remove. "active" is not helpful.
| .first | ||
| def next_due_date(topic_id = nil) | ||
| if topic_id && has_topic_specific_deadlines? | ||
| topic_deadline = due_dates.where(parent_id: topic_id, parent_type: 'SignUpTopic') |
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.
"SignupTopics" (old repo) will be "ProjectTopics" in the new system.
| # Instance methods for parent objects (Assignment, SignUpTopic) | ||
| # These methods should be included in Assignment and SignUpTopic models | ||
|
|
||
| # Get next due date for this parent |
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.
I assume that "topic_id" here means the primary key of the topic in the topics table.
It is not guaranteed that all topics will have user-assigned numbers like "E2566".
| end | ||
|
|
||
| # Get all deadlines affecting a specific topic | ||
| # Get all deadlines for a topic (topic-specific + assignment fallback) |
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.
I don't see any need to collect all deadlines for a topic. Another case of YAGNI.
|
|
||
| # Check if assignment has topic-specific overrides | ||
| def has_topic_deadline_overrides? | ||
| # Check if assignment has topic-specific deadlines |
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.
This check should really be made by checking whether the assignment is a staggered-deadline assignment. This is determined by the staggered_deadline field in the Assignment object.
|
🚨 RSpec Tests Report |
|
🚨 RSpec Tests Report |
1 similar comment
|
🚨 RSpec Tests Report |
Notes: talk about the participant parameter and anything else that is required before submission.
|
🚨 RSpec Tests Report |
|
🚨 RSpec Tests Report |
Refactored due date implementation. - Remove redundant next_due_date method from TopicDueDate class - Clean up DueDate class by removing duplicate class method - Improve next_due_date method in DueDateActions with better documentation - Add missing due_dates association to Assignment model (was incorrectly documented as provided by mixin) - Enhance DueDatePermissions documentation explaining participant permission requirements - Simplify TopicDueDate to proper single table inheritance subclass
|
🚨 RSpec Tests Report |
|
🚨 RSpec Tests Report |
| end | ||
|
|
||
| # Get the next due date for this parent | ||
| # Get the next due date for this assignment |
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.
Code is just fine. I would suggest appending lines 66 & 67 to line 65 for better readability. I also think you may have gone overboard on the comments; perhaps you could ask an LLM how to comment the method just as clearly but more concisely.
app/models/due_date.rb
Outdated
|
|
||
| where(parent_id: parent_id).upcoming.first | ||
| end | ||
| # This method is no longer needed as the functionality has been moved |
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.
Agreed, but the method should be removed entirely from the code (comments and all).
|
🚨 RSpec Tests Report |
|
🚨 RSpec Tests Report |
|
🚨 RSpec Tests Report |
|
🚨 RSpec Tests Report |
|
|
||
| # Get the current stage name for display purposes | ||
| def current_stage | ||
| deadline = next_due_date |
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.
deadline --> upcoming_due_date
…e_actions for more readability on line 15 and removed cannot_delete_if_has_due_dates as it would only be triggered via admin view which wouldn't exist anymore.
|
🚨 RSpec Tests Report |
|
|
||
| create_table "deadline_types", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| | ||
| t.string "name", null: false | ||
| t.text "description", null: false |
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.
do not need description text field. remove it
|
|
||
| create_table "deadline_rights", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| | ||
| t.string "name", null: false | ||
| t.text "description", null: false |
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.
do not need description text field. remove it
| t.integer "review_of_review_allowed_id" | ||
| t.datetime "created_at", null: false | ||
| t.datetime "updated_at", null: false | ||
| t.index ["deadline_type_id"], name: "fk_rails_ee95f82c0c" |
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.
get rid of description_url, flag, deadline_name
No description provided.