Enhance AI Insight with new state management and PDF export functionality. Added selectedArea state to App for better context in reports. Introduced new markdown files for documentation on AI Insight improvements and setup instructions. Updated package dependencies and fixed TypeScript errors for improved stability.
CI / lint-and-test (push) Canceled after 0s
CI / lint-and-test (push) Canceled after 0s
This commit is contained in:
1 parent
a8b49374f1
commit
2a627a2c3f
84 files changed
+8415
-2692
No files matched your search
@@ -0,0 +1,21 @@
|
||||
-- Scope cached dashboard insights by the report period they describe.
|
||||
--
|
||||
-- The cache was keyed on (cycle_id, kandang_id) alone, while the dropdown can
|
||||
-- ask for Harian, Minggu 1..7, or Akhir Siklus. The first generated period was
|
||||
-- stored and then served back for every other one for the full 6-hour TTL, so
|
||||
-- switching the period appeared to change nothing.
|
||||
ALTER TABLE ai_insights
|
||||
ADD COLUMN IF NOT EXISTS report_type VARCHAR(20) NOT NULL DEFAULT 'daily',
|
||||
ADD COLUMN IF NOT EXISTS report_period VARCHAR(50);
|
||||
|
||||
DROP INDEX IF EXISTS idx_ai_insights_cycle_kandang;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_ai_insights_scope
|
||||
ON ai_insights (cycle_id, kandang_id, report_type, report_period);
|
||||
|
||||
-- Existing rows predate the column and cannot be attributed to a period, so
|
||||
-- expire them rather than let them answer for a period they may not describe.
|
||||
UPDATE ai_insights SET expires_at = NOW() WHERE report_type = 'daily';
|
||||
|
||||
COMMENT ON COLUMN ai_insights.report_type IS 'daily | weekly | end_cycle — the period this insight describes';
|
||||
COMMENT ON COLUMN ai_insights.report_period IS 'Week label for weekly reports, e.g. "Minggu 3"; NULL otherwise';
|
||||
Reference in new issue
Block a user