-
Notifications
You must be signed in to change notification settings - Fork 199
Add My Tasks view & dashboard widget #1285
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: develop
Are you sure you want to change the base?
Conversation
…into tasks/my-tasks
…into tasks/my-tasks
…into tasks/my-tasks
…ds they are still assigned to
@nodes = current_project.nodes.in_tree | ||
@tags = current_project.tags | ||
@tasks = assigned_cards(current_project.id) |
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 approach is a bit backwards and inconsistent w/ what we have for other records.
Also, we typically go from the project to the nested resources at the controllers, we don't delegate that searchto the view
def index | ||
@default_columns = ['Title', 'Methodology', 'List', 'Due Date', 'Assigned'] | ||
|
||
if current_project |
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 seems to be a smell? Reusing a controller for in/out of project context?
@default_columns = ['Title', 'Methodology', 'List', 'Due Date', 'Assigned'] | ||
|
||
if current_project | ||
@local_storage_key = "project.ce.project_#{current_project.id}.tasks_datatable" |
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.
Another smell, a local storage key is typically a view concern. Why is it in the controller?
› grep -r local_storage_key app/controllers
Didn't yield other instances of this.
|
||
# ProjectScoped always calls current_project. We are overwriting it here to | ||
# prevent errors in Pro when viewing tasks outside of projects. | ||
def current_project |
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.
What we win in conciseness (less files) we're loosing in readability of the code.
@@ -0,0 +1,42 @@ | |||
module TasksHelper | |||
TASKS_LIMIT = 5 |
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.
Even if we want to hard code, and not make this configurable, a Helper seems to be the wrong place for this constant?
Perhaps the Configuration
class?
|
||
def assigned_cards(project_id = nil) | ||
@assigned_cards ||= begin | ||
# Using Arel.sql to sort the records by due_date with null due_date records last |
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'd assume due_date null would be grouped at the beginning or the end of the regular order(:due_date)
, no? Then it's a matter of choosing :desc / :asc and you get the same behavior w/ less code?
# Using Arel.sql to sort the records by due_date with null due_date records last | ||
cards = current_user.cards.order(Arel.sql('due_date IS NULL, due_date ASC')) | ||
|
||
if project_id |
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.
🚨
valid_project_ids = Project.kept.current.accessible_by(current_ability).ids | ||
cards.select { |card| card.project.id.in? valid_project_ids } |
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 is controller code, not view-helper code.
Co-authored-by: Caitlin Henry <[email protected]>
Summary
Currently, when methodology cards are assigned to users, the assigned users do not have a way to see which cards are assigned to them unless they manually go through each card. This is tedious and prone to letting cards fall through the cracks.
The proposed solution, allows the users to:
This will allow users to have better command of their tasks, make the process of finding a task easier, and will help the users stay on top of things.
Copyright assignment
Check List