Skip to content

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

Open
wants to merge 89 commits into
base: develop
Choose a base branch
from
Open

Conversation

nicolachr
Copy link
Contributor

@nicolachr nicolachr commented Aug 12, 2024

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:

  1. Use the dashboard widget to see the five tasks with the highest priority that are assigned to them. Highest priority is given to tasks that are overdue, and lowest priority to tasks that don't have a due date.
  2. Access a dedicated "My Tasks" view that displays all the tasks that are assigned to them in the form of a table.

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

I assign all rights, including copyright, to any future Dradis
work by myself to Security Roots.

Check List

  • Added a CHANGELOG entry

nicolachr and others added 30 commits August 12, 2024 11:43
@nodes = current_project.nodes.in_tree
@tags = current_project.tags
@tasks = assigned_cards(current_project.id)
Copy link
Member

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
Copy link
Member

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"
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

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

🚨

Comment on lines +12 to +13
valid_project_ids = Project.kept.current.accessible_by(current_ability).ids
cards.select { |card| card.project.id.in? valid_project_ids }
Copy link
Member

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.

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.

4 participants