Repair the 2026-07-30 review findings #1
@@ -1790,16 +1790,16 @@ export class DbService {
|
||||
*/
|
||||
async decayBeliefs(): Promise<number> {
|
||||
const res = await this.pgClient.query(`
|
||||
WITH halflives AS (
|
||||
SELECT profile,
|
||||
CASE profile
|
||||
WHEN 'longterm' THEN 365 * 86400
|
||||
WHEN 'obsession' THEN 14 * 86400
|
||||
WHEN 'discovery' THEN 30 * 86400
|
||||
WHEN 'negative' THEN 180 * 86400
|
||||
WHEN 'contextual' THEN 7 * 86400
|
||||
ELSE 30 * 86400
|
||||
END AS halflife_sec
|
||||
-- NOTE: this MUST be a VALUES list, not "SELECT profile, CASE profile ...",
|
||||
-- which has no FROM clause and is rejected by Postgres with 42703
|
||||
-- (column "profile" does not exist) on every single run.
|
||||
WITH halflives(profile, halflife_sec) AS (
|
||||
VALUES
|
||||
('longterm', 365 * 86400),
|
||||
('obsession', 14 * 86400),
|
||||
('discovery', 30 * 86400),
|
||||
('negative', 180 * 86400),
|
||||
('contextual', 7 * 86400)
|
||||
)
|
||||
UPDATE listener_beliefs lb
|
||||
SET value = GREATEST(-1.0, LEAST(1.0, lb.value * POWER(0.5,
|
||||
|
||||
Reference in New Issue
Block a user