diff --git a/.gitignore b/.gitignore index 7b9ad50..60cd4da 100644 --- a/.gitignore +++ b/.gitignore @@ -88,3 +88,5 @@ ehthumbs.db *.key secrets/ +# Setup/deployment configs (contains server-specific settings) +setup/ diff --git a/back_end/src/controllers/public.ts b/back_end/src/controllers/public.ts index aabcb6f..e50f213 100644 --- a/back_end/src/controllers/public.ts +++ b/back_end/src/controllers/public.ts @@ -65,17 +65,29 @@ export async function getNextJackpot(req: Request, res: Response) { const lottery = lotteryResult.rows[0]; - // Get next cycle - const cycleResult = await db.query( + // Get next cycle - first try to find one that hasn't drawn yet + let cycleResult = await db.query( `SELECT * FROM jackpot_cycles WHERE lottery_id = $1 - AND status IN ('scheduled', 'sales_open') - AND scheduled_at > NOW() + AND status IN ('scheduled', 'sales_open', 'drawing') ORDER BY scheduled_at ASC LIMIT 1`, [lottery.id] ); + // If no active cycles, get the next upcoming one + if (cycleResult.rows.length === 0) { + cycleResult = await db.query( + `SELECT * FROM jackpot_cycles + WHERE lottery_id = $1 + AND status = 'scheduled' + AND scheduled_at > NOW() + ORDER BY scheduled_at ASC + LIMIT 1`, + [lottery.id] + ); + } + if (cycleResult.rows.length === 0) { return res.status(503).json({ version: '1.0', diff --git a/front_end/src/app/buy/page.tsx b/front_end/src/app/buy/page.tsx index 2465096..bb3cfa0 100644 --- a/front_end/src/app/buy/page.tsx +++ b/front_end/src/app/buy/page.tsx @@ -222,15 +222,15 @@ export default function BuyPage() { const totalCost = ticketPriceSats * tickets; return ( -
-

+
+

{STRINGS.buy.title}

{!invoice ? ( /* Purchase Form */ -
-
+
+ {/* Lightning Address */}