Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion client/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,15 @@ export default defineConfig({
origins: [
{
origin: 'http://localhost:5173',
localStorage: [{ name: 'cht-ui-builder.hiddenTabs', value: '[]' }],
localStorage: [
{ name: 'cht-ui-builder.hiddenTabs', value: '[]' },
// T9d (#17) — the add-question picker now has a configure step
// after a question tile. The build specs were written against
// one-click tiles, so the suite runs as an author who ticked
// "always skip this step". `add-question-configure.spec.ts`
// clears the key to drive the step itself.
{ name: 'cht-ui-builder.oneClickTiles', value: 'true' },
],
},
],
},
Expand Down
10 changes: 10 additions & 0 deletions client/src/ui/CalculationBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
type ReportFieldChoice,
type ParsedCalculation,
type ParsedExpression,
serializeRule,
} from '@cht-ui/shared';
import { useApp } from '../state/store.js';
import { RelevantRuleBuilder } from './RelevantRuleBuilder.js';
Expand Down Expand Up @@ -1342,6 +1343,15 @@ function conditionProse(cond: ParsedExpression): string {
if (r.kind === 'answered') {
return `\${${r.field}} ${r.negated ? 'is empty' : 'is answered'}`;
}
if (r.kind === 'truthy') {
return `\${${r.field}} ${r.negated ? 'is not selected' : 'has an answer'}`;
}
if (r.kind === 'expr-comparison' || r.kind === 'predicate' || r.kind === 'not-group') {
return serializeRule(r); // T9a — shown as written until 9e gives presets
}
if (r.kind === 'always-true') {
return 'always passes';
}
if (r.kind === 'age') {
return `age of \${${r.field}} ${r.op} ${r.value} years`;
}
Expand Down
11 changes: 11 additions & 0 deletions client/src/ui/DecisionsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
type AppliesIfRule,
type ContextRule,
type ParsedCalculation,
serializeRule,
} from '@cht-ui/shared';
import { api } from '../api.js';
import { useApp } from '../state/store.js';
Expand Down Expand Up @@ -487,6 +488,16 @@ function relevantToHumanLines(cond: import('@cht-ui/shared').ParsedExpression):
return `${r.negated ? 'NOT ' : ''}${r.field} includes "${r.value}"`;
case 'answered':
return r.negated ? `${r.field} is empty` : `${r.field} is answered`;
case 'truthy':
return r.negated ? `${r.field} is not selected` : `${r.field} has an answer`;
case 'expr-comparison':
case 'predicate':
case 'not-group':
// T9a — rules about the answer itself; shown as written until 9e
// gives them presets.
return serializeRule(r);
case 'always-true':
return 'always passes (no rule)';
case 'age':
return `age of ${r.field} ${r.op} ${r.value} years`;
case 'date_offset':
Expand Down
Loading
Loading