Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/controllers/companies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ def index
@selected_technology = params[:technology]
end

# Filter by preferred status if provided
if params[:preferred].present?
@companies = @companies.where(preferred: params[:preferred] == "true")
end

# Skip sorting for tech_stack since it's aggregated data, but allow other columns
if params[:sort].present? && params[:sort] != "tech_stack"
direction = params[:direction] == "desc" ? "desc" : "asc"
Expand Down Expand Up @@ -103,7 +108,7 @@ def set_company
# Only allow a list of trusted parameters through.
def company_params
params.expect(company: [
:name, :industry, :company_type, :location, :size, :website, :linkedin, :known_tech_stack,
:name, :industry, :company_type, :location, :size, :website, :linkedin, :known_tech_stack, :preferred,
:primary_product, :revenue_model, :funding_stage, :estimated_revenue, :estimated_employees,
:growth_signal, :product_maturity, :engineering_maturity, :process_maturity,
:market_position, :competitor_tier, :brand_signal_strength, :market_size_estimate
Expand Down
2 changes: 2 additions & 0 deletions app/models/company.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class Company < ApplicationRecord
Staffing: "Staffing"
}, validate: true

scope :preferred, -> { where(preferred: true) }

def tech_stack_summary
opportunities
.joins(:technologies)
Expand Down
1 change: 0 additions & 1 deletion app/services/role_focus_analyzer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ def generate_tech_insights_for_opportunities(opportunities, limit)

tech_data.each do |tech_name, count|
percentage = (count.to_f / total_opps * 100).round
next if percentage < 15 # Only show technologies in 15%+ of jobs

tech = Technology.find_by(name: tech_name)
next unless tech
Expand Down
1 change: 1 addition & 0 deletions app/views/companies/_company.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<td><%= company.company_type || "—" %></td>
<td><%= company.location %></td>
<td><%= company.size.present? ? company.size : "—" %></td>
<td><%= company.preferred? ? "✓" : "" %></td>
<td><%= company.website %></td>
<td><%= company.linkedin %></td>
<td>
Expand Down
8 changes: 8 additions & 0 deletions app/views/companies/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
class: "form-select" %>
</div>

<div class="form-group">
<label class="form-label">
<%= form.check_box :preferred %>
<span>Preferred Company</span>
</label>
<p class="form-hint">Mark this as a company you'd really like to work for</p>
</div>

<div class="form-group">
<%= form.label :location, class: "form-label" %>
<%= form.text_field :location, class: "form-input" %>
Expand Down
13 changes: 7 additions & 6 deletions app/views/companies/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
<div class="opportunities-filter-group">
<%= form_with url: companies_path, method: :get, local: true, class: "opportunities-filter-form" do |f| %>
<%= hidden_field_tag :company_query, params[:company_query] %>
<label for="technology_filter" class="form-label opportunities-status-label"></label>
<%= f.select :technology,
options_from_collection_for_select(@technologies, :name, :name, @selected_technology),
{ include_blank: "All Technologies" },
id: "technology_filter",
<label for="preferred_filter" class="form-label opportunities-status-label"></label>
<%= f.select :preferred,
[["All Companies", ""], ["Preferred Only", "true"], ["Not Preferred Only", "false"]],
{ selected: params[:preferred] || "" },
id: "preferred_filter",
class: "form-select opportunities-status-select" %>
<%= f.submit "Filter", class: "btn btn-primary" %>
<% if @selected_technology.present? %>
<% if params[:preferred].present? %>
<%= link_to "Clear", companies_path(company_query: params[:company_query]), class: "btn btn-secondary" %>
<% end %>
<% end %>
Expand Down Expand Up @@ -48,6 +48,7 @@
<th><%= sortable_link :company_type, "Type" %></th>
<th><%= sortable_link :location %></th>
<th><%= sortable_link :size, "Size" %></th>
<th><%= sortable_link :preferred, "Preferred" %></th>
<th><%= sortable_link :website %></th>
<th><%= sortable_link :linkedin %></th>
<th>Tech Stack</th>
Expand Down
27 changes: 16 additions & 11 deletions app/views/opportunities/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -135,20 +135,25 @@
<%= form.label :source, style: "display: block" %>
<%= form.select :source,
options_for_select([
["LinkedIn", "linkedin"],
["JobrightAI", "jobrightai"],
["Y Combinator", "y_combinator"],
["Indeed", "indeed"],
["Company Website", "company_website"],
["Glassdoor", "glassdoor"],
["AngelList", "angellist"],
["Braintrust", "braintrust"],
["Company Website", "company_website"],
["Dice", "dice"],
["Monster", "monster"],
["ZipRecruiter", "ziprecruiter"],
["Referral", "referral"],
["Recruiter", "recruiter"],
["Glassdoor", "glassdoor"],
["gun.io", "gun.io"],
["Indeed", "indeed"],
["Job Fair", "job_fair"],
["Other", "other"]
["JobrightAI", "jobrightai"],
["lemon.io", "lemon.io"],
["LinkedIn", "linkedin"],
["Other", "other"],
["Recruiter", "recruiter"],
["Referral", "referral"],
["Toptal", "toptal"],
["Upwork", "upwork"],
["Wellfound", "wellfound"],
["Y Combinator", "y_combinator"],
["ZipRecruiter", "ziprecruiter"]
], opportunity.source),
{ prompt: "Select source" },
{ style: "display: block; width: 250px; height: 30px;" } %>
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20260824213529_add_preferred_to_companies.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddPreferredToCompanies < ActiveRecord::Migration[8.0]
def change
add_column :companies, :preferred, :boolean, default: false, null: false
end
end
3 changes: 2 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions spec/requests/dashboard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,22 @@
expect(response.body).to match(/Companies That Interviewed Me.*?<div class=\"card-number\">2<\/div>/m)
expect(response.body).to include("66.7% of applications submitted")
end

it "renders the tech skills widget when skills are sparse across opportunities" do
7.times do |index|
opportunity = Opportunity.create!(
company: company,
position_title: "Distinct Tech Role #{index}",
role_type: "software_engineer"
)
technology = Technology.create!(name: "Distinct Tech #{index}", category: "Backend")
OpportunityTechnology.create!(opportunity: opportunity, technology: technology)
end

get dashboard_path

expect(response).to have_http_status(:ok)
expect(response.body).to include("Top 4 Tech Skills to Focus On")
end
end
end
15 changes: 15 additions & 0 deletions spec/requests/opportunities_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,19 @@
expect(response.body).not_to include("Interviewing Role")
end
end

describe "GET /opportunities/new" do
it "renders the current opportunity source options" do
get new_opportunity_path

expect(response).to have_http_status(:ok)
expect(response.body).to include("Wellfound")
expect(response.body).to include("Toptal")
expect(response.body).to include("lemon.io")
expect(response.body).to include("Braintrust")
expect(response.body).to include("gun.io")
expect(response.body).to include("Upwork")
expect(response.body).not_to include(">Monster<")
end
end
end
Loading