From aaad305dfd3851adeeca289e40be60e0275a70ff Mon Sep 17 00:00:00 2001 From: Tom <20648924+moT01@users.noreply.github.com> Date: Fri, 28 Aug 2026 08:03:17 -0500 Subject: [PATCH] chore(api/client): remove temp daily challenge transition code (#69775) --- .../routes/daily-coding-challenge.test.ts | 26 --------- .../routes/daily-coding-challenge.ts | 12 ---- .../daily-coding-challenge/calendar.test.tsx | 19 ------ .../daily-coding-challenge/calendar.tsx | 58 ++----------------- .../daily-coding-challenge/helpers.ts | 6 -- 5 files changed, 6 insertions(+), 115 deletions(-) diff --git a/api/src/daily-coding-challenge/routes/daily-coding-challenge.test.ts b/api/src/daily-coding-challenge/routes/daily-coding-challenge.test.ts index 1c30bd010a9..bbd5fdbb757 100644 --- a/api/src/daily-coding-challenge/routes/daily-coding-challenge.test.ts +++ b/api/src/daily-coding-challenge/routes/daily-coding-challenge.test.ts @@ -277,32 +277,6 @@ describe('/daily-coding-challenge', () => { fastifyTestInstance.Sentry = originalSentry; }); - it("should not return a day's challenge if it hasn't been released even once yet (temporary, until the original run finishes on 2026-08-10)", async () => { - const res = await superRequest('/daily-coding-challenge/day/10-03', { - method: 'GET' - }).send({}); - - expect(res.status).toBe(404); - expect(res.body).toEqual({ - type: 'error', - message: 'Challenge not found.' - }); - }); - - it('should return a day once real time has passed the entire original run, even for days that were never released relative to the mocked "today" above', async () => { - vi.setSystemTime(addDays(todayUsCentral, 365)); - - const res = await superRequest('/daily-coding-challenge/day/10-03', { - method: 'GET' - }).send({}); - - expect(res.status).toBe(200); - expect(res.body).toMatchObject({ - ...tomorrowsChallenge, - date: tomorrowsChallenge.date.toISOString() - }); - }); - it('should map a Feb 29 day request to the Feb 28 challenge', async () => { await fastifyTestInstance.prisma.dailyCodingChallenges.deleteMany(); diff --git a/api/src/daily-coding-challenge/routes/daily-coding-challenge.ts b/api/src/daily-coding-challenge/routes/daily-coding-challenge.ts index f46703f0b58..5222a06b099 100644 --- a/api/src/daily-coding-challenge/routes/daily-coding-challenge.ts +++ b/api/src/daily-coding-challenge/routes/daily-coding-challenge.ts @@ -111,18 +111,6 @@ export const dailyCodingChallengeRoutes: FastifyPluginCallbackTypebox = ( const sourceDate = getSourceDate(monthDay); - // TEMPORARY: blocks days for not yet released challenges - // Safe to delete after 2026-08-10 (all challenges released) - if (sourceDate > getUtcMidnight(getNowUsCentral())) { - req.log.warn({ day }, 'Challenge not found for day'); - fastify.Sentry?.metrics?.count('dcc.challenge_not_found', 1, { - attributes: { route: '/daily-coding-challenge/day/:day' } - }); - return reply - .status(404) - .send({ type: 'error', message: 'Challenge not found.' }); - } - const challenge = await fastify.prisma.dailyCodingChallenges.findFirst({ where: { date: sourceDate diff --git a/client/src/components/daily-coding-challenge/calendar.test.tsx b/client/src/components/daily-coding-challenge/calendar.test.tsx index 102ac23bb6d..cac4e1a1e91 100644 --- a/client/src/components/daily-coding-challenge/calendar.test.tsx +++ b/client/src/components/daily-coding-challenge/calendar.test.tsx @@ -83,23 +83,4 @@ describe('getMonthInfo', () => { expect(isAvailable(days, 5)).toBe(false); expect(isAvailable(days, 10)).toBe(true); }); - - describe('requireExactYear', () => { - const map = buildMap({ '08-15': { date: '2025-08-15' } }); - - it('hides a day whose stored year does not match the displayed year', () => { - const { days } = getMonthInfo(2026, 7, map, undefined, undefined, true); - expect(isAvailable(days, 15)).toBe(false); - }); - - it('shows the day when the displayed year matches the stored year', () => { - const { days } = getMonthInfo(2025, 7, map, undefined, undefined, true); - expect(isAvailable(days, 15)).toBe(true); - }); - - it('is ignored when not set, matching evergreen year-agnostic lookup', () => { - const { days } = getMonthInfo(2026, 7, map); - expect(isAvailable(days, 15)).toBe(true); - }); - }); }); diff --git a/client/src/components/daily-coding-challenge/calendar.tsx b/client/src/components/daily-coding-challenge/calendar.tsx index 718f79f044d..b297bb3c87a 100644 --- a/client/src/components/daily-coding-challenge/calendar.tsx +++ b/client/src/components/daily-coding-challenge/calendar.tsx @@ -14,12 +14,7 @@ import { Loader } from '../helpers'; import envData from '../../../config/env.json'; import Login from '../Header/components/login'; import CalendarDay from './calendar-day'; -import { - getTodayUsCentral, - toMonthDay, - formatDate, - lastDailyChallengeIsReleased -} from './helpers'; +import { getTodayUsCentral, toMonthDay, formatDate } from './helpers'; import './calendar.css'; import DailyCodingChallengeNotFound from './not-found'; @@ -55,13 +50,6 @@ export interface DailyChallengeMap { type DailyChallengesMap = Map; -interface MonthInfo { - days: JSX.Element[]; - index: number; - name: string; - year: number; -} - // Cap Feb to 28 days regardless of which "year" is displayed export const getDaysInMonth = (year: number, monthIndex: number): number => { const realDays = new Date(Date.UTC(year, monthIndex + 1, 0)).getUTCDate(); @@ -73,8 +61,7 @@ export const getMonthInfo = ( monthIndex: number, dailyChallengesMap: DailyChallengesMap, hideDaysAfter?: number, - hideDaysThrough?: number, - requireExactYear?: boolean + hideDaysThrough?: number ) => { // Create date for first of the month (handles rollover automatically) const firstOfMonth = new Date(Date.UTC(year, monthIndex, 1)); @@ -96,7 +83,6 @@ export const getMonthInfo = ( const title = challengeData?.title || ''; const isAvailable = challengeData !== undefined && - (!requireExactYear || challengeData.date === formattedDate) && (hideDaysAfter === undefined || day <= hideDaysAfter) && (hideDaysThrough === undefined || day > hideDaysThrough); const challengeNumber = challengeData?.challengeNumber; @@ -132,7 +118,6 @@ function DailyCodingChallengeCalendar({ const { t } = useTranslation(); const todayUsCentral = getTodayUsCentral(); - const lastDailyChallengeReleased = lastDailyChallengeIsReleased(); const [todayYear, todayMonth, todayDay] = todayUsCentral .split('-') @@ -190,32 +175,6 @@ function DailyCodingChallengeCalendar({ const nextMonth = () => setMonthOffset(offset => offset + 1); const prevMonth = () => setMonthOffset(offset => offset - 1); - const hasOlderChallenges = ( - map: DailyChallengesMap, - monthInfo: MonthInfo - ): boolean => { - return Array.from(map.values()).some(({ date }) => { - const [year, month] = date.split('-').map(Number); - return ( - year < monthInfo.year || - (year === monthInfo.year && month - 1 < monthInfo.index) - ); - }); - }; - - const hasNewerChallenges = ( - map: DailyChallengesMap, - monthInfo: MonthInfo - ): boolean => { - return Array.from(map.values()).some(({ date }) => { - const [year, month] = date.split('-').map(Number); - return ( - year > monthInfo.year || - (year === monthInfo.year && month - 1 > monthInfo.index) - ); - }); - }; - // The furthest month back only shows challenges after today const isBoundaryMonth = minMonthOffset === -12 && monthOffset === -12; @@ -224,18 +183,13 @@ function DailyCodingChallengeCalendar({ todayYear, todayMonth - 1 + monthOffset, dailyChallengesMap, - lastDailyChallengeReleased && monthOffset === 0 ? todayDay : undefined, - lastDailyChallengeReleased && isBoundaryMonth ? todayDay : undefined, - !lastDailyChallengeReleased + monthOffset === 0 ? todayDay : undefined, + isBoundaryMonth ? todayDay : undefined ); - const showPrevButton = lastDailyChallengeReleased - ? monthOffset > minMonthOffset - : hasOlderChallenges(dailyChallengesMap, monthInfo); + const showPrevButton = monthOffset > minMonthOffset; - const showNextButton = lastDailyChallengeReleased - ? monthOffset < 0 - : hasNewerChallenges(dailyChallengesMap, monthInfo); + const showNextButton = monthOffset < 0; if (isLoading) return ; if (error) return ; diff --git a/client/src/components/daily-coding-challenge/helpers.ts b/client/src/components/daily-coding-challenge/helpers.ts index 0d79d9cbb33..1caedd721ff 100644 --- a/client/src/components/daily-coding-challenge/helpers.ts +++ b/client/src/components/daily-coding-challenge/helpers.ts @@ -18,12 +18,6 @@ export function getTodayUsCentral(dateObj: Date = new Date()) { return format(zonedDate, 'yyyy-MM-dd'); } -const LAST_DAY_OF_NEW_DAILY_CHALLENGES = '2026-08-10'; - -export function lastDailyChallengeIsReleased() { - return getTodayUsCentral() > LAST_DAY_OF_NEW_DAILY_CHALLENGES; -} - // Validate that dateString is in the format yyyy-MM-dd // Leading zero's are accepted for single digit month/day export function isValidDateString(dateString: string) {