-
Notifications
You must be signed in to change notification settings - Fork 108
Issue365 add jobs #366
base: master
Are you sure you want to change the base?
Issue365 add jobs #366
Conversation
@leenyburger @hpjaj Any reason that |
@jjhampton - We would create a few constants to ensure data integrity. And a dropdown in ActiveAdmin to choose from. That said, we can definitely switch to a If we don't see any value there, then I agree, changing the column name to |
@hpjaj I've already coded up the front-end stuff to filter on for |
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.
Looking good!
column :remote | ||
|
||
actions | ||
end |
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.
Can you pls add a form for creating/updating. Here is an example:
https://github.com/OperationCode/operationcode_backend/blob/master/app/admin/code_school.rb#L28-L45
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.
When I add the form and try to add a job I get the following error: "
"exception": "#<ActionView::Template::Error: To use the :country input, please install a country_select plugin, like this one: https://github.com/stefanpenner/country_select>",
Should I install that gem, or are we already using something else?
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.
@hpjaj I don't see where you responded here. If @leenyburger issue has been addressed, disregard just getting visibility.
@@ -0,0 +1,11 @@ | |||
module Api |
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.
Did this extra controller sneak in?
@@ -31,6 +31,9 @@ | |||
Service.create!(:name => service) | |||
end | |||
|
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.
Can you pls add a delete_all
call for Job
i.e. https://github.com/OperationCode/operationcode_backend/blob/master/db/seeds.rb#L9-L16
@@ -31,6 +31,9 @@ | |||
Service.create!(:name => service) | |||
end | |||
|
|||
# Create jobs | |||
Job.create!(title: "A great job", source_url: "www.applyhere.com", source: "Company A", city: "Virginia Beach", state: "VA", country: "USA", description: "Our job is fun!", status: "active", remote: "false") | |||
|
|||
# Create team members |
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.
As well as a reporting call, i.e. https://github.com/OperationCode/operationcode_backend/blob/master/db/seeds.rb#L57-L64
app/models/job.rb
Outdated
@@ -0,0 +1,3 @@ | |||
class Job < ApplicationRecord | |||
acts_as_taggable_on |
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.
Can you pls add a method similar to this one in here:
https://github.com/OperationCode/operationcode_backend/blob/master/app/models/user.rb#L130-L141
As well as an associated test. This will confirm that a given job can have tags (plural) added to it, and then we can use this method to query for any jobs that match the search criteria.
test/models/job_test.rb
Outdated
require 'test_helper' | ||
|
||
class JobTest < ActiveSupport::TestCase | ||
# test "the truth" do |
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.
Can you pls create a test in here confirm that the associated Factory is valid. All this would need to do is:
- use the factory to create a new
Job
- assert that it is
valid?
This keeps us honest with respect to any validations that we add to the Job
model class, and its associated Factory staying in step with those requirements.
re: @jjhampton 's comment here: #366 (comment) I agree, would be easier to go the If not, then @leenyburger you'll want to follow this pattern in order to implement choices for After this piece is wrapped up, this PR should be ready to ship. |
Can you review the conflicts and address the final comments from @hpjaj @leenyburger? |
@dmarchante Yes. I'm out of town until next week but can take a look then. |
Hi @leenyburger how is this going? Is there anything blocking you that I can assist with? |
@wimo7083 No blockers, just haven't been able to find the time. Making up for hurricane delay next week, can take a look the week of the 24th. |
@wimo7083 I'm not going to be able to get to this in a timely manner. Sorry to leave you hanging! |
Okay so I'm going to make the decision we want to use a boolean instead of a string. I think this would align better with what the frontend needs. For this I'd recommend:
If nobody objects I'd like to finish this up. |
I have a maybe philosophical question: what does it mean for a job to have an "active status"? |
@robbkidd Agreed. I feel like that field is unnecessary. I'd prefer a self-cleaning database. We could end up having tons of inactive jobs |
Since we don't know when the job will expire. it's probably best to make it adjustable. I can add something to the route so we eliminate innactive jobs. I went with |
🤔 One option for flagging jobs as either open or closed is to record the date on which it closed. This is a bit like a technique named "soft delete." It would involve adding a datetime column class Job
scope :open, -> { where(closed_at: nil) }
scope :closed, -> { where.not(closed_at: nil) }
def open?
self.closed_at.nil?
end
def closed?
!open?
end
end There is an |
.PHONY: test | ||
test: bg | ||
docker-compose run operationcode-psql bash -c "while ! psql --host=operationcode-psql --username=postgres -c 'SELECT 1'; do sleep 5; done;" | ||
docker-compose run ${RAILS_CONTAINER} bash -c 'export RAILS_ENV=test && rake db:test:prepare && rake test && rubocop' | ||
$(DOCKER_COMPOSE) run operationcode-psql bash -c "while ! psql --host=operationcode-psql --username=postgres -c 'SELECT 1'; do sleep 5; done;" |
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'm starting to feel odd about this.
As this gets bigger it should really be things in their own target, or in a bash script. Large makefiles with lots of distractions are hard to understand. Plus hiding tests behind a very long bash script means I can't pass in parameters to run test groups.
test/factories/jobs.rb
Outdated
city Faker::Address.city | ||
state Faker::Address.state | ||
country Faker::Address.country | ||
description Faker::Lorem.paragraph |
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.
All the attributes being set above this comment should get assigned with block to evaluate the Faker data lazily each time the factory is used instead of at test load time. Otherwise all jobs created with this factory will have the same values.
e.g. title { Faker::Lorem.characters(7) }
@@ -0,0 +1,10 @@ | |||
class Job < ApplicationRecord |
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.
Does having this in the models section of the code base make it clear enough that this is separate from Sidekiq Jobs?
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 so, yes. Though, it might be helpful to rename the background jobs from Job(s) to Worker(s).
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.
Are you sure you don't want JobJobs?
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.
Now that you mention it, maybe WorkJobber
.
Description of changes
Added job functionality.
Includes the following (copied from issue):
new db table
new GET index endpoint
new resource in ActiveAdmin
test coverage
API docs
Jobs table to include:
title
source_url
source
city
state
country
description
status (i.e. active, inactive)
remote
Also include tagging.
Issue Resolved
Fixes #365