fix(forms): a picked time range no longer erases its other end, the missing-items line names what is missing, hour-branch profiles show what was filled, onboarding says why 继续 is disabled, plain first starter question (BUG-2186, BUG-2187, BUG-2188, BUG-2199)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXp2Vp62Ur3C7yRWQdSq
This commit is contained in:
@@ -29448,3 +29448,47 @@
|
||||
- 根因与修复:(1) `redeem_code_v2` 对「单个码被自己重复兑换」不再记失败次数,改变了旧行为;改回:单个码照旧记一次失败,只有活动码的「你已经领过」不记(迁移在任何环境都还没执行过,原地修改)。(2) `credits` 是兑换后的余额(旧合同不变),该用户前面已兑过别的码;测试改为断言兑换后余额,原值/新值/原因见测试注释。(3) 同一次门禁里两条新迁移在 `database-redeem-code-kinds-330`、`database-release-notes-331` 都按完整链成功执行(前者在迁移之后的断言才失败、后者通过),这是今天第四次出现的 CI 测试库偶发迁移失败(错误台账 2026-11-22 条),不是新迁移引起。(4) 见下方提交说明。
|
||||
- 关联记录:BUG-2172、#330、#331、错误台账 2026-11-22「CI 测试库偶发 database migration failed」。
|
||||
- (4) 补:两次运行一次拿到官方数据、一次没有,是因为回显核对只加在单次请求的缓存读取上,而整份快照的语义缓存和前台快照缓存的键没变,仍会读出核对之前写入的旧记录(可能就是示例盘);门禁机器的工作目录跨次保留这些缓存,不同运行按时序走到不同缓存,结果不一致。修复:语义缓存键加 `echo_guard: v1`,前台快照缓存 schema 从 `vedastro_snapshot_cache.v1` 升到 v2,核对之前写入的记录一律不再读取。本机(正常网络、断网模拟)该测试文件均通过;`test_api_scratch_retention.py::test_numeric_birth_spellings_share_one_chart_cache_key` 在未改动的 staging 上同样失败,与本改动无关。
|
||||
|
||||
## BUG-2186 | 星盘表单:「家人记得大概几点」填了时间和范围仍判缺项,保存不了
|
||||
|
||||
- 状态:fixed-pending-verify。
|
||||
- 首次发现 / 最近更新:2026-11-22 / 2026-11-22。
|
||||
- 触发与现象:负责人用 AI 按手册测测试站(T-02):星盘档案新增,选「家人记得大概几点」+ 时间 + 最早、最晚范围,底部仍写「还差:出生日期与出生时间来源」,保存不可用。
|
||||
- 根因:`birth-time-intake.tsx` 范围字段的 `editRange` 从 `clockSourceRangeForDraft` 取另一端,而它在两端都有之前返回空,所以选「最晚」会把已选的「最早」清掉,下拉框却仍显示它;任何顺序都填不完整,只有「说不准」能过。星盘档案、星盘页编辑、合盘新增、引导「大概记得 → 几点」都受影响。缺项那一行 `MISSING_STEP_HINT.birth` 对所有出生资料问题只有一句固定文字。#144 范围字段自带的缺陷,BUG-2062、BUG-2144 复用时带了过来;旧测试一次同时设两端,没有逐个选。
|
||||
- 修复:`birth-time-intake-model.ts` 新增 `clockRangeFieldValues`、`clockRangeEditPatch`,保留并显示单独选中的一端;新增 `birthTimeDraftMissing` 和 `home-profile.ts` 的 `missingBirthHint` / `missingItemsLine`,缺项行写真正缺的项(出生日期、出生时间来源、出生时间、最早和最晚时间、时辰、开始和结束时间)。
|
||||
- 验证与防复发:`frontend/tests/form-findings-2186.test.tsx`(两种顺序逐个选范围;19 种回答路径下缺项行与按钮一致)。
|
||||
- 尚未处理:手机上星盘档案 / 合盘弹窗隐藏了「还差」这一行,保存置灰时仍没有原因,待负责人定;未在浏览器里走过。
|
||||
- 关联记录:#144、BUG-2062、BUG-2144、BUG-1664。
|
||||
- 修复版本:`claude/form-findings-2186`。
|
||||
|
||||
## BUG-2187 | 只填时辰的档案显示「还没填」;选了出生证明还要再点「记录下来的」
|
||||
|
||||
- 状态:fixed-pending-verify。
|
||||
- 首次发现 / 最近更新:2026-11-22 / 2026-11-22。
|
||||
- 触发与现象:(T-07)只填时辰(如辰时)的档案,详情写「还没填」、列表写「出生时间待补全」;合盘新增星盘选「出生证明、医院记录」并填时间后按钮仍禁用,要再点一次「记录下来的」。
|
||||
- 根因:`profileBirthTimeLabel` 只认钟点和五个时段,详情卡只印钟点;选来源时把 `birthTimeRecordKind` 重置为空,「记录下来的」成了必点的第二步。
|
||||
- 修复:列表和详情显示实际填的内容(如「辰时(07:00—08:59)」、自定时段「06:30—09:10」),只有完全没给时间才写待补全;新增 `birthTimeSourcePickPatch`,选出生证明或户口本时直接记为「记录下来的」(与引导「有记录」写入的值相同),「大概记得」一步可改;再点已选项不再清空。共用的 `BirthTimeIntakeFields`,星盘档案、星盘页编辑、合盘新增同时生效。
|
||||
- 验证与防复发:同一测试文件(时辰标签、一步选中记录);相关断言按原值、新值、原因更新。
|
||||
- 关联记录:BUG-2144、BUG-2186。
|
||||
- 修复版本:`claude/form-findings-2186`。
|
||||
|
||||
## BUG-2188 | 引导里「继续」置灰但不说缺什么
|
||||
|
||||
- 状态:fixed-pending-verify。
|
||||
- 首次发现 / 最近更新:2026-11-22 / 2026-11-22。
|
||||
- 触发与现象:(T-10)帮别人看只填对方名字,「继续」仍灰,没说还缺自己的称呼。
|
||||
- 修复:`home-onboarding-shell.tsx` 三屏的按钮下都显示「还差:…」(沿用表单弹窗的缺项行样式),例如「还差:你的称呼」「还差:出生日期、这个时间有没有记录」「还差:出生地点」。这改掉了 BUG-2144 当时「按钮置灰即可、不显示提示」的做法,依据是负责人 2026-11-22 采纳测试建议。
|
||||
- 核对结论:引导里「有记录」之后不出现「出生证明、医院记录」细分是 BUG-2144 已批准原型的设计(六种来源收成有记录 / 大概记得 / 不知道,对应表见 `onboarding-birth-time.ts` 文件头),未改动;引导因此记不了「户口本、其他证件」。
|
||||
- 验证与防复发:同一测试文件(三屏缺项行)。
|
||||
- 关联记录:BUG-2144。
|
||||
- 修复版本:`claude/form-findings-2186`。
|
||||
|
||||
## BUG-2199 | 首页第一个示例问题对新用户太术语
|
||||
|
||||
- 状态:fixed-pending-verify。
|
||||
- 首次发现 / 最近更新:2026-11-22 / 2026-11-22。
|
||||
- 触发与现象:第一个示例问题写「上升处女、月亮双鱼,我是个什么样的人」,新用户看不懂星座术语。
|
||||
- 修复:负责人定为「我是一个什么样的人?」;帮别人看时按原规则换成对方称呼。只改 `starter-questions.ts` 的标签,发送的文字和入口标识不变。
|
||||
- 验证与防复发:`starter-chart-signs-20261027.test.ts` 按原值、新值、原因更新。
|
||||
- 关联记录:BUG-2144、BUG-2160。
|
||||
- 修复版本:`claude/form-findings-2186`。
|
||||
|
||||
@@ -3165,6 +3165,7 @@ input:not([type="radio"]):not([type="checkbox"]):not([class^="ant-"]):not([class
|
||||
.onboarding-screen-card [data-slot="input"] { height: 44px; padding: 0 12px; border-radius: var(--radius-md); font-size: var(--type-body-md); }
|
||||
.onboarding-screen-actions { display: grid; gap: var(--space-2); }
|
||||
.onboarding-screen-actions .button-primary { width: 100%; height: 44px; }
|
||||
.onboarding-screen-actions .onboarding-missing { justify-self: center; text-align: center; }
|
||||
.onboarding-screen-actions .onboarding-back { justify-self: center; min-height: 36px; color: var(--color-ink-secondary); font-size: var(--type-caption); }
|
||||
.onboarding-birth-time { display: grid; gap: var(--space-5); }
|
||||
.onboarding-birth-time > .birth-time-lock { display: grid; gap: var(--space-5); }
|
||||
|
||||
@@ -18,9 +18,10 @@ import {
|
||||
SHICHEN_RECORD_KIND_QUESTION,
|
||||
birthTimeDisplayState,
|
||||
birthTimePeriodOptions,
|
||||
birthTimeSourceDefaults,
|
||||
birthTimeSourceOptions,
|
||||
clockSourceRangeForDraft,
|
||||
birthTimeSourcePickPatch,
|
||||
clockRangeEditPatch,
|
||||
clockRangeFieldValues,
|
||||
isClockBirthTimeSource,
|
||||
recordKindOptions,
|
||||
readShichenClue,
|
||||
@@ -310,17 +311,7 @@ export function BirthTimeIntakeFields({ value, onPatch, lockReportedTime = false
|
||||
const option = birthTimeSourceOptions.find((item) => item.value === next);
|
||||
if (!option) return;
|
||||
setChoosingSource(false);
|
||||
const nextSource = option.value === "shichen" ? "period_only" : option.value;
|
||||
emitTime({
|
||||
birthTimeSource: nextSource,
|
||||
birthTimeStatus: "reported",
|
||||
time: "",
|
||||
...birthTimeSourceDefaults[nextSource],
|
||||
birthTimeClue: "",
|
||||
birthTimeRecordKind: "",
|
||||
birthTimeUncertaintyKnown: null,
|
||||
birthTimeShichen: option.value === "shichen" ? "" : undefined,
|
||||
});
|
||||
emitTime(birthTimeSourcePickPatch(option.value));
|
||||
}}
|
||||
>
|
||||
{birthTimeSourceOptions.map((option) => (
|
||||
@@ -357,7 +348,8 @@ export function BirthTimeIntakeFields({ value, onPatch, lockReportedTime = false
|
||||
value={value.birthTimeRecordKind === "recorded" || value.birthTimeRecordKind === "approximate"
|
||||
? value.birthTimeRecordKind
|
||||
: ""}
|
||||
onChange={(birthTimeRecordKind: BirthTimeRecordKind) => emitTime(birthTimeRecordKind === "recorded"
|
||||
// BUG-2187: one of the two is always needed, so pressing the chosen one again keeps it.
|
||||
onChange={(birthTimeRecordKind: BirthTimeRecordKind) => birthTimeRecordKind === "" ? undefined : emitTime(birthTimeRecordKind === "recorded"
|
||||
? {
|
||||
birthTimeRecordKind,
|
||||
birthTimeUncertaintyKnown: false,
|
||||
@@ -401,19 +393,12 @@ type EmitBirthTime = (patch: BirthTimeDraftPatch) => void;
|
||||
|
||||
/** 「可能最早、最晚是几点?」 with 「说不准」, for a stated clock time (issue #144). Shared with the first-run birth screen (BUG-2144). */
|
||||
export function BirthTimeRangeFields({ value, emitTime }: { readonly value: BirthTimeDraft; readonly emitTime: EmitBirthTime }) {
|
||||
const range = isClockBirthTimeSource(value.birthTimeSource) ? clockSourceRangeForDraft(value) : null;
|
||||
// BUG-2186: one end picked alone is shown and kept while the other is still empty.
|
||||
const range = isClockBirthTimeSource(value.birthTimeSource) ? clockRangeFieldValues(value) : null;
|
||||
const uncertaintyUnknown = value.birthTimeUncertaintyKnown === false;
|
||||
// An old `family_exact` profile becomes a remembered time once its range is edited.
|
||||
const clockSourcePatch = value.birthTimeSource === "family_exact" ? { birthTimeSource: "approximate" as const } : {};
|
||||
const editRange = (end: "start" | "end", clock: string) => emitTime({
|
||||
...clockSourcePatch,
|
||||
declaredWindowStart: end === "start" ? clock : range?.startTime ?? "",
|
||||
declaredWindowEnd: end === "end" ? clock : range?.endTime ?? "",
|
||||
// Minutes before / after are worked out from the clocks when saved.
|
||||
uncertaintyBeforeMinutes: null,
|
||||
uncertaintyAfterMinutes: null,
|
||||
birthTimeUncertaintyKnown: true,
|
||||
});
|
||||
const editRange = (end: "start" | "end", clock: string) => emitTime(clockRangeEditPatch(value, end, clock));
|
||||
return (
|
||||
<>
|
||||
<p className="birth-time-range-question">{BIRTH_TIME_RANGE_QUESTION}</p>
|
||||
|
||||
@@ -14,7 +14,10 @@ import { Label } from "@/components/ui/label";
|
||||
import { applyBirthTimeDraftPatch, isBirthTimeDraftReady } from "@/lib/birth-time-intake-model";
|
||||
import {
|
||||
birthQuestion,
|
||||
onboardingBirthMissingHint,
|
||||
onboardingPlaceMissingHint,
|
||||
onboardingScreenFor,
|
||||
onboardingWhoMissingHint,
|
||||
placeQuestion,
|
||||
selectedBirthPlace,
|
||||
type OnboardingAudience,
|
||||
@@ -134,6 +137,7 @@ export function HomeOnboardingShell({
|
||||
/>
|
||||
<OnboardingScreenActions
|
||||
primary={<Button className="button-primary" type="submit" data-onboarding-press="" disabled={profileSaving || !isBirthTimeDraftReady(profileDraft)}>{profileSaving ? "保存中" : "继续"}</Button>}
|
||||
missingHint={onboardingBirthMissingHint(profileDraft)}
|
||||
onBack={onBack}
|
||||
backDisabled={profileSaving}
|
||||
/>
|
||||
@@ -148,6 +152,7 @@ export function HomeOnboardingShell({
|
||||
<BirthLocationFields value={profileDraft} onChange={setProfileDraft} />
|
||||
<OnboardingScreenActions
|
||||
primary={<BirthPlaceSubmitButton className="button-primary" data-onboarding-press="" onClick={(event) => rememberSkyOrigin(event.clientX, event.clientY)} disabled={profileSaving || !selectedBirthPlace(profileDraft)}>{profileSaving ? "保存中" : "排盘"}</BirthPlaceSubmitButton>}
|
||||
missingHint={onboardingPlaceMissingHint(profileDraft)}
|
||||
onBack={onBack}
|
||||
backDisabled={profileSaving}
|
||||
/>
|
||||
@@ -160,14 +165,20 @@ export function HomeOnboardingShell({
|
||||
);
|
||||
}
|
||||
|
||||
function OnboardingScreenActions({ primary, onBack, backDisabled = false }: {
|
||||
/**
|
||||
* BUG-2188: while the main button is disabled, the line under it says what is still missing, the same
|
||||
* 「还差:…」 line as the 星盘档案 form's footer.
|
||||
*/
|
||||
function OnboardingScreenActions({ primary, missingHint = null, onBack, backDisabled = false }: {
|
||||
readonly primary: ReactNode;
|
||||
readonly missingHint?: string | null;
|
||||
readonly onBack?: () => void;
|
||||
readonly backDisabled?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<div className="onboarding-screen-actions">
|
||||
{primary}
|
||||
{missingHint ? <small className="person-form-dialog-missing onboarding-missing" role="status">{missingHint}</small> : null}
|
||||
{onBack ? <Button type="button" variant="ghost" className="onboarding-back" disabled={backDisabled} onClick={onBack}>上一步</Button> : null}
|
||||
</div>
|
||||
);
|
||||
@@ -284,6 +295,7 @@ function OnboardingWhoScreen({
|
||||
) : null}
|
||||
<OnboardingScreenActions
|
||||
primary={<Button className="button-primary" type="submit" data-onboarding-press="" disabled={!ready}>{saving ? "保存中" : "继续"}</Button>}
|
||||
missingHint={onboardingWhoMissingHint({ name, target, otherName })}
|
||||
/>
|
||||
</form>
|
||||
);
|
||||
|
||||
@@ -14,7 +14,6 @@ import { fetchAccount } from "@/lib/home-cloud-sync";
|
||||
import { clearHomeWarmSnapshot } from "@/lib/home-warm-snapshot";
|
||||
import { saveOtherProfile } from "@/lib/other-profile-save";
|
||||
import { reportedTimeStored } from "@/lib/reported-birth-time";
|
||||
import { reportedBirthClockLabel } from "@/lib/birth-time-intake-model";
|
||||
import { invalidateEphemerisPage, pinChartSnapshotIdentity } from "@/lib/secondary-page-data";
|
||||
import { saveSelfGender, saveSelfProfile } from "@/lib/self-profile-save";
|
||||
import { notifyError, notifyInfo } from "@/lib/notify";
|
||||
@@ -23,6 +22,7 @@ import {
|
||||
missingOtherProfileStep,
|
||||
missingProfileHint,
|
||||
profileBirthTimeLabel,
|
||||
profileReportedTimeLabel,
|
||||
profilePlaceLabel,
|
||||
readProfile,
|
||||
} from "@/lib/home-profile";
|
||||
@@ -642,7 +642,7 @@ export function PeopleArchiveView({
|
||||
<div className="people-archive-times">
|
||||
<div className="people-archive-time">
|
||||
<small>填报时间</small>
|
||||
<b>{reportedBirthClockLabel(selected.profile.reportedTime, selected.profile.reportedSecond) || "还没填"}</b>
|
||||
<b>{profileReportedTimeLabel(selected.profile)}</b>
|
||||
</div>
|
||||
<div className={peopleTimeRectified(selected.profile) ? "people-archive-time is-rectified" : "people-archive-time"}>
|
||||
<small>{peopleTimeRectified(selected.profile) ? "排盘时间(已校正)" : "排盘时间"}</small>
|
||||
|
||||
@@ -322,6 +322,27 @@ export const birthTimeSourceDefaults = {
|
||||
},
|
||||
} as const satisfies Record<Exclude<BirthTimeSource, "" | "legacy_import">, BirthTimeDraftPatch>;
|
||||
|
||||
/**
|
||||
* The patch for picking one of the six rows. BUG-2187: 「出生证明、医院记录」 and 「户口本、其他证件」 are
|
||||
* records, so the pick already answers 「记录下来的」 (taken as written, no range; the same values the
|
||||
* first-run 「有记录」 writes). Before, the answer started empty and 保存 stayed disabled until
|
||||
* 「记录下来的」 was pressed as a second step. 「大概记得」 is still one press away.
|
||||
*/
|
||||
export function birthTimeSourcePickPatch(option: BirthTimeSourceOptionValue): BirthTimeDraftPatch {
|
||||
const source = option === "shichen" ? "period_only" : option;
|
||||
const isRecord = source === "hospital_record" || source === "id_document";
|
||||
return {
|
||||
birthTimeSource: source,
|
||||
birthTimeStatus: "reported",
|
||||
time: "",
|
||||
...birthTimeSourceDefaults[source],
|
||||
birthTimeClue: "",
|
||||
birthTimeRecordKind: isRecord ? "recorded" : "",
|
||||
birthTimeUncertaintyKnown: isRecord ? false : null,
|
||||
birthTimeShichen: option === "shichen" ? "" : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
const MINUTES_PER_DAY = 24 * 60;
|
||||
const MAX_SIDE_MINUTES = 720;
|
||||
|
||||
@@ -370,6 +391,36 @@ export function clockSourceRangeForDraft(draft: ClockRangeDraft): { readonly sta
|
||||
return { startTime: minutesToClock(time - before), endTime: minutesToClock(time + after) };
|
||||
}
|
||||
|
||||
/**
|
||||
* BUG-2186: the earliest / latest the range fields show while they are being filled. One end picked
|
||||
* alone is shown and kept; `clockSourceRangeForDraft` only answers once both ends exist.
|
||||
*/
|
||||
export function clockRangeFieldValues(draft: ClockRangeDraft): { readonly startTime: string; readonly endTime: string } {
|
||||
if (draft.declaredWindowStart || draft.declaredWindowEnd) {
|
||||
return { startTime: draft.declaredWindowStart, endTime: draft.declaredWindowEnd };
|
||||
}
|
||||
return clockSourceRangeForDraft(draft) ?? { startTime: "", endTime: "" };
|
||||
}
|
||||
|
||||
/**
|
||||
* BUG-2186: the patch for picking 最早 or 最晚. The other end keeps what was already picked. Before,
|
||||
* it was read from the finished range, which is empty until both ends exist, so picking 最晚 erased
|
||||
* 最早 (the select still showed it) and the form stayed incomplete.
|
||||
*/
|
||||
export function clockRangeEditPatch(draft: BirthTimeDraft, end: "start" | "end", clock: string): BirthTimeDraftPatch {
|
||||
const shown = clockRangeFieldValues(draft);
|
||||
return {
|
||||
// An old `family_exact` profile becomes a remembered time once its range is edited.
|
||||
...(draft.birthTimeSource === "family_exact" ? { birthTimeSource: "approximate" as const } : {}),
|
||||
declaredWindowStart: end === "start" ? clock : shown.startTime,
|
||||
declaredWindowEnd: end === "end" ? clock : shown.endTime,
|
||||
// Minutes before / after are worked out from the clocks when saved.
|
||||
uncertaintyBeforeMinutes: null,
|
||||
uncertaintyAfterMinutes: null,
|
||||
birthTimeUncertaintyKnown: true,
|
||||
};
|
||||
}
|
||||
|
||||
type ClockRangeProblem = "time" | "range" | "same_minute" | "outside" | null;
|
||||
|
||||
function validSideMinutes(value: number | null): value is number {
|
||||
@@ -587,6 +638,43 @@ export function birthTimeDraftReadyHint(draft: BirthTimeDraft) {
|
||||
return "请填写时和分";
|
||||
}
|
||||
|
||||
/**
|
||||
* BUG-2186: what the footer line 「还差:…」 names for the birth date and time. `missing` are the things
|
||||
* not filled in yet (joined after 「还差:」); `problem` is a filled-in range that cannot be saved
|
||||
* (shown as it is). Both empty exactly when `isBirthTimeDraftReady`.
|
||||
*/
|
||||
export function birthTimeDraftMissing(draft: BirthTimeDraft): { readonly missing: readonly string[]; readonly problem: string } {
|
||||
const missing: string[] = [];
|
||||
if (!parseBirthDate(draft.date)) missing.push("出生日期");
|
||||
const source = draft.birthTimeSource;
|
||||
if (!source) return { missing: [...missing, "出生时间来源"], problem: "" };
|
||||
if (isBirthTimeDraftReady(draft)) return { missing, problem: "" };
|
||||
if (source === "period_only") {
|
||||
if (draft.birthTimeShichen !== undefined) {
|
||||
if (!shichenWindowMatches(draft)) missing.push("时辰");
|
||||
} else if (!draft.declaredWindowStart || !draft.declaredWindowEnd) {
|
||||
missing.push("开始和结束时间");
|
||||
} else if (draft.declaredWindowStart === draft.declaredWindowEnd) {
|
||||
return { missing, problem: "开始和结束不能是同一分钟" };
|
||||
}
|
||||
} else if (source === "legacy_import") {
|
||||
if (!isBirthClockTime(draft.reportedTime || draft.time)) missing.push("出生时间");
|
||||
} else if (isClockBirthTimeSource(source)) {
|
||||
const problem = clockSourceProblem(draft);
|
||||
if (problem === "time") missing.push("出生时间");
|
||||
if (problem === "same_minute") return { missing, problem: "最早和最晚不能是同一分钟" };
|
||||
if (problem === "outside") return { missing, problem: "最早和最晚要包含填的时间,前后各不超过 12 小时" };
|
||||
if (problem === "range") {
|
||||
missing.push((source === "hospital_record" || source === "id_document") && !draft.birthTimeRecordKind
|
||||
? "这个时间是记录下来的还是大概记得"
|
||||
: "最早和最晚时间");
|
||||
}
|
||||
}
|
||||
// Ready except for something no line above names (an over-long clue, a stale stored field).
|
||||
if (missing.length === 0) return { missing: ["出生时间"], problem: "" };
|
||||
return { missing, problem: "" };
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the user has finished declaring what they actually know about birth time.
|
||||
* This is an onboarding condition, not a claim that an exact chart minute is ready.
|
||||
|
||||
@@ -4,8 +4,11 @@ import {
|
||||
describeBirthTimeDraft,
|
||||
hydrateClockSourceWindowDraft,
|
||||
hydrateDeclaredWindowDraft,
|
||||
birthTimeDraftMissing,
|
||||
birthTimePeriodOptions,
|
||||
declaredWindowRangeForDraft,
|
||||
isBirthTimeDraftReady,
|
||||
reportedBirthTimeLabel,
|
||||
isClockBirthTimeSource,
|
||||
readBirthTimeDeclarationDetail,
|
||||
isDeclaredBirthProfileComplete,
|
||||
@@ -170,10 +173,27 @@ export function profileBirthTimeLabel(profile: Profile) {
|
||||
if (clock) return clock;
|
||||
const period = birthTimePeriodOptions.find((option) => option.value === profile.birthTimePeriod);
|
||||
if (period) return period.label;
|
||||
// BUG-2187: a 时辰 or a hand-set start / end is what the person filled in, e.g. 「辰时(07:00—08:59)」.
|
||||
// 「待补全」 is only for a profile that says nothing about the time.
|
||||
if (profile.birthTimeSource === "period_only" && declaredWindowRangeForDraft(profile)) return reportedBirthTimeLabel(profile);
|
||||
if (profile.birthTimeSource === "unknown") return "时间不详";
|
||||
return "出生时间待补全";
|
||||
}
|
||||
|
||||
/**
|
||||
* BUG-2187: the 「填报时间」 card of 星盘档案. What the person stated: a clock, a 时辰 or a period with
|
||||
* its hours, or 「时间不详」; 「还没填」 only when nothing was given.
|
||||
*/
|
||||
export function profileReportedTimeLabel(profile: Profile) {
|
||||
const clock = reportedBirthClockLabel(profile.reportedTime, profile.reportedSecond);
|
||||
if (clock) return clock;
|
||||
if (profile.birthTimeSource === "period_only" || profile.birthTimeSource === "unknown") {
|
||||
const stated = profileBirthTimeLabel({ ...profile, time: "", birthTimeStatus: "reported" });
|
||||
return stated === "出生时间待补全" ? "还没填" : stated;
|
||||
}
|
||||
return "还没填";
|
||||
}
|
||||
|
||||
export function profileBirthTimeStatusLabel(profile: Profile) {
|
||||
if (profile.selfSelectedScenario) return "用户自选情景";
|
||||
if (profile.birthTimeStatus === "confirmed") return "时间已确认";
|
||||
@@ -241,12 +261,64 @@ export function missingProfileStep(
|
||||
return "who";
|
||||
}
|
||||
|
||||
const MISSING_STEP_HINT = { name: "还差:称呼", birth: "还差:出生日期与出生时间来源", place: "还差:出生地点" } as const;
|
||||
const MISSING_PREFIX = "还差:";
|
||||
const MISSING_SEPARATOR = "、";
|
||||
|
||||
/** 「还差:A、B」, or null when nothing is missing. */
|
||||
export function missingItemsLine(items: readonly string[]): string | null {
|
||||
return items.length ? `${MISSING_PREFIX}${items.join(MISSING_SEPARATOR)}` : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* BUG-2186: the birth date and time part of the line. It names what is really missing (date, time
|
||||
* source, the time, the range…), not one fixed 「出生日期与出生时间来源」 for every case. An empty form
|
||||
* still reads 「还差:出生日期与出生时间来源」. A filled-in range that cannot be saved is said as it is.
|
||||
*/
|
||||
export function missingBirthHint(profile: Profile): string | null {
|
||||
const { missing, problem } = birthTimeDraftMissing(profile);
|
||||
if (missing.length === 2 && missing[0] === "出生日期" && missing[1] === "出生时间来源") {
|
||||
return `${MISSING_PREFIX}出生日期与出生时间来源`;
|
||||
}
|
||||
return missingItemsLine(missing) ?? (problem || null);
|
||||
}
|
||||
|
||||
/**
|
||||
* BUG-2188: the same line on the first-run screens, beside a 「继续」 / 「排盘」 that is still disabled.
|
||||
* Screen 1 lists every missing answer (the reader's own 称呼 is needed even when 帮别人看), screen 2
|
||||
* the birth date and time, screen 3 the place. Screen 2 has no 「时间来源」 list, so that item is
|
||||
* named after its 「这个时间」 question.
|
||||
*/
|
||||
export function onboardingWhoMissingHint(input: {
|
||||
readonly name: string;
|
||||
readonly target: "self" | "other" | null;
|
||||
readonly otherName: string;
|
||||
}): string | null {
|
||||
const items: string[] = [];
|
||||
if (!input.name.trim()) items.push(input.target === "other" ? "你的称呼" : "称呼");
|
||||
if (input.target === null) items.push("先看谁的盘");
|
||||
if (input.target === "other" && !input.otherName.trim()) items.push("TA 的称呼");
|
||||
return missingItemsLine(items);
|
||||
}
|
||||
|
||||
export const ONBOARDING_MISSING_TIME_KNOWLEDGE = "这个时间有没有记录";
|
||||
|
||||
export function onboardingBirthMissingHint(profile: Profile): string | null {
|
||||
const { missing, problem } = birthTimeDraftMissing(profile);
|
||||
// The range problem is already said under the range fields (BUG-2144); the line only names what is missing.
|
||||
if (problem) return missingItemsLine(missing);
|
||||
return missingItemsLine(missing.map((item) => (item === "出生时间来源" ? ONBOARDING_MISSING_TIME_KNOWLEDGE : item)));
|
||||
}
|
||||
|
||||
export function onboardingPlaceMissingHint(profile: Profile): string | null {
|
||||
return selectedBirthPlace(profile) ? null : missingItemsLine(["出生地点"]);
|
||||
}
|
||||
|
||||
/** Footer hint of the profile dialog: the first thing still missing, or null. */
|
||||
export function missingProfileHint(profile: Profile): string | null {
|
||||
const step = missingOtherProfileStep(profile);
|
||||
return step ? MISSING_STEP_HINT[step] : null;
|
||||
if (step === "name") return missingItemsLine(["称呼"]);
|
||||
if (step === "birth") return missingBirthHint(profile);
|
||||
return step === "place" ? missingItemsLine(["出生地点"]) : null;
|
||||
}
|
||||
|
||||
export function missingOtherProfileStep(profile: Profile): "name" | "birth" | "place" | null {
|
||||
|
||||
@@ -53,23 +53,20 @@ export const STARTER_RECTIFY_FIRST = "出生时间先核对,再问具体的事
|
||||
*/
|
||||
export const STARTER_TIMING_LABEL = "今年推进重要计划,先看什么?";
|
||||
|
||||
/** BUG-2199: the first starter's label. On someone else's chart 「我」 becomes that person's name. */
|
||||
export const STARTER_SELF_LABEL = "我是一个什么样的人?";
|
||||
|
||||
export function starterQuestions(
|
||||
audience: StarterAudience,
|
||||
signs: StarterChartSigns,
|
||||
options: Readonly<{ birthTimeUncertain?: boolean }> = {},
|
||||
): readonly [string, string, string] {
|
||||
// Astrologer r4 (2026-11-17) H1 rule: the label uses only reliable fields. An
|
||||
// estimated birth time makes the ascendant unreliable, so it is left out.
|
||||
const ascendant = options.birthTimeUncertain ? null : displaySign(signs.ascendantSign);
|
||||
const moon = displaySign(signs.moonSign);
|
||||
const who = audience.kind === "self" ? "我" : audience.name;
|
||||
const first = ascendant && moon
|
||||
? `上升${ascendant}、月亮${moon},${who}是个什么样的人`
|
||||
: moon
|
||||
? `月亮在${moon},${who}是个什么样的人`
|
||||
: audience.kind === "self"
|
||||
? "从星盘认识自己"
|
||||
: `从星盘认识${audience.name}`;
|
||||
// BUG-2199 (owner 2026-11-22): the first starter is a plain question.
|
||||
// 原值「上升处女、月亮双鱼,我是个什么样的人」(没有星座时「从星盘认识自己」);
|
||||
// 新值「我是一个什么样的人?」; 原因: a newcomer does not know 上升 / 月亮, so the label carries no chart
|
||||
// terms. `signs` stays in the signature for the callers; the label no longer reads it.
|
||||
void signs;
|
||||
const first = audience.kind === "self" ? STARTER_SELF_LABEL : `${audience.name}${STARTER_SELF_LABEL.slice(1)}`;
|
||||
// Astrologer r4 (2026-11-17) H2 / H3 titles.
|
||||
const second = audience.kind === "self"
|
||||
? "未来两年事业有哪些变化"
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
parseChartSubjectWrite,
|
||||
resolveStoredReportedTimeUpdate,
|
||||
} from "../src/lib/chart-subject-write";
|
||||
import { profileBirthTimeLabel, readProfile } from "../src/lib/home-profile";
|
||||
import { profileBirthTimeLabel, profileReportedTimeLabel, readProfile } from "../src/lib/home-profile";
|
||||
import { emptyProfile } from "../src/lib/home-types";
|
||||
import { reportStatedBirthSecond } from "../src/lib/personal-report-route-core";
|
||||
import { selfProfilePatchBody } from "../src/lib/self-profile-save";
|
||||
@@ -334,7 +334,12 @@ test("BUG-2067 the stated time is shown with seconds only when it has some", ()
|
||||
// An adopted time is printed as it was.
|
||||
assert.equal(profileBirthTimeLabel({ ...profile, reportedSecond: 39, time: "09:20", birthTimeStatus: "accepted" }), "09:20");
|
||||
assert.match(read("src/lib/chart-view-mapper.ts"), /time: profile\.second \? `\$\{profile\.time\.slice\(0, 5\)\}:\$\{String\(profile\.second\)\.padStart\(2, "0"\)\}` : profile\.time\.slice\(0, 5\),/u);
|
||||
assert.match(read("src/components/people/people-page.tsx"), /reportedBirthClockLabel\(selected\.profile\.reportedTime, selected\.profile\.reportedSecond\)/u);
|
||||
// 原值:people-page.tsx 里直接写 reportedBirthClockLabel(selected.profile.reportedTime, selected.profile.reportedSecond)。
|
||||
// 新值:详情的「填报时间」用 profileReportedTimeLabel(selected.profile),钟点仍由 reportedBirthClockLabel 带秒。
|
||||
// 原因:BUG-2187,只填了时辰或时段的档案要显示填的内容,不再写「还没填」。
|
||||
assert.match(read("src/components/people/people-page.tsx"), /profileReportedTimeLabel\(selected\.profile\)/u);
|
||||
assert.equal(profileReportedTimeLabel({ ...profile, reportedSecond: 39 }), "09:17:39");
|
||||
assert.equal(profileReportedTimeLabel(profile), "09:17");
|
||||
});
|
||||
|
||||
test("BUG-2067 the themed report input carries the stated seconds, never an adopted time's", () => {
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
applyPersistedBirthTime,
|
||||
birthTimeDisplayState,
|
||||
birthTimeDraftReadyHint,
|
||||
birthTimeSourcePickPatch,
|
||||
birthTimePersistenceValues,
|
||||
birthTimeSourceDefaults,
|
||||
birthTimeSourceOptions,
|
||||
@@ -458,7 +459,13 @@ test("fresh intake preserves hospital, approximate, and unknown-time paths witho
|
||||
assert.doesNotMatch(source, /我可以选一段时间范围/);
|
||||
assert.doesNotMatch(source, /生时校正以后需要时再做/);
|
||||
assert.doesNotMatch(source, /补充描述|请选择最接近的时间范围|我可以描述一个时间范围/);
|
||||
assert.match(source, /birthTimeStatus: "reported"/);
|
||||
// 原值:表单源码里直接写 birthTimeStatus: "reported"(选来源时的补丁写在组件里)。
|
||||
// 新值:补丁移到 birthTimeSourcePickPatch(birth-time-intake-model.ts),选任一来源仍写 reported。
|
||||
// 原因:BUG-2187,选「出生证明、医院记录」「户口本、其他证件」时同一步带上「记录下来的」,补丁抽出来可测。
|
||||
assert.match(source, /emitTime\(birthTimeSourcePickPatch\(option\.value\)\)/);
|
||||
for (const option of birthTimeSourceOptions) {
|
||||
assert.equal(birthTimeSourcePickPatch(option.value).birthTimeStatus, "reported", option.value);
|
||||
}
|
||||
assert.match(source, /birthTimeConsultationOptionsCopy\(value\)/);
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
/**
|
||||
* BUG-2186 / BUG-2187 / BUG-2188: chart-entry form findings from the owner's staging test (2026-11-22).
|
||||
* Fictional birth data only.
|
||||
*/
|
||||
import "./install-test-document";
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import test from "node:test";
|
||||
import React from "react";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
|
||||
import { BirthTimeIntakeFields } from "../src/components/birth-time-intake";
|
||||
import { HomeOnboardingShell } from "../src/components/home-onboarding-shell";
|
||||
import {
|
||||
applyBirthTimeDraftPatch,
|
||||
birthTimeSourceOptions,
|
||||
birthTimeSourcePickPatch,
|
||||
clockRangeEditPatch,
|
||||
clockRangeFieldValues,
|
||||
isBirthTimeDraftReady,
|
||||
type BirthTimeDraftPatch,
|
||||
} from "../src/lib/birth-time-intake-model";
|
||||
import { SHICHEN_RANGES } from "../src/lib/declared-birth-window";
|
||||
import {
|
||||
missingBirthHint,
|
||||
missingProfileHint,
|
||||
onboardingBirthMissingHint,
|
||||
onboardingWhoMissingHint,
|
||||
profileBirthTimeLabel,
|
||||
profileReportedTimeLabel,
|
||||
} from "../src/lib/home-profile";
|
||||
import { emptyProfile, type OnboardingStep, type Profile } from "../src/lib/home-types";
|
||||
import { peopleRowMeta } from "../src/lib/people-archive-view";
|
||||
|
||||
Object.assign(globalThis, { React });
|
||||
|
||||
const read = (path: string) => readFileSync(new URL(`../src/${path}`, import.meta.url), "utf8");
|
||||
const PLACE = { countryCode: "CN", provinceCode: "33", cityCode: "3301", districtCode: "330106", birthPlaceLabel: "浙江省杭州市西湖区", latitude: 30.26, longitude: 120.13, timezoneOffset: 8, timezoneId: "Asia/Shanghai" } as const;
|
||||
const named: Profile = { ...emptyProfile, name: "示例丙", date: "1990-06-15" };
|
||||
|
||||
function apply(profile: Profile, ...patches: BirthTimeDraftPatch[]): Profile {
|
||||
return patches.reduce<Profile>((current, patch) => applyBirthTimeDraftPatch(current, patch), profile);
|
||||
}
|
||||
const pick = (profile: Profile, option: (typeof birthTimeSourceOptions)[number]["value"]) => apply(profile, birthTimeSourcePickPatch(option));
|
||||
const chen = SHICHEN_RANGES.chen;
|
||||
const shichenPatch = { birthTimeShichen: "chen", birthTimePeriod: "", declaredWindowStart: chen.startTime, declaredWindowEnd: chen.endTime } as const;
|
||||
|
||||
test("BUG-2186: 家人记得大概几点 + 08:30 + 最早 08:00 then 最晚 09:00 is complete; picking 最晚 keeps 最早", () => {
|
||||
const timed = apply(pick(named, "approximate"), { reportedTime: "08:30" });
|
||||
assert.equal(missingBirthHint(timed), "还差:最早和最晚时间");
|
||||
const earliest = apply(timed, clockRangeEditPatch(timed, "start", "08:00"));
|
||||
assert.deepEqual(clockRangeFieldValues(earliest), { startTime: "08:00", endTime: "" }, "one end alone is kept and shown");
|
||||
assert.equal(isBirthTimeDraftReady(earliest), false);
|
||||
const both = apply(earliest, clockRangeEditPatch(earliest, "end", "09:00"));
|
||||
assert.equal(both.declaredWindowStart, "08:00");
|
||||
assert.equal(both.declaredWindowEnd, "09:00");
|
||||
assert.equal(isBirthTimeDraftReady(both), true);
|
||||
assert.equal(missingProfileHint(both), "还差:出生地点");
|
||||
assert.equal(missingProfileHint({ ...both, ...PLACE }), null);
|
||||
// The other order, and changing one end afterwards.
|
||||
const latestFirst = apply(timed, clockRangeEditPatch(timed, "end", "09:00"));
|
||||
const reversed = apply(latestFirst, clockRangeEditPatch(latestFirst, "start", "08:00"));
|
||||
assert.equal(isBirthTimeDraftReady(reversed), true);
|
||||
const moved = apply(both, clockRangeEditPatch(both, "end", "09:30"));
|
||||
assert.deepEqual([moved.declaredWindowStart, moved.declaredWindowEnd], ["08:00", "09:30"]);
|
||||
// The form uses the same patch.
|
||||
assert.match(read("components/birth-time-intake.tsx"), /emitTime\(clockRangeEditPatch\(value, end, clock\)\)/);
|
||||
});
|
||||
|
||||
test("BUG-2186: on every answer path the 「还差」 line names what is missing and agrees with the save button", () => {
|
||||
const cases: readonly (readonly [string, Profile, string | null])[] = [
|
||||
["nothing", { ...emptyProfile, name: "示例丙" }, "还差:出生日期与出生时间来源"],
|
||||
["date only", named, "还差:出生时间来源"],
|
||||
["source only", pick({ ...named, date: "" }, "unknown"), "还差:出生日期"],
|
||||
["医院记录, no time", pick(named, "hospital_record"), "还差:出生时间"],
|
||||
["医院记录 + time", apply(pick(named, "hospital_record"), { reportedTime: "19:24" }), null],
|
||||
["证件 + time", apply(pick(named, "id_document"), { reportedTime: "19:24" }), null],
|
||||
["医院记录, 大概记得, no range", apply(pick(named, "hospital_record"), { reportedTime: "19:24", birthTimeRecordKind: "approximate", birthTimeUncertaintyKnown: null }), "还差:最早和最晚时间"],
|
||||
["医院记录, answer cleared (older draft)", apply(pick(named, "hospital_record"), { reportedTime: "19:24", birthTimeRecordKind: "", birthTimeUncertaintyKnown: null }), "还差:这个时间是记录下来的还是大概记得"],
|
||||
["大概几点, no time", pick(named, "approximate"), "还差:出生时间"],
|
||||
["大概几点, no range", apply(pick(named, "approximate"), { reportedTime: "08:30" }), "还差:最早和最晚时间"],
|
||||
["大概几点, 说不准", apply(pick(named, "approximate"), { reportedTime: "08:30", birthTimeUncertaintyKnown: false }), null],
|
||||
["大概几点, range", apply(pick(named, "approximate"), { reportedTime: "08:30", declaredWindowStart: "08:00", declaredWindowEnd: "09:00", birthTimeUncertaintyKnown: true }), null],
|
||||
["大概几点, range outside", apply(pick(named, "approximate"), { reportedTime: "08:30", declaredWindowStart: "09:00", declaredWindowEnd: "10:00", birthTimeUncertaintyKnown: true }), "最早和最晚要包含填的时间,前后各不超过 12 小时"],
|
||||
["时辰, none picked", pick(named, "shichen"), "还差:时辰"],
|
||||
["时辰, 辰时", apply(pick(named, "shichen"), shichenPatch), null],
|
||||
["时段, none", pick(named, "period_only"), "还差:开始和结束时间"],
|
||||
["时段, 上午", apply(pick(named, "period_only"), { birthTimePeriod: "morning", declaredWindowStart: "08:00", declaredWindowEnd: "11:59" }), null],
|
||||
["不知道", pick(named, "unknown"), null],
|
||||
["不知道, no date", pick({ ...named, date: "" }, "unknown"), "还差:出生日期"],
|
||||
];
|
||||
for (const [label, profile, hint] of cases) {
|
||||
assert.equal(missingBirthHint(profile), hint, label);
|
||||
assert.equal(isBirthTimeDraftReady(profile), hint === null, `${label}: line and button agree`);
|
||||
assert.equal(missingProfileHint(profile), hint ?? "还差:出生地点", label);
|
||||
}
|
||||
});
|
||||
|
||||
test("BUG-2187: a profile saved with only a 时辰 shows it in the list and the detail", () => {
|
||||
const shichen = apply(pick(named, "shichen"), shichenPatch);
|
||||
assert.equal(profileBirthTimeLabel(shichen), "辰时(07:00—08:59)");
|
||||
assert.equal(profileReportedTimeLabel(shichen), "辰时(07:00—08:59)");
|
||||
assert.match(peopleRowMeta({ ...shichen, ...PLACE }), /1990-06-15 辰时(07:00—08:59)/);
|
||||
const custom = apply(pick(named, "period_only"), { declaredWindowStart: "06:30", declaredWindowEnd: "09:10" });
|
||||
assert.equal(profileBirthTimeLabel(custom), "06:30—09:10");
|
||||
assert.equal(profileReportedTimeLabel(custom), "06:30—09:10");
|
||||
const period = apply(pick(named, "period_only"), { birthTimePeriod: "morning", declaredWindowStart: "08:00", declaredWindowEnd: "11:59" });
|
||||
assert.equal(profileReportedTimeLabel(period), profileBirthTimeLabel(period));
|
||||
assert.equal(profileReportedTimeLabel(pick(named, "unknown")), "时间不详");
|
||||
assert.equal(profileReportedTimeLabel(apply(pick(named, "hospital_record"), { reportedTime: "19:24" })), "19:24");
|
||||
// Nothing about the time was given: these two stay.
|
||||
assert.equal(profileBirthTimeLabel(named), "出生时间待补全");
|
||||
assert.equal(profileReportedTimeLabel(named), "还没填");
|
||||
assert.equal(profileReportedTimeLabel(pick(named, "shichen")), "还没填");
|
||||
assert.match(read("components/people/people-page.tsx"), /<small>填报时间<\/small>\s*<b>\{profileReportedTimeLabel\(selected\.profile\)\}<\/b>/);
|
||||
});
|
||||
|
||||
test("BUG-2187: picking 「出生证明、医院记录」 or 「户口本、其他证件」 already answers 「记录下来的」", () => {
|
||||
for (const option of ["hospital_record", "id_document"] as const) {
|
||||
const picked = pick(named, option);
|
||||
assert.equal(picked.birthTimeRecordKind, "recorded", option);
|
||||
assert.equal(picked.birthTimeUncertaintyKnown, false, option);
|
||||
assert.equal(isBirthTimeDraftReady(apply(picked, { reportedTime: "19:24" })), true, `${option}: a time is all that is left`);
|
||||
const markup = renderToStaticMarkup(<BirthTimeIntakeFields value={apply(picked, { reportedTime: "19:24" })} onPatch={() => undefined} showDate={false} />);
|
||||
assert.match(markup, /class="[^"]*birth-time-uncertainty-option is-selected[^"]*"[^>]*>记录下来的/, option);
|
||||
}
|
||||
for (const option of ["approximate", "shichen", "period_only", "unknown"] as const) {
|
||||
assert.equal(pick(named, option).birthTimeRecordKind, "", option);
|
||||
}
|
||||
// One form for 星盘档案, the chart editor and synastry 新增星盘: the pick goes through this patch.
|
||||
assert.match(read("components/birth-time-intake.tsx"), /emitTime\(birthTimeSourcePickPatch\(option\.value\)\)/);
|
||||
});
|
||||
|
||||
const noop = () => undefined;
|
||||
function onboarding(step: OnboardingStep, extra: Partial<React.ComponentProps<typeof HomeOnboardingShell>> = {}) {
|
||||
return renderToStaticMarkup(
|
||||
<HomeOnboardingShell
|
||||
profileComplete={false}
|
||||
setProfileDraft={noop}
|
||||
birthTimeAssessmentPhase={null}
|
||||
profileSaving={false}
|
||||
saveOnboardingWho={noop}
|
||||
saveOnboardingBirth={noop}
|
||||
saveOnboardingPlace={noop}
|
||||
onBack={noop}
|
||||
profileDraft={emptyProfile}
|
||||
onboardingStep={step}
|
||||
{...extra}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
const missingLine = (markup: string) => /<small class="person-form-dialog-missing onboarding-missing"[^>]*>([^<]*)<\/small>/.exec(markup)?.[1] ?? null;
|
||||
|
||||
test("BUG-2188: every first-run screen says what is missing under its disabled button", () => {
|
||||
// 帮别人看 with only the other person's name: the reader's own 称呼 is what is missing.
|
||||
assert.equal(missingLine(onboarding("who", { intakeTarget: "other", profileDraft: { ...emptyProfile, name: "小舟" } })), "还差:你的称呼");
|
||||
assert.equal(missingLine(onboarding("who")), "还差:称呼、先看谁的盘");
|
||||
assert.equal(missingLine(onboarding("who", { readerName: "小贝", intakeTarget: "other" })), "还差:TA 的称呼");
|
||||
assert.equal(missingLine(onboarding("who", { readerName: "小贝", intakeTarget: "self" })), null);
|
||||
assert.equal(onboardingWhoMissingHint({ name: "小贝", target: "other", otherName: "小舟" }), null);
|
||||
|
||||
assert.equal(missingLine(onboarding("birth")), "还差:出生日期、这个时间有没有记录");
|
||||
assert.equal(missingLine(onboarding("birth", { profileDraft: { ...named, reportedTime: "08:30" } })), "还差:这个时间有没有记录");
|
||||
const ready = apply(pick(named, "hospital_record"), { reportedTime: "08:30" });
|
||||
assert.equal(missingLine(onboarding("birth", { profileDraft: ready })), null);
|
||||
// A range that cannot be saved is already said under the range fields; the line does not repeat it.
|
||||
const outside = apply(pick(named, "approximate"), { reportedTime: "08:30", declaredWindowStart: "09:00", declaredWindowEnd: "10:00", birthTimeUncertaintyKnown: true });
|
||||
assert.equal(onboardingBirthMissingHint(outside), null);
|
||||
|
||||
assert.equal(missingLine(onboarding("place", { profileDraft: ready })), "还差:出生地点");
|
||||
assert.equal(missingLine(onboarding("place", { profileDraft: { ...ready, ...PLACE } })), null);
|
||||
});
|
||||
@@ -75,33 +75,37 @@ test("starter questions use the chart signs already on hand, for both people", (
|
||||
// 新值: 「今年推进重要计划,先看什么?」 / 「小舟今年推进重要计划,先看什么?」;原因: BUG-2160 占星师 2026-11-22 第 9 项定稿
|
||||
// 原值: 「从我的盘看,我是个什么样的人」「接下来这两年,事业上该注意什么」「我想问某件事在哪段时间更顺」
|
||||
// 新值: 占星师 r4 的 H1 无星座兜底、H2、H3 标题 / 原因: 占星师 2026-11-17 r4 首页三问;按钮仍用短标题,发出去的是她的完整问题(starterPrompts)
|
||||
// BUG-2199(负责人 2026-11-22)
|
||||
// 原值: 「上升白羊、月亮金牛,我是个什么样的人」「月亮在金牛,我是个什么样的人」「从星盘认识自己」(看别人时换成对方名字)
|
||||
// 新值: 「我是一个什么样的人?」;看别人时「小舟是一个什么样的人?」;有没有星座都一样
|
||||
// 原因: 新手不认识上升、月亮,第一问改成白话,按钮上不带星盘术语
|
||||
assert.deepEqual(starterQuestions(self, both), [
|
||||
"上升白羊、月亮金牛,我是个什么样的人",
|
||||
"我是一个什么样的人?",
|
||||
"未来两年事业有哪些变化",
|
||||
"今年推进重要计划,先看什么?",
|
||||
]);
|
||||
assert.deepEqual(starterQuestions(self, moonOnly), [
|
||||
"月亮在金牛,我是个什么样的人",
|
||||
"我是一个什么样的人?",
|
||||
"未来两年事业有哪些变化",
|
||||
"今年推进重要计划,先看什么?",
|
||||
]);
|
||||
assert.deepEqual(starterQuestions(self, none), [
|
||||
"从星盘认识自己",
|
||||
"我是一个什么样的人?",
|
||||
"未来两年事业有哪些变化",
|
||||
"今年推进重要计划,先看什么?",
|
||||
]);
|
||||
assert.deepEqual(starterQuestions(other, both), [
|
||||
"上升白羊、月亮金牛,小舟是个什么样的人",
|
||||
"小舟是一个什么样的人?",
|
||||
"小舟未来两年事业有哪些变化",
|
||||
"小舟今年推进重要计划,先看什么?",
|
||||
]);
|
||||
assert.deepEqual(starterQuestions(other, moonOnly), [
|
||||
"月亮在金牛,小舟是个什么样的人",
|
||||
"小舟是一个什么样的人?",
|
||||
"小舟未来两年事业有哪些变化",
|
||||
"小舟今年推进重要计划,先看什么?",
|
||||
]);
|
||||
assert.deepEqual(starterQuestions(other, none), [
|
||||
"从星盘认识小舟",
|
||||
"小舟是一个什么样的人?",
|
||||
"小舟未来两年事业有哪些变化",
|
||||
"小舟今年推进重要计划,先看什么?",
|
||||
]);
|
||||
@@ -159,7 +163,10 @@ test("the who-choice hint does nothing when this process has no localStorage", (
|
||||
test("r4: estimated birth time leaves the ascendant out of the label; buttons send her full questions", async () => {
|
||||
const { starterPrompts, STARTER_PROMPTS } = await import("../src/lib/starter-questions.ts");
|
||||
const both: StarterChartSigns = { ascendantSign: "Aries", moonSign: "Taurus" };
|
||||
assert.equal(starterQuestions({ kind: "self" }, both, { birthTimeUncertain: true })[0], "月亮在金牛,我是个什么样的人");
|
||||
// 原值: 估算的出生时间下第一问是「月亮在金牛,我是个什么样的人」(去掉上升)
|
||||
// 新值: 「我是一个什么样的人?」
|
||||
// 原因: BUG-2199,第一问不再带上升、月亮
|
||||
assert.equal(starterQuestions({ kind: "self" }, both, { birthTimeUncertain: true })[0], "我是一个什么样的人?");
|
||||
assert.equal(starterPrompts({ kind: "self" }), STARTER_PROMPTS);
|
||||
const other = starterPrompts({ kind: "other", name: "小舟", relationLabel: "朋友" });
|
||||
assert.match(other[0], /^从小舟的星盘看,小舟有哪些/);
|
||||
|
||||
@@ -65,7 +65,10 @@ test("signs come from the computed chart; the ascendant only when it is fixed",
|
||||
assert.equal(starterSignsFromChartView({ status: "chart_unavailable", billed: false, message: "x" } as never, "self"), null);
|
||||
|
||||
const moonOnly = starterQuestions({ kind: "self" }, { ascendantSign: null, moonSign: moon })[0];
|
||||
assert.match(moonOnly, /^月亮在.+,我是个什么样的人$/);
|
||||
// 原值: /^月亮在.+,我是个什么样的人$/
|
||||
// 新值: 「我是一个什么样的人?」
|
||||
// 原因: BUG-2199,第一问改成白话,不再带上升、月亮
|
||||
assert.equal(moonOnly, "我是一个什么样的人?");
|
||||
assert.match(otherSkySubjectLine("小舟", ascendant), /^那一刻,小舟的上升在.+$/);
|
||||
});
|
||||
|
||||
|
||||
@@ -49,7 +49,10 @@ test("BUG-2062 while the save button is disabled the dialog says what is still m
|
||||
// 原因:BUG-2144,用星盘档案的表单后提示跟着它;负责人规则:没有出生时间不能合盘。
|
||||
assert.equal(synastryAddMissingHint(empty), "还差:称呼");
|
||||
assert.equal(synastryAddMissingHint({ ...empty, name: "测试" }), "还差:出生日期与出生时间来源");
|
||||
assert.equal(synastryAddMissingHint({ ...empty, name: "测试", date: "1993-08-21" }), "还差:出生日期与出生时间来源");
|
||||
// 原值:填了日期、没选时间来源,仍是「还差:出生日期与出生时间来源」。
|
||||
// 新值:「还差:出生时间来源」。
|
||||
// 原因:BUG-2186,这一行只说真正还缺的;日期已填就不再说缺日期。
|
||||
assert.equal(synastryAddMissingHint({ ...empty, name: "测试", date: "1993-08-21" }), "还差:出生时间来源");
|
||||
const timed = { ...empty, name: "测试", date: "1993-08-21", ...recorded, reportedTime: "14:30" };
|
||||
assert.equal(synastryAddMissingHint(timed), "还差:出生地点");
|
||||
// The hint is the form's own footer line.
|
||||
|
||||
Reference in New Issue
Block a user