-
Notifications
You must be signed in to change notification settings - Fork 86
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
base: develop
Are you sure you want to change the base?
Conversation
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 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 |
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.
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 |
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.
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 |
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.
Can this go last to keep alpha 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.
should roles
and role_skills
be in alpha order too?
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.
Yes!
where: user.id == ^user.id, | ||
group_by: t.task_id, | ||
order_by: count(t.task_id), | ||
limit: ^tasks_count, |
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 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) |
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.
You might be able to write this as assert tasks |> length() == 2
instead.
|
||
account_page = insert(:task) | ||
settings_page = insert(:task) | ||
photoshop = insert(:task) |
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.
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.
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 comment probably conflicts slightly with the suggestion to chain, but with the right ordering could be resolvable.
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.
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.)
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.
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.
Really great work here btw! |
That's a good question, what use is this if we don't return just unassigned tasks? |
@ignu I can see it being useful in other circumstances, like as a filter for the task board. |
77663d1
to
c5e8228
Compare
@ignu just wanted to check on this with you. |
f04a221
to
4d24c1f
Compare
e075407
to
6d6cc63
Compare
What's in this PR?
Add UserTaskManager to return tasks with the most overlapping skills
References
Fixes #736