Skip to content
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

Adding a new command to display only the requesting user's tasks #417

Merged
merged 3 commits into from
Jun 5, 2020

Conversation

kevgliss
Copy link
Contributor

@kevgliss kevgliss commented Jun 5, 2020

No description provided.

@kevgliss kevgliss requested a review from mvilanova June 5, 2020 20:26
Comment on lines +227 to +241
def filter_tasks_by_assignee_and_creator(tasks: List[Task], by_assignee: str, by_creator: str):
"""Filters a list of tasks looking for a given creator or assignee."""
filtered_tasks = []
for t in tasks:
if by_creator:
creator_email = t.creator.individual.email
if creator_email == by_creator:
filtered_tasks.append(t)

if by_assignee:
assignee_emails = [a.individual.email for a in t.assignees]
if by_assignee in assignee_emails:
filtered_tasks.append(t)

return filtered_tasks
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we move this to the task service and make it a db query instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could but the query will be fairly complex and the task lists are normally small so filtering after the fact seems reasonable.

@kevgliss kevgliss merged commit 746e6fe into develop Jun 5, 2020
@kevgliss kevgliss deleted the feature/list-my-tasks branch June 5, 2020 21:06
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.

None yet

2 participants