fix(rectification): persist the next interview after a choice tap
Closing a discriminator used to leave GET without a card after refresh. Write the next dated question in the same request, skip childhood career and move probes, and do not continue a read-only turn when that question is already persisted. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -71,56 +71,56 @@ LAYER_VARGA = {
|
||||
}
|
||||
DOMAIN_CATALOG: dict[str, dict[str, Any]] = {
|
||||
"education": {
|
||||
"event_family": "升学、高考、转学或学习环境变化",
|
||||
"quality_family": "高考或重要考试发挥明显失常、压力很大",
|
||||
"event_family": "升学、转学或换学习环境",
|
||||
"quality_family": "学业或考试发挥失常、压力特别大",
|
||||
"kind": "education_milestone",
|
||||
"age_lo": 16,
|
||||
"age_hi": 18,
|
||||
"varga": "D5 / D24",
|
||||
},
|
||||
"relocation": {
|
||||
"event_family": "搬家、离乡或长期异地",
|
||||
"quality_family": "搬家、离乡或住宿结构明显变化",
|
||||
"event_family": "搬家或长期住到外地",
|
||||
"quality_family": "搬家或住处特别折腾",
|
||||
"kind": "home_change",
|
||||
"age_lo": 18,
|
||||
"age_hi": 24,
|
||||
"varga": "D4",
|
||||
},
|
||||
"relationship": {
|
||||
"event_family": "认真关系进入、结束或关系观明显转变",
|
||||
"quality_family": "认真关系进入、结束或关系观明显转变",
|
||||
"event_family": "开始一段认真关系、分手或结婚",
|
||||
"quality_family": "感情里压力特别大或相处明显变难",
|
||||
"kind": "relationship_change",
|
||||
"age_lo": 21,
|
||||
"age_hi": 26,
|
||||
"varga": "D9",
|
||||
},
|
||||
"career": {
|
||||
"event_family": "入职、升职或职责明显加重",
|
||||
"quality_family": "入职、升职或职责明显加重",
|
||||
"event_family": "入职、换工作或职责加重",
|
||||
"quality_family": "职责加重或工作压力特别大",
|
||||
"kind": "career_change",
|
||||
"age_lo": 22,
|
||||
"age_hi": 30,
|
||||
"varga": "D10",
|
||||
},
|
||||
"family": {
|
||||
"event_family": "家人相关的明显变化",
|
||||
"quality_family": "家人相关的明显变化",
|
||||
"event_family": "家人结婚、添丁或住院",
|
||||
"quality_family": "家人结婚、添丁、住院或家里特别操心",
|
||||
"kind": "family_event",
|
||||
"age_lo": 18,
|
||||
"age_hi": 30,
|
||||
"varga": "D12 / D7 / D3",
|
||||
},
|
||||
"finance": {
|
||||
"event_family": "收入、资产或财务明显变化",
|
||||
"quality_family": "收入、资产或财务明显变化",
|
||||
"event_family": "收入明显变化、大笔支出或欠债",
|
||||
"quality_family": "收入或财务压力特别大",
|
||||
"kind": "finance_change",
|
||||
"age_lo": 22,
|
||||
"age_hi": 32,
|
||||
"varga": "D2 / D11",
|
||||
},
|
||||
"health_pressure": {
|
||||
"event_family": "健康、事故或持续压力明显变化",
|
||||
"quality_family": "健康、事故或持续压力明显变化",
|
||||
"event_family": "生病、受伤或压力特别大",
|
||||
"quality_family": "生病、受伤或压力特别大",
|
||||
"kind": "self_health_event",
|
||||
"age_lo": 16,
|
||||
"age_hi": 40,
|
||||
@@ -128,9 +128,12 @@ DOMAIN_CATALOG: dict[str, dict[str, Any]] = {
|
||||
},
|
||||
}
|
||||
|
||||
# 入学年与高考通常同一学年或前后一年;存在性探针跳过邻近年,质量探针仍按精确年。
|
||||
# 入学年与高考通常同一学年或前后一年;感情/事业/搬家的邻近年也常是同一段经历。
|
||||
EXISTENCE_NEARBY_YEARS = {
|
||||
"education": 1,
|
||||
"relationship": 1,
|
||||
"career": 1,
|
||||
"relocation": 1,
|
||||
}
|
||||
|
||||
|
||||
@@ -171,6 +174,19 @@ def _year_label(year: int) -> str:
|
||||
return _period_label(year)
|
||||
|
||||
|
||||
# Family events (parents marrying, illness) can occur in childhood.
|
||||
_CHILDHOOD_OK_DOMAINS = frozenset({"family"})
|
||||
|
||||
|
||||
def _domain_year_floor(birth_year: int, domain: str, global_lo: int) -> int:
|
||||
if domain in _CHILDHOOD_OK_DOMAINS:
|
||||
return global_lo
|
||||
catalog = DOMAIN_CATALOG.get(domain)
|
||||
if not catalog:
|
||||
return global_lo
|
||||
return max(global_lo, birth_year + int(catalog["age_lo"]))
|
||||
|
||||
|
||||
def _age_band_year(birth_year: int, domain: str, today: date) -> int | None:
|
||||
catalog = DOMAIN_CATALOG.get(domain)
|
||||
if not catalog:
|
||||
@@ -991,7 +1007,7 @@ def discriminating_event_probes(
|
||||
continue
|
||||
known_years = _event_years(events, domain)
|
||||
blocked_years = _existence_blocked_years(domain, known_years)
|
||||
domain_lo = max(lo, birth_year + int(DOMAIN_CATALOG[domain]["age_lo"])) if domain == "relationship" else lo
|
||||
domain_lo = _domain_year_floor(birth_year, domain, lo)
|
||||
boundary = [item for item in boundary_dates if domain_lo <= item.year <= hi]
|
||||
best = None
|
||||
for at in boundary:
|
||||
|
||||
Reference in New Issue
Block a user