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

Rent logic #46

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Rent logic #46

wants to merge 8 commits into from

Conversation

kjs222
Copy link
Contributor

@kjs222 kjs222 commented Jul 23, 2016

Functioning according to interim plan of having top three rent results displayed along with top three transportation results.

View does not fit all six results currently - but may not be worth fixing at this time because we may ultimately decide to return three integrated neighborhoods.

- need to add headings to distinguish top trans from top rent
- need to reformat so all neighborhood show
$('#return-addresses').append(createNeighborhoodHTML(data[0][i]));
}
for (var i = 0; i < data[1].length; i++) {
$('#return-rent').append(createNeighborhoodRentHTML(data[1][i]));
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is a good temporary solution to have both neighborhood priorities listed on the page.


def find_closest_rent_neighborhoods(user_max_rent)
max_avg_rent = user_max_rent * 1.2
neighborhoods = Neighborhood.where('rent <= ?', max_avg_rent).order(rent: :desc).limit(3)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm curious how we decided to do 120% of their suggested rent. It might be good to test over time to make sure the top three neighborhood averages are at least reaching below the user-provided rent. What do you think?

neighborhoods = Neighborhood.where('rent <= ?', max_avg_rent).order(rent: :desc).limit(3)
if neighborhoods.empty?
Neighborhood.order(:rent).limit(3)
else
Copy link
Collaborator

Choose a reason for hiding this comment

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

This alleviates my previous concern, but might be good to do some testing to see how often the neighborhoods are returning empty arrays.

And comments out "add top rent neighborhoods" in case it was something else we needed.
@chompasina
Copy link
Collaborator

@icorson3 Would you be able to review this PR along with me? I approve, but since it's adding functionality I'd like additional review before merging. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants