Merge branch 'r2-salary'

This commit is contained in:
Wolf committed 2026-09-29 15:09:19 +02:00
commit bbb7474cef
18 files changed
+528 -57

No files matched your search

+19 -1
View File
@@ -15,7 +15,7 @@ import re
import unicodedata
from typing import Annotated, Any, Literal, get_args
from pydantic import BeforeValidator, Field
from pydantic import BeforeValidator, Field, computed_field
from desk.models import JsonDict, Model, ModelTaskResult
@@ -337,6 +337,10 @@ class Role(Model):
salary_min: int | None = None
salary_max: int | None = None
currency: str = ""
#: The pay a board stated, as one human-readable line, whether or not it
#: could be normalised into `salary_min`/`salary_max`/`currency`
#: (`plugins.ats`'s per-host `_*_salary_text`; docs/decisions.md).
salary_text: str = ""
seniority: str = ""
function: str = ""
permit: Permit = ""
@@ -372,6 +376,20 @@ class Role(Model):
#: column: loaded from `role_tags` alongside the row, see `Store.role`.
tags: list[str] = []
@computed_field # type: ignore[prop-decorator]
@property
def salary_state(self) -> Literal["normalised", "stated", ""]:
"""Not a column: 'normalised' when `salary_min` or `salary_max` is
set, 'stated' when only `salary_text` is, '' otherwise. Gates and
scoring read `salary_min` alone and never this (docs/decisions.md);
it is what the feed's Pay filter and badge read instead
(`Store.PAY`, `static/roles.js`)."""
if self.salary_min is not None or self.salary_max is not None:
return "normalised"
if self.salary_text:
return "stated"
return ""
class ExtractResult(ModelTaskResult):
"""What one run of `extract` did. See app/jobs/extract.py."""