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

Prevent users from auditing a completed neighborhood #691

Closed
misaugstad opened this issue Jun 17, 2017 · 9 comments
Closed

Prevent users from auditing a completed neighborhood #691

misaugstad opened this issue Jun 17, 2017 · 9 comments
Assignees

Comments

@misaugstad
Copy link
Member

We don't want users to be able to audit completed neighborhoods right now, so that should be disallowed when they are looking at the map in their user dashboard, and in the new choropleth.

@manaswisaha
Copy link
Member

This type of pop-up (from #622 (comment)) could address this issue:

image

@misaugstad
Copy link
Member Author

misaugstad commented Jun 17, 2017

The real issue here is that the queries that get the completion rates of each neighborhood takes a hell of a long time to run (~11 seconds on my local dump). That has been annoying but fine because it was only used on the admin page up until now.

I will look closer at what is taking this long, but to get it fast enough way may have to add a table that holds the amount of each neighborhood that has been completed.

@jonfroehlich
Copy link
Member

jonfroehlich commented Jun 17, 2017 via email

@jonfroehlich
Copy link
Member

jonfroehlich commented Jun 17, 2017 via email

@misaugstad
Copy link
Member Author

For this table, the two critical things we need are

  1. region_id
  2. total_distance (sum of lengths of all streets in the region)
  3. completed_distance (sum of lengths of all streets for which someone has completed an audit)

This is all that I currently need, but can we think of anything else that should go in there?

I am thinking that we can update the completed_distance field whenever someone finishes an street audit. We just increase the completed_distance field for that region by the length of the street that was just audited (we would have to check that the street has not already been audited before adding).

@misaugstad misaugstad self-assigned this Jun 18, 2017
@jonfroehlich
Copy link
Member

jonfroehlich commented Jun 18, 2017 via email

@misaugstad
Copy link
Member Author

There is actually a street_edge_assignment_count table that has a completion_count field. So whenever a user finishes auditing a street, the completion_count is incremented by 1 for that edge. Thus checking that the street has not already been audited is very easy.

And the reason I strongly believe that it should happen in real time is that users will want to do a mission, then immediately check to see how much of the neighborhood has been audited. It would be disheartening to do 4 missions, then look back at the choropleth and see that the percentage is the same as it was before you started auditing.

I just suspect that seeing the choropleth update will be highly motivating!

@jonfroehlich
Copy link
Member

jonfroehlich commented Jun 18, 2017 via email

@misaugstad
Copy link
Member Author

PR #692 resolves this.

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

No branches or pull requests

3 participants