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
9 changes: 9 additions & 0 deletions src/fortune_intel/storage/summary_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ def overview(self, *, include_synthetic: bool = True, us_only: bool = False) ->
WHERE s.enabled = 1 AND s.last_success_at IS NOT NULL
AND (? = 1 OR source_company.is_synthetic = 0)
) AS companies_with_successful_job_fetches,
(
SELECT COUNT(DISTINCT s.company_id)
FROM career_sources s JOIN companies source_company
ON source_company.id = s.company_id
WHERE s.enabled = 1 AND s.last_success_at IS NOT NULL
AND s.consecutive_failures < 2
AND (? = 1 OR source_company.is_synthetic = 0)
) AS companies_with_current_job_fetches,
COUNT(CASE WHEN j.status = 'active' AND (? = 1 OR c.is_synthetic = 0)
AND (? = 0 OR j.us_eligibility = 'eligible') THEN 1 END) AS active_jobs,
COUNT(CASE WHEN j.status = 'active' AND j.sponsorship_tier IN ('A','B','C','E')
Expand All @@ -140,6 +148,7 @@ def overview(self, *, include_synthetic: bool = True, us_only: bool = False) ->
int(include_synthetic),
int(include_synthetic),
int(include_synthetic),
int(include_synthetic),
int(us_only),
int(include_synthetic),
int(us_only),
Expand Down
2 changes: 1 addition & 1 deletion src/fortune_intel/web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async function loadStats() {
document.querySelector("#stat-jobs").textContent = Number(stats.active_jobs).toLocaleString();
document.querySelector("#stat-companies").textContent = Number(stats.companies).toLocaleString();
document.querySelector("#stat-fetching-companies").textContent = Number(
stats.companies_with_successful_job_fetches,
stats.companies_with_current_job_fetches,
).toLocaleString();
document.querySelector("#stat-h1b").textContent = Number(stats.h1b_employers).toLocaleString();
document.querySelector("#stat-evidence").textContent = Number(stats.jobs_with_evidence).toLocaleString();
Expand Down
10 changes: 8 additions & 2 deletions src/fortune_intel/web/companies.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function loadCompanies() {
const data = await response.json();
if (requestId !== latestRequest) return;
total = data.total;
const covered = data.items.filter((company) => company.source_last_success_at).length;
const covered = data.items.filter((company) => company.coverage_disposition === "supported").length;
const rows = data.items.map((company) => {
const row = document.createElement("tr");
const name = document.createElement("a");
Expand All @@ -32,7 +32,13 @@ async function loadCompanies() {
nameCell,
cell(Number(company.active_jobs).toLocaleString()),
cell(company.source_last_success_at ? new Date(company.source_last_success_at).toLocaleString() : "—"),
cell(company.source_last_success_at ? "Successfully covered" : company.coverage_disposition.replaceAll("_", " ")),
cell(
company.coverage_disposition === "supported"
? "Current successful source"
: company.coverage_disposition === "stale"
? "Stale — needs revalidation"
: company.coverage_disposition.replaceAll("_", " "),
),
);
return row;
});
Expand Down
1 change: 1 addition & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def test_search_api_and_stats(tmp_path):
assert stats["active_jobs"] == 4
assert stats["companies"] == 4
assert stats["companies_with_successful_job_fetches"] == 0
assert stats["companies_with_current_job_fetches"] == 0
assert stats["jobs_with_evidence"] == 3


Expand Down
Loading