From b061053ccfca54b251e99359c8415f74bac4a431 Mon Sep 17 00:00:00 2001 From: martbost Date: Sat, 19 Sep 2026 05:19:44 -0500 Subject: [PATCH] Daily rules run on Central time, and the sign-in bonus gets a hard floor today() was a UTC day, which rolls over at 7 PM Central. Sign in at 6:55 PM and again at 7:05 PM and those were two different days, so the once-per-day sign-in bonus paid twice, ten minutes apart. On the live ledger 83 of the first 364 sign-in bonuses landed less than 24 hours after the previous one, one pair 24 minutes apart, worth 618 credits. The same boundary governs the daily-credit claim, the claim streak, each campaign's daily spend cap and the login-ad daily meter, all of which could turn over twice in one Central evening. ctDay() puts every member-facing daily rule on America/Chicago, which tracks CST/CDT on its own. Reporting slices elsewhere are left alone rather than re-bucketing chart history. The bonus also records login_ts now and refuses to pay again inside 20 hours, whatever the day string says. 20 rather than 24 so signing in at the same time each morning never skips. Safe to deploy between midnight and 7 PM Central, when the two day strings agree. Co-Authored-By: Claude Opus 5 (1M context) --- ads.js | Bin 108737 -> 109508 bytes db.js | 1 + 2 files changed, 1 insertion(+) diff --git a/ads.js b/ads.js index a132a92c63d0f307063a4720ed4c05d56e1263cb..eab988f109873f15ff15116ac020c4f1abb739b3 100644 GIT binary patch delta 1155 zcmZWpJ!~9B6xJ%ju}mT;g5!dq&ywZ4gS+$LL?p7gMCLAC93lCP1POw<-FLSm-_4w7 z=DaaUFqEWZg|$^WOK~``-8V@lP|~ z{XFyaU(JJ+6>JLQ_DdF#*snrqhwVMRy#A+IR;}7BZ}(=m5gPCE6#q|N3ebQf)-0 z##SysjV(q(MmeraWJqhcauK?h1NWq{4i{g!goF%XK$a0>u4eU83^C&7s?dr&f?*qm zQjHyPGJkbY&p|haWMn8-S}{NS8r)R4W6|2`thCx44u^CWI#GG2E|wP7`HGF~$Bxq( zJ?_W2$>a>XWEeEmimM7;n>%R2p?Q@VNYECJ%KX)Af@!5*M=Iv@T5hi^os=tBgR7jK z1L{uS(4iQRkJ)mDc`KJl)mj^+D(=F`A-%PzV#%@=0!)aB!su0EMB&aZ9H zpPrrAE9>b8?=K!dy#3+1;gpbee%syxh1>y zC^(-k{ElqzQSkh16$4>i$ELf-l@x<#KE8W8`;k57_(J!kddJ!H@h6S+`!Al&mJWlB z<%v5JbaU)^E1O%5x9f!~?%hM9vX1*%=_pvr9vlX5F8(io!ij&!PTaHK4uegv>Mjj< zFg!}uo@ddE*sF}S*X8MwT|*Kxv$>qn8@n-!$CLV=7mGG%Z*@RXpAczQ%LK{Kg|WRX zZ9b7|F5X=d%<6eAuOCW3V@m6Z{ratT%p35nR@Df;j_RvR&l;44$8bqda_y5>(cPAmm7^n z_UFUk!pXvCfe2=+Q|{BQ!!pXNs!QZF;0hG6j-~a#s delta 240 zcmX?do$cU7whixXCm*wyn66XGs62VTC+p@H_V2~OJVt}fcf-WkVKVHKkJig>mWgW= z0gG@OXzC~=>t&|IYFbZz7nZqMtT>z-u6A=}onQ=%$GUmStj)IlVB0QEdCM<&6KB0Vx|=b^rhX diff --git a/db.js b/db.js index c440a24..c0c3c8f 100644 --- a/db.js +++ b/db.js @@ -75,6 +75,7 @@ async function bootstrap() { await alterSafe0('ALTER TABLE earned_credits ADD COLUMN purchase_grade INT NOT NULL DEFAULT 0'); // part of the pool that is refunded/credited PURCHASED money: shows as purchased, funds login ads await alterSafe0('ALTER TABLE earned_credits ADD COLUMN login_day CHAR(10) NULL'); // last daily-login-bonus day await alterSafe0('ALTER TABLE earned_credits ADD COLUMN login_streak INT NOT NULL DEFAULT 0'); // consecutive-day streak + await alterSafe0('ALTER TABLE earned_credits ADD COLUMN login_ts BIGINT NOT NULL DEFAULT 0'); // when the last sign-in bonus was paid: enforces a 20h floor, whatever the day string says // additive columns (MySQL 8 has no IF NOT EXISTS for columns) const alterSafe = async sql => { try { await q(sql); }