Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7167367276
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ] as const).forEach((key) => { | ||
| if (merged[key] === null || merged[key] === undefined || merged[key] === 0) { | ||
| const incomingValue = incoming[key]; | ||
| if (incomingValue !== null && incomingValue !== undefined) { |
There was a problem hiding this comment.
Don’t treat 0 as missing when merging metrics
The new merge logic treats 0 as a missing value (merged[key] === 0), so a legitimate metric like change_pct: 0 or volume_ratio: 0 from one strategy will be overwritten by another strategy’s non‑zero value. This corrupts merged results for stocks whose true value is zero (e.g., unchanged price). Consider only treating null/undefined as missing and avoid special‑casing 0.
Useful? React with 👍 / 👎.
Motivation
strategy4/strategy5alongside existing strategies.swing_pct/ 前3日振幅 field).allrun and preserve merged per-stock metrics so AI scoring and the leaderboard remain meaningful.Description
normalizeStrategyInputandtoResultKeyto recognizes4/s5andstrategy4/strategy5.pickValue,toNumber,buildMatch,mergeMatch) inapp/api/stock-analysis/route.tsand wired them intoconvertCloudFunctionResultso cloud responses produce consistent match objects (includingswing_pct).strategyto the cloud function and support converting results for a specific strategy or merged across all five strategies.app/stock/page.tsxto tracklastRunStrategy, add a one-click一键执行全部策略action, exposes4/s5in the selector, uselastRunStrategyfor AI scoring, and renderswing_pctand other metrics with null-safe fallbacks.Testing
npm run dev ...) and compiled the/stockpage successfully (GET /stock returned 200). — succeeded.http://127.0.0.1:3000/stockand captured a screenshot of the updated page. — succeeded.formatValuefallbacks. — performed successfully.Codex Task