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

Genie app #1

Open
wants to merge 31 commits into
base: base_app_branch
Choose a base branch
from
Open

Genie app #1

wants to merge 31 commits into from

Conversation

niuage
Copy link
Member

@niuage niuage commented Dec 1, 2016

No description provided.

job_query = job.query_as(:job).
# match Jobs which received applications from users who also also applied to the given job
match("(job:Job) <-[:APPLIED_TO]- (similarUser:User) -[:APPLIED_TO]-> (recommendedJob:Job)").
break.
Copy link
Member Author

@niuage niuage Dec 2, 2016

Choose a reason for hiding this comment

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

Just discovered that

match
    (job:Job) <-[:APPLIED_TO]- (similarUser:User) -[:APPLIED_TO]-> (recommendedJob:Job),
    (recommendedJob) <-[applications:APPLIED_TO]- ()

is not the same as

match
    (job:Job) <-[:APPLIED_TO]- (similarUser:User) -[:APPLIED_TO]-> (recommendedJob:Job)
match
    (recommendedJob) <-[applications:APPLIED_TO]- ()

We need the break to produce 2 match statements.

In the first case, it would basically select all the jobs which had applicants if I'm not mistaken. In the second case, the second match works off of the results of the first match, which is what we want.

@niuage
Copy link
Member Author

niuage commented Dec 5, 2016

job_query = job.query_as(:job).
# match Jobs which received applications from users who also also applied to the given job
match("(job:Job) <-[:APPLIED_TO]- (similarUser:User) -[:APPLIED_TO]-> (recommendedJob:Job)").
with("recommendedJob", "similarUser").
Copy link
Member Author

Choose a reason for hiding this comment

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

edit: I replaced the break statement, with a WITH statement, which might be faster from what I've read.

Just discovered that

match
    (job:Job) <-[:APPLIED_TO]- (similarUser:User) -[:APPLIED_TO]-> (recommendedJob:Job),
    (recommendedJob) <-[applications:APPLIED_TO]- ()

is not the same as

match
    (job:Job) <-[:APPLIED_TO]- (similarUser:User) -[:APPLIED_TO]-> (recommendedJob:Job)
match
    (recommendedJob) <-[applications:APPLIED_TO]- ()

We need the break to produce 2 match statements.

In the first case, it would basically select all the jobs which had applicants if I'm not mistaken. In the second case, the second match works off of the results of the first match, which is what we want.

before_action :find_user
before_action :find_job

attr_accessor :user, :job
Copy link

Choose a reason for hiding this comment

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

I like this. We should do this more often.

class RecommendationConsumer
include Hutch::Consumer

consume "copro.recommendations.*"
Copy link
Member

Choose a reason for hiding this comment

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

we can have multiple wild cards. Since it seems like we want model and the action, it could be like copro.recommendations.*.* . I feel like this is the more natural way to handle it with routing keys rather than splitting

Copy link
Member Author

Choose a reason for hiding this comment

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

Didn't know that, thanks.

gem 'sqlite3'
gem "rails", "~> 4.2.6"
# Use Postgres as the database for Active Record
gem 'pg'
Copy link
Member

Choose a reason for hiding this comment

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

do we need pg if we are using active nodes?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's just to keep heroku happy. I would have had to create the app with the option to exclude the ORM fully I think. I didn't bother with that, because I thought we might want it later as well, if we want to have an admin or something like that.

gem 'rails', '4.2.5.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
gem "rails", "~> 4.2.6"
Copy link

Choose a reason for hiding this comment

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

4.2.7.1 ?

group :test do
gem "capybara", "~> 2.7"
gem "launchy"
end
Copy link

Choose a reason for hiding this comment

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

Some comments of what gems are for would be nice, Im thinking of a junior coming in and not knowing anything about the gems.

Copy link

Choose a reason for hiding this comment

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

Versions need to be properly filled as well, otherwise, as it's the case on platform it's gonna be impossible to properly update the gems with bundle update

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