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

Assign tasks when they are not assigned. #127

Merged
merged 1 commit into from Jun 16, 2016
Merged

Assign tasks when they are not assigned. #127

merged 1 commit into from Jun 16, 2016

Conversation

Ladsgroup
Copy link
Member

@halfak
Copy link
Member

halfak commented Jun 6, 2016

This is probably not what we want. See farther down in that query. I think we want to change the following from

              LEFT JOIN label ON
                  label.task_id = task.id
              [...]
              HAVING
                  COUNT(label.task_id) < campaign.labels_per_task AND
                  SUM((label.user_id IS NOT NULL AND
                       label.user_id = %(user_id)s)::int) = 0

to

              LEFT JOIN workset ON
                  workset.id = workset_task.id
              [...]
              HAVING
                  COUNT(workset_task.task_id) < campaign.labels_per_task AND
                  SUM((workset.user_id IS NOT NULL AND
                       workset.user_id = %(user_id)s)::int) = 0

And drop the AND workset_task.task_id IS NULL because the task could be assigned multiple times in the case that campaign.labels_per_task is > 1.

@Ladsgroup
Copy link
Member Author

I fixed it now :)

WHERE campaign.id = %(campaign_id)s
GROUP BY task.id, campaign.labels_per_task
HAVING
COUNT(label.task_id) < campaign.labels_per_task AND
COUNT(workset_task.task_id) < campaign.labels_per_task AND
SUM((label.user_id IS NOT NULL AND
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be workset.user_id since we want to check to see if this user was already assigned this task or not. You'll need to join on "workset" as well here.

@halfak
Copy link
Member

halfak commented Jun 15, 2016

I just amended a change that addressed my last comment. @Ladsgroup, please review.

@halfak
Copy link
Member

halfak commented Jun 15, 2016

Oh! Also, I tested this by running /utility load_schema --reload-test-data and then working through the Article Notability campaign.

@Ladsgroup Ladsgroup merged commit 946e4f9 into master Jun 16, 2016
@Ladsgroup Ladsgroup deleted the unassigned branch April 11, 2017 22:46
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