diff --git a/app/jobs/sources.py b/app/jobs/sources.py index 76ceb5e..3eab0bb 100644 --- a/app/jobs/sources.py +++ b/app/jobs/sources.py @@ -46,8 +46,9 @@ def set_board(store: Store, key: str, board: str, *, name: str = "", a company between openings is still one to follow. `check=False` skips the fetch, for the seed, whose boards were read once when it was written. - The row's `ats` and `ats_slug` become the board's host and slug, and its - `careers_url` the board's page where it was empty or the old board's. + The row's `ats` and `ats_slug` become the board's host and slug, its + `careers_url` the board's page where it was empty or the old board's, and + its `hand_reason` empty, since a company that is read is not read by hand. `fields` (domain, country, city, ...) fill only columns that are empty, so nothing a person or the seed wrote is overwritten. Row and subscription change in one transaction (`Store.set_company_board`), and replacing a @@ -82,7 +83,7 @@ def set_board(store: Store, key: str, board: str, *, name: str = "", writes["careers_url"] = careers_url(board) else: writes.setdefault("careers_url", careers_url(board)) - writes.update(ats=host, ats_slug=slug) + writes.update(ats=host, ats_slug=slug, hand_reason="") before = store.company_subscription(key) _company, sub, closed = store.set_company_board(key, board, host=host, name=name, fields=writes) diff --git a/app/web/api.py b/app/web/api.py index d6d960a..0aadefb 100644 --- a/app/web/api.py +++ b/app/web/api.py @@ -10,7 +10,6 @@ This is roledesk's own API, over the same store. Every refusal is from __future__ import annotations from typing import Annotated, Any, Literal -from urllib.parse import urlsplit from fastapi import APIRouter, HTTPException, Query, Response from pydantic import BaseModel, Field diff --git a/tests/test_sources.py b/tests/test_sources.py index d98bced..dccc4b5 100644 --- a/tests/test_sources.py +++ b/tests/test_sources.py @@ -83,6 +83,16 @@ def test_set_board_attaches_a_board_to_a_row_without_one(store: Store, boards: B "ashby", "acme", "acme.example", "met them", "https://acme.example/careers") +def test_set_board_clears_the_reason_a_company_was_read_by_hand( + store: Store, boards: Boards) -> None: + store.add_company("Acme", careers_url="https://acme.example/careers", hand_reason="unread") + sources.set_board(store, "acme", "ashby:acme") + acme = store.company("acme") + assert acme is not None + # The link a person set stays; the reason goes with the board's arrival. + assert (acme.hand_reason, acme.careers_url) == ("", "https://acme.example/careers") + + def test_set_board_replaces_a_board_and_closes_its_open_roles( store: Store, boards: Boards) -> None: old, _, _ = sources.set_board(store, "acme", "greenhouse:acme", name="Acme")