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

UserTaskMatcher gets tasks with most overlapping skills fixes #736 #752

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ignu
Copy link
Contributor

@ignu ignu commented Mar 14, 2017

What's in this PR?

Add UserTaskManager to return tasks with the most overlapping skills

References

Fixes #736

Copy link
Contributor

@joshsmith joshsmith left a comment

Choose a reason for hiding this comment

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

This looks really great and is going to be a huge deal if we can combine it with an "unassigned tasks" query. That means we'll be able to suggest tasks to a user automatically via email, and eventually through our in-app messenger, too.

group_by: t.task_id,
order_by: count(t.task_id),
limit: ^tasks_count,
select: t.task_id
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you been able to run an EXPLAIN on this query by chance to see how well it performs?

import Ecto.Query

@spec match_user(User.t, number) :: [Task.t]
def match_user(%CodeCorps.User{} = user, tasks_count) do
Copy link
Contributor

Choose a reason for hiding this comment

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

Would write some inline documentation here and rename to tasks_limit or something more intention revealing.

@@ -12,6 +12,7 @@ defmodule CodeCorps.Skill do
has_many :roles, through: [:role_skills, :role]

has_many :project_skills, CodeCorps.ProjectSkill
has_many :user_skills, CodeCorps.UserSkill
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this go last to keep alpha order?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should roles and role_skills be in alpha order too?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes!

where: user.id == ^user.id,
group_by: t.task_id,
order_by: count(t.task_id),
limit: ^tasks_count,
Copy link
Contributor

Choose a reason for hiding this comment

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

I actually kind of wonder if we shouldn't do the limit chained elsewhere to keep this function more multipurpose. I.e. Without it we could do a count.


tasks = match_user(user, 2)

assert(length(tasks) == 2)
Copy link
Contributor

Choose a reason for hiding this comment

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

You might be able to write this as assert tasks |> length() == 2 instead.


account_page = insert(:task)
settings_page = insert(:task)
photoshop = insert(:task)
Copy link
Contributor

Choose a reason for hiding this comment

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

These could maybe be rethought a little to tell a clearer story. Like one could be front_end_task and one back_end_task and one design_task. You'd have coding_skill and design_skill and then match accordingly. Your final test would be 1 and 3 for length instead, using a limit of 1 and 3.

Copy link
Contributor

Choose a reason for hiding this comment

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

This comment probably conflicts slightly with the suggestion to chain, but with the right ordering could be resolvable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what i was going for with skills that were implementing an entire page (thus needing coding and design) versus one that was just PhotoShop.

I did start to wonder sometimes about using just the most overlapping tasks as the sort priority. I could see someone like me selecting 'design' as a tag (even though that's a stretch). Then I'd get a list of results back that were design heavy, even though I'd be better suited for a task that simply overlaps my strongest skill, coding.

(Seems like this would be more clear when we saw real data instead of speculating what the data would be.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I think this is simply the most naive approach right now. I'd prefer some sort of recommender system generally but we're a ways off from that.

@joshsmith
Copy link
Contributor

Really great work here btw!

@ignu
Copy link
Contributor Author

ignu commented Mar 15, 2017

That's a good question, what use is this if we don't return just unassigned tasks?

@joshsmith
Copy link
Contributor

@ignu I can see it being useful in other circumstances, like as a filter for the task board.

@joshsmith
Copy link
Contributor

@ignu just wanted to check on this with you.

@joshsmith joshsmith added this to the Suggest tasks to users based on skills milestone Sep 15, 2017
@joshsmith joshsmith modified the milestones: Suggest tasks to users based on skills, 🚀 Tasks MVP Oct 2, 2017
@begedin begedin force-pushed the develop branch 15 times, most recently from f04a221 to 4d24c1f Compare February 12, 2018 15:54
@begedin begedin force-pushed the develop branch 3 times, most recently from e075407 to 6d6cc63 Compare February 12, 2018 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants