f56fc551fe
weekend.js: date gate by the purchase's chain time (WEEKEND_PICKS=0 switches it off, WEEKEND_NOW test clock); /api/config, quote, order and the attach hook use it. Tank check 11-17: draft pool 1,339, 2 positions sold. netdeals.js + /assets/netweekend.js ribbon (/api/network-deals from the hub), loaded by common.js (not draftday/admin), common.js?v=4. chatbot FACTS weekend line and a chatcore finish hook so stored instant answers say 8 while live. qa/weekend.test.cjs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 lines
1.5 KiB
JavaScript
16 lines
1.5 KiB
JavaScript
// Network Weekend (Marty 2026-11-17, Black Friday to Cyber Monday 2026): 8 instant picks per position instead of 5 for positions
|
|
// bought from Fri 11-27 00:00 CT to Tue 12-01 00:00 CT (CST = UTC-6), no price change. It switches on and off by itself at those
|
|
// instants; the purchase's own chain time (blockAt) decides, so a Monday 23:59 buy confirmed after midnight still gets 8.
|
|
// Holding-tank check 2026-11-17: draft pool 1,339 people, 2 positions sold since launch 11-15, so 8 per sale is covered.
|
|
// WEEKEND_PICKS the weekend number (default 8, 1 to 20); WEEKEND_PICKS=0 switches the weekend deal off (normal picks all weekend)
|
|
// WEEKEND_NOW test clock (ISO), tests only: never set it on the server
|
|
'use strict';
|
|
const START = Date.parse('2026-11-27T06:00:00Z');
|
|
const END = Date.parse('2026-12-01T06:00:00Z');
|
|
function nowMs() { const o = process.env.WEEKEND_NOW; const t = o ? Date.parse(o) : NaN; return Number.isNaN(t) ? Date.now() : t; }
|
|
function weekendPicks() { const v = Number(process.env.WEEKEND_PICKS === undefined || process.env.WEEKEND_PICKS === '' ? 8 : process.env.WEEKEND_PICKS); return Number.isInteger(v) && v >= 1 && v <= 20 ? v : 0; }
|
|
function live(ms) { ms = ms === undefined ? nowMs() : ms; return weekendPicks() > 0 && ms >= START && ms < END; }
|
|
// instant picks per position for a purchase made at `ms` (default: now)
|
|
function picks(C, ms) { return live(ms) ? weekendPicks() : C.position.picksOnBuy; }
|
|
module.exports = { START, END, nowMs, live, picks, weekendPicks };
|