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

Listofpopularcities 79 rsid #190

Merged
merged 23 commits into from
Jan 17, 2015

Conversation

RSid
Copy link
Contributor

@RSid RSid commented Dec 26, 2014

closes issue #79

@@ -59,6 +59,13 @@ def rating_percentage
upvote.to_f / (upvote + downvote).to_f * 100
end

def self.topcities
Rails.cache.fetch("topcities", expires_in: 1.month) do
Restroom.group(:city, :state).count.sort_by {|x,y| y}.reverse

Choose a reason for hiding this comment

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

Unused block argument - x. If it's necessary, use _ or _x as an argument name to indicate that it won't be used.
Space missing after comma.
Space between { and | missing.
Space missing inside }.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed in the db snapshot @tkwidmer sent that 'San Francisco' and 'SAN FRANCISCO' are both in the top 5 cities. Do you want to run a migration at some point to consolidate all these records to use the same city name, or would you like me to include some handling here for aggregating data for cities that are secretly the same place?

Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably just handle this case, since the only difference is the case. You should be able to make the check case insensitive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool - I don't think you can make group by case insensitive in postgres
http://www.postgresql.org/message-id/[email protected],
but I can get around that by writing the query in raw sql like this:
"SELECT MAX(city), state, COUNT(DISTINCT id) AS count FROM restrooms GROUP
BY LOWER(city), state ORDER BY count DESC LIMIT 5"

On Sat, Dec 27, 2014 at 2:30 PM, Teagan [email protected] wrote:

In app/models/restroom.rb
#190 (diff)
:

@@ -59,6 +59,13 @@ def rating_percentage
upvote.to_f / (upvote + downvote).to_f * 100
end

  • def self.topcities
  • Rails.cache.fetch("topcities", expires_in: 1.month) do
  •  Restroom.group(:city, :state).count.sort_by {|x,y| y}.reverse
    

We should probably just handle this case, since the only difference is the
case. You should be able to make the check case insensitive.


Reply to this email directly or view it on GitHub
https://github.com/RefugeRestrooms/refugerestrooms/pull/190/files#r22294162
.

@RSid
Copy link
Contributor Author

RSid commented Dec 26, 2014

@tkwidmer , do I have to do anything special to get the devise initializer to pass on travis? The build keeps failing on Devise.secret_key was not set, but I haven't been messing around with any related code and there are already secret keys set in test and dev.

@tkwidmer
Copy link
Contributor

That's weird. I'm 90 percent sure I set the secret key on travis.

@tkwidmer
Copy link
Contributor

updated it, going to try the run again.

@tkwidmer
Copy link
Contributor

so i did a little research:

UPDATE: After some reading, it turns out that Travis does not expose safe ENV vars to untrusted builds, such as pull requests. This is due to the fbehave that a malicious user can trigger a build that would expose the ENV vars (eg, submit a pull request that uploads ENV vars to a resecondte server). After some thought, it is apparent I'll need to find a dwhetherferent near to what I'm doing.

So I just generated a new public secret key for the test environment and am exposing it to pull request builds

@tkwidmer
Copy link
Contributor

Hopefully that will fix it

@tkwidmer
Copy link
Contributor

@RSid specs passed

@RSid
Copy link
Contributor Author

RSid commented Dec 28, 2014

Ah, that makes sense. Weird times, thanks!

@tkwidmer
Copy link
Contributor

haven't had a chance to check this out yet and take a look at the front end. any way you could screen shot the front end stuff?

@@ -1,5 +1,5 @@
source 'https://rubygems.org'
ruby '2.0.0'
Copy link
Contributor

Choose a reason for hiding this comment

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

this is weird, we should have already been updated to 2.1.1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's registering that way because I forked the project before it was updated to 2.1.1? But I'm not sure why that would still show up that way, since I've pulled from master since then.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, idk. regardless it shouldn't cause a problem.

@tkwidmer
Copy link
Contributor

other than a couple of comments, this looks good. excited to get it merged in.

@RSid
Copy link
Contributor Author

RSid commented Dec 30, 2014

Thanks! Glad to hear it. Screenshot's here : https://drive.google.com/file/d/0B5V-owrjHUVbcUhLLTZTM3VOQWF1bmM1N3hrREd0WUw1cU1N/view?usp=sharing

On Mon, Dec 29, 2014 at 1:29 PM, Teagan [email protected] wrote:

haven't had a chance to check this out yet and take a look at the front
end. any way you could screen shot the front end stuff?


Reply to this email directly or view it on GitHub
#190 (comment)
.

@RSid
Copy link
Contributor Author

RSid commented Jan 2, 2015

Presuming the front end styling is ok, I think this is good to go!

@tkwidmer
Copy link
Contributor

I think we should do more on the front end. Like having each listing link to the search for the city center of that city. But ill go ahead and merge this.

tkwidmer added a commit that referenced this pull request Jan 17, 2015
@tkwidmer tkwidmer merged commit e0c45a3 into RefugeRestrooms:develop Jan 17, 2015
@RSid
Copy link
Contributor Author

RSid commented Jan 17, 2015

@tkwidmer , the listings do actually link to searches for the city center of that city already - sorry, I guess they don't visually look much like links. Would it help clarify that if I added link underlining back in or something?

@tkwidmer
Copy link
Contributor

oh, thats fine then. I may end up changing the visual style a little bit. But yeah. thanks for doing this!

@tkwidmer tkwidmer mentioned this pull request Jan 19, 2015
@RSid
Copy link
Contributor Author

RSid commented Jan 19, 2015

No worries! I enjoyed it. But yeah, I'm not terribly UX-y, go for it.

@tkwidmer tkwidmer mentioned this pull request Jan 31, 2015
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.

4 participants