Summarise every saved or liked role whatever its rank, queue it at once on save or like, and shorten the order labels to Agent match, CV match and Newest so they fit one line
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1d0a4c37f2
commit
ee8e450640
20 files changed
+208
-60
No files matched your search
+4
-3
@@ -56,9 +56,10 @@ class ExtractConfig(ModelTaskConfig):
|
||||
class SummariseConfig(ModelTaskConfig):
|
||||
"""About 60 words on a role, for the list and the read page. See
|
||||
app/jobs/summarise.py. Off by default like extract; on, a pull summarises
|
||||
only the best of each enabled agent, as deep and as low as that agent's
|
||||
own `limits` say, so the cost is bounded whatever the backlog. The read
|
||||
page's Summarise button asks for one role whether this is on or not."""
|
||||
the best of each enabled agent, as deep and as low as that agent's
|
||||
own `limits` say, so the cost is bounded whatever the backlog, and every
|
||||
role that is saved or liked, whatever its rank. The read page's Summarise button asks for one
|
||||
role whether this is on or not."""
|
||||
|
||||
enabled: bool = False
|
||||
model: str = "claude-haiku-4-5-20251001"
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ written profile and scores skills, experience and career 0 to 100, with one
|
||||
to three strengths and gaps. The total is `app.models.cv_score`, the three
|
||||
numbers under the agent's `cv_*` weights, worked out when a role is served and
|
||||
not stored, so the weights are no part of `input_key`; it is what the feed's
|
||||
Best CV match sorts by. The model also reports a verdict on each of the
|
||||
CV match sorts by. The model also reports a verdict on each of the
|
||||
agent's must-haves (one per line of its must text, numbered M1..Mn in the
|
||||
prompt); it does not apply them. The rule is code's: a "broken" one makes
|
||||
career count as at most `app.models.BROKEN_CAP`, when the role is served. Culture and location are left out: the first
|
||||
|
||||
+12
-6
@@ -5,12 +5,18 @@ this module is the content (which roles are waiting, what one batch carries,
|
||||
what the model is told, the schema it answers in, what to do with the
|
||||
answer), and running it is `desk.modeltask`'s.
|
||||
|
||||
A role is waiting while it has no summary, has some text, and is in the top
|
||||
of an enabled agent's ungated scores as deep and as low as that agent's own
|
||||
`limits` say (`summarise_top`, `summarise_min`). That bound is what keeps the
|
||||
cost flat: a pull summarises the roles somebody will look at, not the 30k
|
||||
that are open. A batch built for named uids (the read page's Summarise
|
||||
button) takes those roles whatever their rank. See `Store.summarise_waiting`.
|
||||
A role is waiting while it has no summary, has some text, is open and no copy,
|
||||
and is either in the top of an enabled agent's ungated scores as deep and as
|
||||
low as that agent's own `limits` say (`summarise_top`, `summarise_min`), or
|
||||
one the owner cares about whatever its rank: saved (it has an application, the
|
||||
star) or voted up by an enabled agent. The limits keep the cost flat: a pull
|
||||
summarises the roles somebody will look at, not the 30k that are open, and the
|
||||
saved and liked roles are a handful the owner picked. Each is summarised
|
||||
once, with the same give-up rule (`GIVE_UP_AFTER` replies that left it
|
||||
without). Saving or liking a role queues a batch for that one uid at once,
|
||||
while the stage is on (`web.api`), rather than waiting for the next pull. A
|
||||
batch built for named uids (the read page's Summarise button) takes those
|
||||
roles whatever their rank. See `Store.summarise_waiting`.
|
||||
|
||||
The text is `article_text` when the posting page was fetched, else
|
||||
`description`. A role with neither is not waiting at all, so it is never sent.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* The Search agents page: what Best match on the Roles tab is measured
|
||||
/* The Search agents page: what Agent match on the Roles tab is measured
|
||||
* against, one agent at a time.
|
||||
*
|
||||
* Every agent from `/api/agents` is a card, newest first: its name, its
|
||||
@@ -42,7 +42,8 @@
|
||||
cv_skills: 30, cv_experience: 25, cv_career: 30 };
|
||||
// What the model reads after a pull, per agent: the best `extract_top`
|
||||
// roles scoring at least `extract_min` get their gate columns filled, the
|
||||
// best `summarise_top` at `summarise_min` or more a summary.
|
||||
// best `summarise_top` at `summarise_min` or more a summary, and so does any
|
||||
// role that is saved or liked, whatever its score.
|
||||
const DEFAULT_LIMITS = { extract_top: 500, extract_min: 0.55, summarise_top: 30, summarise_min: 0.65,
|
||||
judge_top: 150, judge_min: 0.55 };
|
||||
// The levels of a language, the order of the server's ladder, and how big a
|
||||
|
||||
+7
-3
@@ -575,10 +575,14 @@ kbd {
|
||||
.seg { display: flex; }
|
||||
#sort, #f-track { padding: 0 .3rem; }
|
||||
#rail .seg button {
|
||||
flex: 1; text-align: center;
|
||||
font-size: .8rem; padding: .18rem .55rem;
|
||||
flex: 1 1 auto; text-align: center;
|
||||
font-size: .8rem; padding: .18rem .3rem;
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
/* The three order labels share one line: Agent match is the longest and
|
||||
would otherwise wrap in a 240px rail. Cells grow to the width, each by its
|
||||
own text. */
|
||||
#sort button { white-space: nowrap; }
|
||||
/* Square everything first; only the ends are ends. Every cell but the first
|
||||
eats its neighbour's border, so the joins are one rule wide rather than two. */
|
||||
.seg > * { border-radius: 0; }
|
||||
@@ -714,7 +718,7 @@ body[data-reader="open"] .row[data-open="true"] {
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
/* Newest first hides the score, because in that order it is not what put the
|
||||
/* Newest hides the score, because in that order it is not what put the
|
||||
row where it is. Done here rather than in the row template so the markup is
|
||||
the same either way and only the stylesheet knows about the order -- the
|
||||
gutter goes with it, since a bar with no number beside it is a measurement
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@
|
||||
const DOES = {
|
||||
extract: "fills in country, seniority, salary and the like from what the posting says",
|
||||
summarise: "writes a short summary and tags for the best roles",
|
||||
judge: "scores the best roles against a search agent's CV, for Best CV match",
|
||||
judge: "scores the best roles against a search agent's CV, for CV match",
|
||||
enrich: "reads the own page of the best roles whose list gave no text",
|
||||
};
|
||||
|
||||
|
||||
+17
-17
@@ -9,8 +9,8 @@
|
||||
* from app.js, so a failure is one toast carrying the server's own sentence.
|
||||
*
|
||||
* A row is newsdesk's `.row`: the score gutter and number (hidden under
|
||||
* Newest first, since the score is not what put the row there, and the CV
|
||||
* match under Best CV match, a dash for a role not judged yet), the title,
|
||||
* Newest, since the score is not what put the row there, and the CV
|
||||
* match under CV match, a dash for a role not judged yet), the title,
|
||||
* company · place · badges · age · tags, the summary or the description's
|
||||
* opening, and ▼ ● ▲ ★ from judge.js. A passed role and a hidden company's
|
||||
* are dimmed, never dropped, so a stray tap stays visible to be undone.
|
||||
@@ -32,12 +32,12 @@
|
||||
* Picking another reloads the feed and the counts under the reader, which
|
||||
* stays open and is fetched again for that agent's vote.
|
||||
*
|
||||
* Order is Best first (`order=score`, the agent's score moved by its votes),
|
||||
* Newest first (`order=newest`) or Best CV match (`order=cv`, the roles the
|
||||
* Order is Agent match (`order=score`, the agent's score moved by its votes),
|
||||
* Newest (`order=newest`) or CV match (`order=cv`, the roles the
|
||||
* agent's `judge` read against its CV first, by that total), the same three
|
||||
* whichever agent is viewed, and all carry the agent's votes and hidden
|
||||
* companies. Best CV match needs a CV: an agent without one is shown Best
|
||||
* first, as an agentless page is shown Newest first.
|
||||
* companies. CV match needs a CV: an agent without one is shown Agent
|
||||
* match, as an agentless page is shown Newest.
|
||||
*
|
||||
* The filters are in the query string, so a reload or a link keeps them, and
|
||||
* each one set is a history entry, so back takes it off again: a tag, the
|
||||
@@ -119,10 +119,10 @@
|
||||
};
|
||||
const TRACKS = { "": "Both", ic: "Individual", people: "People" };
|
||||
|
||||
// What the list is in the order of. Best first is the viewing agent's
|
||||
// score, moved by its votes; Newest first is first seen; Best CV match is
|
||||
// What the list is in the order of. Agent match is the viewing agent's
|
||||
// score, moved by its votes; Newest is first seen; CV match is
|
||||
// the agent's `judge` total, the roles not judged after by score.
|
||||
const SORTS = { score: "Best first", time: "Newest first", cv: "Best CV match" };
|
||||
const SORTS = { score: "Agent match", cv: "CV match", time: "Newest" };
|
||||
// The route's `order` for each.
|
||||
const ORDERS = { score: "score", time: "newest", cv: "cv" };
|
||||
// How many days ahead a deadline earns a badge: today to today + 4, the
|
||||
@@ -215,13 +215,13 @@
|
||||
/** The viewing agent, once the agents are in. */
|
||||
const viewed = () => state.agents.find((a) => a.id === state.filter.agent) || null;
|
||||
|
||||
/** Whether Best CV match has a CV to go by: the viewed agent has one, or
|
||||
/** Whether CV match has a CV to go by: the viewed agent has one, or
|
||||
the agents are not in yet, when the address is taken at its word. */
|
||||
const hasCv = () => !state.agentsLoaded || Boolean(viewed()?.cv_text?.trim());
|
||||
|
||||
/** The order the list is in. Best first needs an agent to score by: with
|
||||
/** The order the list is in. Agent match needs an agent to score by: with
|
||||
none enabled the server answers newest first, and so does this. Best
|
||||
CV match needs that agent's CV too, and without one is Best first. */
|
||||
CV match needs that agent's CV too, and without one is Agent match. */
|
||||
function sortShown() {
|
||||
const { sort, agent } = state.filter;
|
||||
if (sort === "time" || agent === null) return "time";
|
||||
@@ -652,8 +652,8 @@
|
||||
|
||||
renderAgent();
|
||||
|
||||
// The order, the same three whatever is viewed. Best first needs an
|
||||
// agent to score by, and Best CV match that agent's CV, so without one
|
||||
// The order, the same three whatever is viewed. Agent match needs an
|
||||
// agent to score by, and CV match that agent's CV, so without one
|
||||
// each is greyed and says why.
|
||||
const none = state.agentsLoaded && !state.agents.length;
|
||||
const why = {
|
||||
@@ -1041,7 +1041,7 @@
|
||||
}
|
||||
|
||||
/* The gutter's number, of 100, and what it says: the agent's score, or
|
||||
under Best CV match the CV match, where a role `judge` has not read yet
|
||||
under CV match the CV match, where a role `judge` has not read yet
|
||||
shows a dash and an empty bar. */
|
||||
function gutterOf(role) {
|
||||
if (sortShown() === "cv") {
|
||||
@@ -1130,7 +1130,7 @@
|
||||
const rowAt = (i) => $(`#roles-list .row[data-idx="${i}"]`);
|
||||
|
||||
function renderFeed() {
|
||||
// Which order the list is in, for the stylesheet: under Newest first the
|
||||
// Which order the list is in, for the stylesheet: under Newest the
|
||||
// score gutter goes, since the score is not what put the row where it is.
|
||||
$("#list").dataset.sort = sortShown();
|
||||
sync($("#roles-list"), state.items.map((role, i) => [role.uid, { role, i }]), makeRow, fillRow);
|
||||
@@ -1949,7 +1949,7 @@
|
||||
// known, and either way bring the reader's affinity control and judge
|
||||
// buttons up to date, since `companies` was still empty when it first
|
||||
// painted.
|
||||
// Best CV match asked of an agent with no CV is Best first.
|
||||
// CV match asked of an agent with no CV is Agent match.
|
||||
if (state.filter.agent !== before || sortShown() !== sortBefore) reload();
|
||||
else renderFeed();
|
||||
if (state.readingUid) {
|
||||
|
||||
@@ -491,7 +491,7 @@ CREATE INDEX IF NOT EXISTS idx_role_remote_place ON role_remote(place_id, uid);
|
||||
CREATE INDEX IF NOT EXISTS idx_roles_prep_due ON roles(prep_due) WHERE prep_due > 0;
|
||||
-- The feed's Closing soon filter. Partial: most roles state no deadline.
|
||||
CREATE INDEX IF NOT EXISTS idx_roles_deadline ON roles(deadline) WHERE deadline IS NOT NULL;
|
||||
-- An agent's judgements, for its feed under Best CV match.
|
||||
-- An agent's judgements, for its feed under CV match.
|
||||
CREATE INDEX IF NOT EXISTS idx_role_judgements_agent ON role_judgements(agent_id, cv_score DESC);
|
||||
"""
|
||||
|
||||
|
||||
+13
-5
@@ -145,7 +145,7 @@ def _cv_sql(weights: Weights | None) -> str:
|
||||
|
||||
|
||||
def _by_cv(expression: str) -> str:
|
||||
"""The order of Best CV match: the judged roles by `cv_score` (its SQL
|
||||
"""The order of CV match: the judged roles by `cv_score` (its SQL
|
||||
`expression`), then the rest by score, as `roles` orders them."""
|
||||
return f"{expression} IS NULL, {expression} DESC, "
|
||||
|
||||
@@ -1143,7 +1143,7 @@ class Store:
|
||||
no score.
|
||||
|
||||
With `by_cv` as well, the roles the agent's `judge` read come first
|
||||
by `cv_score`, then the others by score (Best CV match). Every row
|
||||
by `cv_score`, then the others by score (CV match). Every row
|
||||
carries the agent's `cv_score` (None when not judged), computed
|
||||
from the three numbers under the agent's weights at read time, and the
|
||||
language flag of its languages against the agent's
|
||||
@@ -1787,7 +1787,9 @@ class Store:
|
||||
"""The `WHERE` for a role `summarise` may be sent: no summary yet and
|
||||
some text to summarise. Given `uids`, those of them and nothing else,
|
||||
open or not and given up or not, because somebody asked for them.
|
||||
Otherwise open, not given up, and in `_top_scope`."""
|
||||
Otherwise open, not given up, and in `_top_scope` or one the owner
|
||||
cares about whatever its rank: saved (it has an application) or voted
|
||||
up by an enabled agent."""
|
||||
where = ["r.summary = ''",
|
||||
"(TRIM(r.article_text) <> '' OR TRIM(r.description) <> '')"]
|
||||
if uids is not None:
|
||||
@@ -1800,7 +1802,12 @@ class Store:
|
||||
f"""NOT EXISTS (SELECT 1 FROM state
|
||||
WHERE key = '{self._SUMMARY_MISSED}' || r.uid
|
||||
AND CAST(value AS INTEGER) >= {GIVE_UP_AFTER})""",
|
||||
top,
|
||||
f"""({top}
|
||||
OR r.uid IN (SELECT role_uid FROM applications
|
||||
WHERE role_uid IS NOT NULL)
|
||||
OR r.uid IN (SELECT v.uid FROM role_votes v
|
||||
JOIN agents a ON a.id = v.agent_id AND a.enabled = 1
|
||||
WHERE v.vote = 1))""",
|
||||
]
|
||||
return " AND ".join(where), params
|
||||
|
||||
@@ -1813,7 +1820,8 @@ class Store:
|
||||
"""Roles `summarise` has yet to write, newest first: the top of every
|
||||
enabled agent's scores, as deep and as low as that agent's own
|
||||
`limits` say, so the backlog is bounded by the agents rather than by
|
||||
the number of open roles; given `uids`, those still without a
|
||||
the number of open roles, and every open role that is saved or voted
|
||||
up by an enabled agent, whatever its rank; given `uids`, those still without a
|
||||
summary, whatever their rank. A batch asks again when it runs."""
|
||||
where, params = self._summary_scope(uids)
|
||||
return [Role.from_row(r) for r in self._rows(
|
||||
|
||||
@@ -55,8 +55,8 @@
|
||||
</section>
|
||||
<section>
|
||||
<h3>Order</h3>
|
||||
{# Best first is the viewing agent's score, Newest first is first seen,
|
||||
Best CV match the agent's `judge` total against its CV; all carry
|
||||
{# Agent match is the viewing agent's score, Newest is first seen,
|
||||
CV match the agent's `judge` total against its CV; all carry
|
||||
that agent's votes. #}
|
||||
<div class="seg" id="sort" role="group" aria-label="Order"></div>
|
||||
<label class="rail-field" for="period">First seen</label>
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
</fieldset>
|
||||
<fieldset class="terms cv">
|
||||
<legend>Your CV</legend>
|
||||
<span class="hint">Optional. With a CV, the judge stage reads each of this agent's best roles against it and scores skills, experience and career, which Best CV match on Roles sorts by. A role is read at most once per change of the CV, the prompts or the texts below. The CV stays in this app and goes only to the model you set up.</span>
|
||||
<span class="hint">Optional. With a CV, the judge stage reads each of this agent's best roles against it and scores skills, experience and career, which CV match on Roles sorts by. A role is read at most once per change of the CV, the prompts or the texts below. The CV stays in this app and goes only to the model you set up.</span>
|
||||
<label>CV
|
||||
<textarea id="a-cv-text" rows="10" placeholder="Paste your CV or career summary here"></textarea></label>
|
||||
<label>or read it from a file
|
||||
@@ -122,7 +122,7 @@
|
||||
<label>Judge against the CV the best <input type="number" id="a-judge-top" min="0" step="10" value="150"></label>
|
||||
<label>down to a score of <input type="number" id="a-judge-min" min="0" max="1" step="0.05" value="0.55"></label>
|
||||
</fieldset>
|
||||
<span class="hint">Every pull scores every open role for free; these bound what the model then reads, per agent. The count is the backstop, the score the real stop. Fit is a level, the same in every run: a new role with the worst fit scores about 0.27, a perfect one about 0.87. An agent with no prompt feeds neither extract nor summarise, and one with no CV feeds not the judge.</span>
|
||||
<span class="hint">Every pull scores every open role for free; these bound what the model then reads, per agent. The count is the backstop, the score the real stop. Fit is a level, the same in every run: a new role with the worst fit scores about 0.27, a perfect one about 0.87. Roles you saved or liked are summarised too, whatever their score. An agent with no prompt feeds neither extract nor summarise, and one with no CV feeds not the judge.</span>
|
||||
<details class="advanced">
|
||||
<summary>Advanced</summary>
|
||||
<div class="advanced-body">
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
|
||||
<section class="card" id="company-boards" data-section>
|
||||
<h2>Company boards</h2>
|
||||
<p class="lede">Every company roledesk has seen, and how many of its roles are open. Switching a board off stops reading it and closes its roles; hiding a company keeps reading it but leaves its roles out of the list and unscored, and favourite or like lifts one instead, in Best match.</p>
|
||||
<p class="lede">Every company roledesk has seen, and how many of its roles are open. Switching a board off stops reading it and closes its roles; hiding a company keeps reading it but leaves its roles out of the list and unscored, and favourite or like lifts one instead, in Agent match.</p>
|
||||
|
||||
<form id="board-form" class="agent-form source-form" autocomplete="off">
|
||||
<h3>Follow a company</h3>
|
||||
|
||||
+35
-8
@@ -15,6 +15,7 @@ from fastapi import APIRouter, Depends, HTTPException, Query, Response
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from app import jobs, places
|
||||
from app.config import Config
|
||||
from app.models import (
|
||||
AFFINITY, RUNGS, TRACKS, Agent, Application, Company, CvLanguage, CvLanguages, FetchTerms,
|
||||
Gate, Limits, Prompts, Role, RoleRow,
|
||||
@@ -163,15 +164,21 @@ def get_role(uid: str, store: StoreDep, agent: int | None = None) -> ScoredRole:
|
||||
|
||||
|
||||
@router.post("/roles/{uid}/vote")
|
||||
def vote_role(uid: str, body: VoteBody, store: StoreDep) -> ScoredRole:
|
||||
def vote_role(uid: str, body: VoteBody, store: StoreDep, config: ConfigDep,
|
||||
queue: QueueDep) -> ScoredRole:
|
||||
"""1 like, 0 neither way, -1 pass, for `body.agent` or the default agent.
|
||||
The role stays listed either way; the vote moves it in that agent's
|
||||
ranking, see `Store.roles`, and shapes its taste at the next `score`."""
|
||||
ranking, see `Store.roles`, and shapes its taste at the next `score`. A
|
||||
like from an enabled agent also queues the role's summary, see
|
||||
`_queue_summary`."""
|
||||
owner = _agent_or_default(store, body.agent)
|
||||
try:
|
||||
return store.set_vote(owner.id, uid, body.value)
|
||||
voted = store.set_vote(owner.id, uid, body.value)
|
||||
except KeyError:
|
||||
raise HTTPException(404, f"no such role: {uid}") from None
|
||||
if body.value == 1 and owner.enabled:
|
||||
_queue_summary(voted, store, config, queue)
|
||||
return voted
|
||||
|
||||
|
||||
@router.delete("/roles/{uid}/vote")
|
||||
@@ -231,7 +238,7 @@ def list_roles(
|
||||
passed. With `order=score` (the default) the roles are the ones that
|
||||
agent scored, best first, carrying `score` and `gated_reason`, a gated
|
||||
one only with `gated=1`; with `order=newest` every open role, newest
|
||||
first, with no score; with `order=cv` (Best CV match) the scored roles
|
||||
first, with no score; with `order=cv` (CV match) the scored roles
|
||||
the agent's `judge` read come first by `cv_score`, the rest after them
|
||||
by score. Without `agent` the default agent's votes and
|
||||
hidden companies apply, the order is newest and there is no score; with
|
||||
@@ -414,6 +421,22 @@ def fetch_text(uid: str, store: StoreDep, agent: int | None = None) -> ScoredRol
|
||||
return role
|
||||
|
||||
|
||||
def _queue_summary(role: Role, store: Store, config: Config, queue: Any) -> None:
|
||||
"""Queue the summary of a role the owner just saved or liked, without
|
||||
waiting for the next pull: one batch of this uid, under the key the read
|
||||
page's button uses, so a double tap and the button share one job. Only
|
||||
while the summarise stage is on (`jobs.stages`), for a role with no summary
|
||||
yet and some text, and with a model reachable; otherwise nothing, and the
|
||||
save or vote is not the place to say why."""
|
||||
if (role.summary or not (role.article_text.strip() or role.description.strip())
|
||||
or not jobs.stages.stage_on(config, store, "summarise")
|
||||
or not agent.backend(config.agent)):
|
||||
return
|
||||
queue.enqueue(f"{jobs.summarise.TASK.kind}_batch", {"uids": [role.uid]},
|
||||
label=f"Summarising {role.title or role.uid}",
|
||||
dedup_key=f"summarise:{role.uid}")
|
||||
|
||||
|
||||
@router.post("/roles/{uid}/summarise", status_code=202)
|
||||
def summarise_role(uid: str, store: StoreDep, config: ConfigDep, queue: QueueDep) -> Job:
|
||||
"""Queue a summary of one role, whatever its rank and whether or not the
|
||||
@@ -745,7 +768,7 @@ def set_affinity(key: str, body: AffinityBody, store: StoreDep,
|
||||
"""-1 hidden, 0 neutral, 1 liked, 2 favourite, for `body.agent` or the
|
||||
default agent. A key with roles and no company row gets one first (see
|
||||
`Store.set_affinity`); 404 for a key with neither. A change here is not
|
||||
seen in Best match until `score` has run, so it queues one
|
||||
seen in Agent match until `score` has run, so it queues one
|
||||
(`_score_after_change`) and answers with its id."""
|
||||
if body.affinity not in AFFINITY:
|
||||
raise HTTPException(422, "affinity is -1, 0, 1 or 2")
|
||||
@@ -1140,10 +1163,12 @@ class SaveBody(BaseModel):
|
||||
|
||||
|
||||
@router.post("/applications", status_code=201)
|
||||
def save_role(body: SaveBody, store: StoreDep) -> Application:
|
||||
def save_role(body: SaveBody, store: StoreDep, config: ConfigDep,
|
||||
queue: QueueDep) -> Application:
|
||||
"""Track one role: the ★ on a role. Pressing it twice does not
|
||||
double-track it: the existing row comes back rather than a second one
|
||||
starting at `saved` over whatever status it has since moved to."""
|
||||
starting at `saved` over whatever status it has since moved to. A saved
|
||||
role is also queued for its summary, see `_queue_summary`."""
|
||||
existing = next((a for a in store.applications() if a.role_uid == body.role_uid), None)
|
||||
if existing is not None:
|
||||
return existing
|
||||
@@ -1153,7 +1178,9 @@ def save_role(body: SaveBody, store: StoreDep) -> Application:
|
||||
application = Application(
|
||||
role_uid=role.uid, company_key=role.company_key, role_title=role.title,
|
||||
url=role.original_url, status=body.status, source=role.source)
|
||||
return store.save_application(application)
|
||||
saved = store.save_application(application)
|
||||
_queue_summary(role, store, config, queue)
|
||||
return saved
|
||||
|
||||
|
||||
@router.delete("/applications/{app_id}", status_code=204)
|
||||
|
||||
Reference in new issue
Block a user