-
Notifications
You must be signed in to change notification settings - Fork 260
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
Listofpopularcities 79 rsid #190
Conversation
…elcome page, deleted old preamble
…es and message next to each other
@@ -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 |
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.
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 }.
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 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?
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.
We should probably just handle this case, since the only difference is the case. You should be able to make the check case insensitive.
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.
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
.
@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. |
That's weird. I'm 90 percent sure I set the secret key on travis. |
updated it, going to try the run again. |
so i did a little research:
So I just generated a new public secret key for the test environment and am exposing it to pull request builds |
Hopefully that will fix it |
@RSid specs passed |
Ah, that makes sense. Weird times, thanks! |
…opcities method to mimic case insensitivity and pass test
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' |
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 is weird, we should have already been updated to 2.1.1
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 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.
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, idk. regardless it shouldn't cause a problem.
other than a couple of comments, this looks good. excited to get it merged in. |
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:
|
Presuming the front end styling is ok, I think this is good to go! |
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 , 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? |
oh, thats fine then. I may end up changing the visual style a little bit. But yeah. thanks for doing this! |
No worries! I enjoyed it. But yeah, I'm not terribly UX-y, go for it. |
closes issue #79