diff --git a/client/src/components/Journey/JourneyDayImportDialog.test.tsx b/client/src/components/Journey/JourneyDayImportDialog.test.tsx index 7c2a71db4..b7b39ef7b 100644 --- a/client/src/components/Journey/JourneyDayImportDialog.test.tsx +++ b/client/src/components/Journey/JourneyDayImportDialog.test.tsx @@ -1,4 +1,4 @@ -// FE-JRN-DAYIMPORT-DIALOG-001 to FE-JRN-DAYIMPORT-DIALOG-006 +// FE-JRN-DAYIMPORT-DIALOG-001 to FE-JRN-DAYIMPORT-DIALOG-008 // // JRN-02: the desktop dialog that takes a recorded day over with its stays. It // names the journey and the day, shows the stays on the map and in a list to @@ -9,6 +9,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import { buildDayStay, buildDayStays, buildRecordingPreview } from '../../../tests/helpers/journeyRecording'; import { render, screen, waitFor, within } from '../../../tests/helpers/render'; import JourneyDayImportDialog from './JourneyDayImportDialog'; +import type { JourneyRecordingPrepState } from './useJourneyRecordingPrep'; const repo = vi.hoisted(() => ({ reviewDay: vi.fn(), @@ -30,7 +31,7 @@ vi.mock('./JourneyMapAuto', () => ({ }, })); -function renderDialog() { +function renderDialog(prep?: JourneyRecordingPrepState) { const props = { onTakenOver: vi.fn(), onKept: vi.fn(), onClose: vi.fn() }; render( ); return props; } +function prepState(over: Partial = {}): JourneyRecordingPrepState { + return { + prep: { + enabled: true, + connection: 'ready', + lastAttemptAt: '2026-05-16T08:00:00.000Z', + lastSuccessAt: '2026-05-14T18:00:00.000Z', + lastError: 'unreachable', + }, + saving: false, + fetching: false, + statusLine: { text: 'The last refresh failed: Dawarich did not answer.', tone: 'warning' }, + canFetch: true, + setEnabled: vi.fn(), + fetchNow: vi.fn(async () => {}), + dayPrep: () => ({ state: 'provisional', failed: true, lastSuccessAt: '2026-05-14T18:00:00.000Z' }), + ...over, + }; +} + const rowOf = (name: string) => screen.getByRole('checkbox', { name: `Take over ${name}` }).closest('[data-stay-id]') as HTMLElement; @@ -153,4 +175,26 @@ describe('JourneyDayImportDialog', () => { expect(screen.getByText(/Some stays may be missing/)).toBeInTheDocument(); expect(screen.getByRole('checkbox', { name: 'Take over Rialto' })).toBeChecked(); }); + + it('FE-JRN-DAYIMPORT-DIALOG-007: an unsettled prepared day says why, with the caller status and a fetch by hand', async () => { + const user = userEvent.setup(); + const prep = prepState(); + renderDialog(prep); + + expect(await screen.findByText(/before the day ended, so stays may be missing/)).toBeInTheDocument(); + expect(screen.getByText(/this is the older state/)).toBeInTheDocument(); + expect(screen.getByTestId('journey-prep-status')).toHaveTextContent( + 'The last refresh failed: Dawarich did not answer.' + ); + await user.click(screen.getByRole('button', { name: 'Fetch now' })); + expect(prep.fetchNow).toHaveBeenCalledTimes(1); + }); + + it('FE-JRN-DAYIMPORT-DIALOG-008: without the journey preparing its days, no status and no day notice', async () => { + renderDialog(prepState({ statusLine: null, canFetch: false, dayPrep: () => null })); + + expect(await screen.findByRole('checkbox', { name: 'Take over Parcheggio' })).toBeChecked(); + expect(screen.queryByTestId('journey-prep-status')).not.toBeInTheDocument(); + expect(screen.queryByText(/this is the older state/)).not.toBeInTheDocument(); + }); }); diff --git a/client/src/components/Journey/JourneyDayImportDialog.tsx b/client/src/components/Journey/JourneyDayImportDialog.tsx index 0591a9015..7f3f9f829 100644 --- a/client/src/components/Journey/JourneyDayImportDialog.tsx +++ b/client/src/components/Journey/JourneyDayImportDialog.tsx @@ -13,6 +13,7 @@ export default function JourneyDayImportDialog({ date, dayColor, onClose, + prep, ...rest }: JourneyDayImportViewProps) { const { t } = useTranslation(); @@ -26,7 +27,7 @@ export default function JourneyDayImportDialog({ onClose={onClose} footer={} > - + ); } diff --git a/client/src/components/Journey/JourneyDayImportReview.tsx b/client/src/components/Journey/JourneyDayImportReview.tsx index 265602ee2..dbfd1255b 100644 --- a/client/src/components/Journey/JourneyDayImportReview.tsx +++ b/client/src/components/Journey/JourneyDayImportReview.tsx @@ -11,16 +11,25 @@ import { Tooltip } from '../shared/Tooltip'; import { JourneyDayImportStays } from './JourneyDayImportStays'; import JourneyMap from './JourneyMapAuto'; import { reasonText } from './journeyRecordingModel'; +import { dayPrepNotice } from './journeyRecordingPrepModel'; +import { JourneyRecordingPrepStatus } from './JourneyRecordingPrepSetting'; import { Notice } from './JourneyRecordingReview'; import { stayMarkerId, type JourneyDayImportState } from './useJourneyDayImport'; +import type { JourneyRecordingPrepState } from './useJourneyRecordingPrep'; -type Props = { state: JourneyDayImportState; dayColor: string }; +type Props = { state: JourneyDayImportState; dayColor: string; prep?: JourneyRecordingPrepState }; -/** Why the list may not be the whole day, and what went wrong on the way. */ -function DayNotices({ state }: { state: JourneyDayImportState }) { +/** + * Why the list may not be the whole day, and what went wrong on the way. With + * the journey preparing its days, why this day is not final yet and how the + * caller's own preparation stands, so an editor sees it without the settings. + */ +function DayNotices({ state, prep }: { state: JourneyDayImportState; prep?: JourneyRecordingPrepState }) { const { t, locale } = useTranslation(); const { review, outcome } = state; const reason = review ? reasonText(review.error, t) : ''; + const day = prep?.dayPrep(state.date); + const dayNotice = day ? dayPrepNotice(day, t, locale) : ''; return ( <> {outcome?.kind === 'failed' && ( @@ -41,6 +50,8 @@ function DayNotices({ state }: { state: JourneyDayImportState }) { )} {review?.truncated && {t('journey.dayImport.truncated')}} {state.running && {t('journey.dayImport.running')}} + {dayNotice && {dayNotice}} + {prep && } ); } @@ -137,7 +148,7 @@ function scrollToStay(id: string): void { * holds on the day already, and who will see the drafts. The body of the * desktop dialog and of the phone sheet alike. */ -export function JourneyDayImportReview({ state, dayColor }: Props) { +export function JourneyDayImportReview({ state, dayColor, prep }: Props) { const { t } = useTranslation(); const { review, choice } = state; if (!review) { @@ -162,7 +173,7 @@ export function JourneyDayImportReview({ state, dayColor }: Props) { } return ( <> - +
diff --git a/client/src/components/Journey/journeyRecordingPrepModel.test.ts b/client/src/components/Journey/journeyRecordingPrepModel.test.ts index 4e7bd4ed3..1c64bfa08 100644 --- a/client/src/components/Journey/journeyRecordingPrepModel.test.ts +++ b/client/src/components/Journey/journeyRecordingPrepModel.test.ts @@ -1,9 +1,16 @@ -// FE-JRN-PREP-MODEL-001 to FE-JRN-PREP-MODEL-006 +// FE-JRN-PREP-MODEL-001 to FE-JRN-PREP-MODEL-009 // // JRN-03: where preparing a journey day stands, and the line under the switch. import type { JourneyRecordingPrep } from '@trek/shared'; import { describe, expect, it } from 'vitest'; -import { dayPrepOf, dayPrepText, dayPrepUnsettled, prepStatusLine } from './journeyRecordingPrepModel'; +import { + dayPrepNotice, + dayPrepOf, + dayPrepText, + dayPrepUnsettled, + prepReachOf, + prepStatusLine, +} from './journeyRecordingPrepModel'; /** Keys come back as they are, with their params; a Dawarich reason reads as its code, as reasonText needs a hit. */ const t = (key: string, params?: Record) => { @@ -13,6 +20,7 @@ const t = (key: string, params?: Record) => { const NOW = new Date(2026, 4, 16, 12, 0); const PERIOD = new Set(['2026-05-14', '2026-05-15', '2026-05-16', '2026-05-17']); +const REACHED = { prepared: true, outOfReach: false }; function prep(over: Partial = {}): JourneyRecordingPrep { return { @@ -81,30 +89,71 @@ describe('prepStatusLine', () => { const now = NOW.getTime(); it('FE-JRN-PREP-MODEL-005: says when the last fetch came through, or that none did yet', () => { - expect(prepStatusLine(prep(), true, t, 'en', now)).toEqual({ + expect(prepStatusLine(prep(), REACHED, t, 'en', now)).toEqual({ text: 'journey.prep.lastSuccess {"time":"2 hours ago"}', tone: 'muted', }); - expect(prepStatusLine(prep({ lastSuccessAt: null, lastAttemptAt: null }), true, t, 'en', now)).toEqual({ + expect(prepStatusLine(prep({ lastSuccessAt: null, lastAttemptAt: null }), REACHED, t, 'en', now)).toEqual({ text: 'journey.prep.never', tone: 'muted', }); - expect(prepStatusLine(prep({ enabled: false }), true, t, 'en', now)).toBeNull(); + expect(prepStatusLine(prep({ enabled: false }), REACHED, t, 'en', now)).toBeNull(); }); it('FE-JRN-PREP-MODEL-006: warns about what keeps it from working, a failure first and beside the state still shown', () => { - expect(prepStatusLine(prep({ connection: 'not_connected' }), true, t, 'en', now)?.text).toBe( + expect(prepStatusLine(prep({ connection: 'not_connected' }), REACHED, t, 'en', now)?.text).toBe( 'journey.prep.notConnected' ); - expect(prepStatusLine(prep(), false, t, 'en', now)?.text).toBe('journey.prep.noPeriods'); - expect(prepStatusLine(prep({ connection: 'sync_off' }), true, t, 'en', now)?.text).toBe('journey.prep.syncOff'); - expect(prepStatusLine(prep({ lastError: 'unreachable' }), true, t, 'en', now)).toEqual({ + expect(prepStatusLine(prep(), { prepared: false, outOfReach: false }, t, 'en', now)?.text).toBe( + 'journey.prep.noPeriods' + ); + expect(prepStatusLine(prep({ connection: 'sync_off' }), REACHED, t, 'en', now)?.text).toBe('journey.prep.syncOff'); + expect(prepStatusLine(prep({ lastError: 'unreachable' }), REACHED, t, 'en', now)).toEqual({ text: 'journey.prep.failed {"reason":"UNREACHABLE","time":"2 hours ago"}', tone: 'warning', }); - expect(prepStatusLine(prep({ lastError: 'unauthorized', lastSuccessAt: null }), true, t, 'en', now)).toEqual({ + expect(prepStatusLine(prep({ lastError: 'unauthorized', lastSuccessAt: null }), REACHED, t, 'en', now)).toEqual({ text: 'journey.prep.failedNever {"reason":"UNAUTHORIZED"}', tone: 'warning', }); }); }); + +describe('prepReachOf', () => { + it('FE-JRN-PREP-MODEL-007: only the periods the server reaches are prepared, an open trip up to today', () => { + const linked = new Set(['2024-01-10', '2024-01-11', ...PERIOD]); + const reach = prepReachOf(prep({ periods: [{ start: '2026-05-14', end: null }] }), linked, NOW); + + expect([...reach.dates]).toEqual(['2026-05-14', '2026-05-15', '2026-05-16']); + expect(reach.outOfReach).toBe(true); + expect(dayPrepOf('2024-01-10', prep(), reach.dates, NOW)).toBeNull(); + expect(prepReachOf(prep({ periods: [{ start: '2026-05-14', end: '2026-05-17' }] }), PERIOD, NOW)).toEqual({ + dates: PERIOD, + outOfReach: false, + }); + }); + + it('FE-JRN-PREP-MODEL-008: without periods in the answer the linked dates stand in, nothing out of reach', () => { + expect(prepReachOf(prep(), PERIOD, NOW)).toEqual({ dates: PERIOD, outOfReach: false }); + expect(prepReachOf(null, PERIOD, NOW)).toEqual({ dates: PERIOD, outOfReach: false }); + }); + + it('FE-JRN-PREP-MODEL-009: trips out of reach are named, alone when none is reached and after the state otherwise', () => { + const now = NOW.getTime(); + expect(prepStatusLine(prep(), { prepared: false, outOfReach: true }, t, 'en', now)).toEqual({ + text: 'journey.prep.outOfReach {"count":400}', + tone: 'warning', + }); + expect(prepStatusLine(prep(), { prepared: true, outOfReach: true }, t, 'en', now)).toEqual({ + text: 'journey.prep.lastSuccess {"time":"2 hours ago"} journey.prep.outOfReach {"count":400}', + tone: 'muted', + }); + expect(dayPrepNotice({ state: 'running', failed: false, lastSuccessAt: null }, t, 'en', now)).toBe(''); + expect(dayPrepNotice({ state: 'running', failed: true, lastSuccessAt: null }, t, 'en', now)).toBe( + 'journey.prep.dayFailed' + ); + expect(dayPrepNotice({ state: 'pending', failed: false, lastSuccessAt: null }, t, 'en', now)).toBe( + 'journey.prep.dayPending' + ); + }); +}); diff --git a/client/src/components/Journey/journeyRecordingPrepModel.ts b/client/src/components/Journey/journeyRecordingPrepModel.ts index b6b03a8dc..2bbde4235 100644 --- a/client/src/components/Journey/journeyRecordingPrepModel.ts +++ b/client/src/components/Journey/journeyRecordingPrepModel.ts @@ -1,4 +1,4 @@ -import type { JourneyRecordingPrep } from '@trek/shared'; +import { JOURNEY_RECORDING_PREP_REACH_DAYS, type JourneyRecordingPrep } from '@trek/shared'; import { localIsoDate } from '../../utils/localDate'; import { relativeTime } from '../../utils/relativeTime'; import { reasonText } from './journeyRecordingModel'; @@ -19,7 +19,36 @@ export interface JourneyDayPrep { } /** - * A day of a linked trip period while the journey prepares its days for a + * Which days the caller's runs reach and whether some linked day is left out. + * The server names the trips its runs read; a trip still open runs up to + * today. Without that answer the linked dates stand in for them. + */ +export interface PrepReach { + dates: ReadonlySet; + /** A linked day that is over is read by no run, its trip ended too long ago. */ + outOfReach: boolean; +} + +export function prepReachOf( + prep: JourneyRecordingPrep | null, + linkedDates: ReadonlySet, + now: Date = new Date() +): PrepReach { + if (!prep?.periods) return { dates: linkedDates, outOfReach: false }; + const today = localIsoDate(now); + const dates = new Set(); + for (const period of prep.periods) { + const end = new Date(`${period.end ?? today}T00:00:00`); + for (let d = new Date(`${period.start}T00:00:00`); d <= end; d.setDate(d.getDate() + 1)) { + dates.add(localIsoDate(d)); + } + } + const outOfReach = [...linkedDates].some((date) => date < today && !dates.has(date)); + return { dates, outOfReach }; +} + +/** + * A day the caller's runs reach while the journey prepares its days for a * connected caller; null for every other day, including those still ahead. */ export function dayPrepOf( @@ -56,6 +85,11 @@ export function dayPrepText(day: JourneyDayPrep, t: Translate, locale: string, n return parts.join(' '); } +/** The same for the day review, which says on its own that the day is still running. */ +export function dayPrepNotice(day: JourneyDayPrep, t: Translate, locale: string, now: number = Date.now()): string { + return day.state === 'running' ? (day.failed ? t('journey.prep.dayFailed') : '') : dayPrepText(day, t, locale, now); +} + /** The line under the switch in the journey settings, and whether it asks for attention. */ export interface PrepStatusLine { text: string; @@ -64,20 +98,29 @@ export interface PrepStatusLine { /** * What the caller's own preparation of a journey looks like right now, for - * the settings: why nothing happens (no connection, no dated trip, background - * sync off), the last failure next to the state still shown, or when it last - * came through. Null while the switch is off. + * the settings and the day review: why nothing happens (no connection, no + * dated trip, every trip out of reach, background sync off), the last failure + * next to the state still shown, or when it last came through, followed by a + * word on trips left out. Null while the switch is off. */ export function prepStatusLine( prep: JourneyRecordingPrep, - hasPeriods: boolean, + reach: { prepared: boolean; outOfReach: boolean }, t: Translate, locale: string, now: number = Date.now() ): PrepStatusLine | null { if (!prep.enabled) return null; if (prep.connection === 'not_connected') return { text: t('journey.prep.notConnected'), tone: 'warning' }; - if (!hasPeriods) return { text: t('journey.prep.noPeriods'), tone: 'warning' }; + const outOfReachText = t('journey.prep.outOfReach', { count: JOURNEY_RECORDING_PREP_REACH_DAYS }); + if (!reach.prepared) { + return { text: reach.outOfReach ? outOfReachText : t('journey.prep.noPeriods'), tone: 'warning' }; + } + const line = baseStatusLine(prep, t, locale, now); + return reach.outOfReach ? { ...line, text: `${line.text} ${outOfReachText}` } : line; +} + +function baseStatusLine(prep: JourneyRecordingPrep, t: Translate, locale: string, now: number): PrepStatusLine { const success = prep.lastSuccessAt ? relativeTime(Date.parse(prep.lastSuccessAt), locale, now) : null; if (prep.lastError) { const reason = reasonText(prep.lastError, t); diff --git a/client/src/components/Journey/useJourneyDayImport.ts b/client/src/components/Journey/useJourneyDayImport.ts index cc03a1cf3..ed28dbc3b 100644 --- a/client/src/components/Journey/useJourneyDayImport.ts +++ b/client/src/components/Journey/useJourneyDayImport.ts @@ -26,6 +26,7 @@ import { } from './journeyDayImportModel'; import { recordingErrorText } from './journeyRecordingModel'; import { useJourneyRecordingDay } from './useJourneyRecordingDay'; +import type { JourneyRecordingPrepState } from './useJourneyRecordingPrep'; /** What the desktop dialog and the phone sheet are opened with. */ export interface JourneyDayImportViewProps { @@ -40,6 +41,8 @@ export interface JourneyDayImportViewProps { onTakenOver: () => void; onKept: (day: JourneyRecordedDay) => void; onClose: () => void; + /** The caller's own preparation of the journey's days (JRN-03), for editors too; absent while it is off or unread. */ + prep?: JourneyRecordingPrepState; } /** @@ -259,7 +262,7 @@ export function useJourneyDayImport({ onTakenOver, onKept, onClose, -}: Omit) { +}: Omit) { const { t, locale } = useTranslation(); const day = useDayReview(journeyId, date); const route = useJourneyRecordingDay({ journeyId, date, onKept, onRemoved: noop, onClose: noop }); @@ -291,6 +294,7 @@ export function useJourneyDayImport({ const problem = choice ? problemOf(choice, stays, reportDefault) : 'nothing'; return { + date, review: day.review, loading: day.loading, /** The day is today: stays recorded later still arrive. */ diff --git a/client/src/components/Journey/useJourneyRecordingPrep.test.ts b/client/src/components/Journey/useJourneyRecordingPrep.test.ts index 9b5f03db8..927930130 100644 --- a/client/src/components/Journey/useJourneyRecordingPrep.test.ts +++ b/client/src/components/Journey/useJourneyRecordingPrep.test.ts @@ -1,4 +1,4 @@ -// FE-JRN-PREP-HOOK-001 to FE-JRN-PREP-HOOK-005 +// FE-JRN-PREP-HOOK-001 to FE-JRN-PREP-HOOK-007 // // JRN-03: a journey preparing its recorded days, as the journey page, the // phone screen and both settings shells read it: the caller's status, the @@ -48,6 +48,7 @@ beforeEach(() => { dawarich.syncNow.mockReset().mockResolvedValue({ state: 'ok', created: 0, updated: 0, missing: 0 }); updateJourney.mockClear(); toast.error.mockClear(); + toast.info.mockClear(); useJourneyStore.setState({ updateJourney }); }); @@ -126,4 +127,30 @@ describe('useJourneyRecordingPrep', () => { expect(toast.error).toHaveBeenCalledWith('Dawarich could not be asked right now.'); await waitFor(() => expect(repo.prep).toHaveBeenCalledTimes(3)); }); + + it('FE-JRN-PREP-HOOK-006: a fetch while the background run is busy says so instead of looking like nothing happened', async () => { + dawarich.syncNow.mockResolvedValue({ state: 'ok', created: 0, updated: 0, missing: 0, alreadyRunning: true }); + const { result } = renderHook(() => useJourneyRecordingPrep(options())); + await waitFor(() => expect(result.current.prep).not.toBeNull()); + + await act(async () => { + await result.current.fetchNow(); + }); + expect(toast.info).toHaveBeenCalledWith( + 'A fetch is already running in the background. Its stays show up once it is through.' + ); + }); + + it('FE-JRN-PREP-HOOK-007: a journey whose trips all ended out of reach marks no day and offers no fetch', async () => { + repo.prep.mockResolvedValue(status({ periods: [] })); + const { result } = renderHook(() => useJourneyRecordingPrep(options())); + await waitFor(() => expect(result.current.prep).not.toBeNull()); + + expect(result.current.dayPrep('2026-05-14')).toBeNull(); + expect(result.current.canFetch).toBe(false); + expect(result.current.statusLine).toEqual({ + text: 'Trips that ended more than 400 days ago are not prepared in the background. Open one of their days to fetch it by hand.', + tone: 'warning', + }); + }); }); diff --git a/client/src/components/Journey/useJourneyRecordingPrep.ts b/client/src/components/Journey/useJourneyRecordingPrep.ts index 751077b2d..86a566f95 100644 --- a/client/src/components/Journey/useJourneyRecordingPrep.ts +++ b/client/src/components/Journey/useJourneyRecordingPrep.ts @@ -5,7 +5,13 @@ import { dawarichRepo } from '../../repo/dawarichRepo'; import { journeyRecordingsRepo } from '../../repo/journeyRecordingsRepo'; import { useJourneyStore } from '../../store/journeyStore'; import { useToast } from '../shared/Toast'; -import { dayPrepOf, prepStatusLine, type JourneyDayPrep, type PrepStatusLine } from './journeyRecordingPrepModel'; +import { + dayPrepOf, + prepReachOf, + prepStatusLine, + type JourneyDayPrep, + type PrepStatusLine, +} from './journeyRecordingPrepModel'; export interface JourneyRecordingPrepOptions { /** The journey the route names, or null while it loads. */ @@ -14,7 +20,7 @@ export interface JourneyRecordingPrepOptions { enabled: boolean; /** An editor with the Dawarich addon on: nobody else has anything of their own prepared. */ active: boolean; - /** The dates of the linked trips, the only days that are prepared. */ + /** The dates of the linked trips; only those the server says its runs reach are prepared. */ periodDates: ReadonlySet; /** The switch was saved: the journey is read again. */ onSwitched: () => void; @@ -28,7 +34,7 @@ export interface JourneyRecordingPrepState { saving: boolean; /** A fetch asked for by hand is running. */ fetching: boolean; - /** The line under the switch in the settings; null while it is off or not read yet. */ + /** The line under the switch in the settings and in the day review; null while it is off or not read yet. */ statusLine: PrepStatusLine | null; /** Whether a fetch by hand would reach anything. */ canFetch: boolean; @@ -39,9 +45,10 @@ export interface JourneyRecordingPrepState { /** * A journey preparing its recorded days (JRN-03), for the journey page, the - * phone screen and both settings shells: the caller's own status, the owner's - * switch, a fetch by hand and where each day stands. Switching it on fetches - * at once, so the days fill without waiting for the next background run. + * phone screen, both settings shells and the day review: the caller's own + * status, the owner's switch, a fetch by hand and where each day stands. + * Switching it on fetches at once, so the days fill without waiting for the + * next background run. */ export function useJourneyRecordingPrep({ journeyId, @@ -73,7 +80,8 @@ export function useJourneyRecordingPrep({ const fetchNow = useCallback(async () => { setFetching(true); try { - await dawarichRepo.syncNow(); + const result = await dawarichRepo.syncNow(); + if (result.alreadyRunning) toast.info(t('journey.prep.alreadyRunning')); onFetched(); } catch { toast.error(t('journey.prep.fetchFailed')); @@ -101,18 +109,20 @@ export function useJourneyRecordingPrep({ [journeyId, updateJourney, onSwitched, toast, t, prep?.connection, fetchNow] ); + const reach = useMemo(() => prepReachOf(prep, periodDates), [prep, periodDates]); + const prepared = reach.dates.size > 0; const statusLine = useMemo( - () => (prep ? prepStatusLine(prep, periodDates.size > 0, t, locale) : null), - [prep, periodDates, t, locale] + () => (prep ? prepStatusLine(prep, { prepared, outOfReach: reach.outOfReach }, t, locale) : null), + [prep, prepared, reach.outOfReach, t, locale] ); - const dayPrep = useCallback((date: string) => dayPrepOf(date, prep, periodDates), [prep, periodDates]); + const dayPrep = useCallback((date: string) => dayPrepOf(date, prep, reach.dates), [prep, reach.dates]); return { prep, saving, fetching, statusLine, - canFetch: !!prep?.enabled && prep.connection !== 'not_connected' && periodDates.size > 0, + canFetch: !!prep?.enabled && prep.connection !== 'not_connected' && prepared, setEnabled, fetchNow, dayPrep, diff --git a/client/src/mobile/screens/journey/MJourneyDayImportSheet.tsx b/client/src/mobile/screens/journey/MJourneyDayImportSheet.tsx index 01d19f7ad..be2de7d83 100644 --- a/client/src/mobile/screens/journey/MJourneyDayImportSheet.tsx +++ b/client/src/mobile/screens/journey/MJourneyDayImportSheet.tsx @@ -13,6 +13,7 @@ export default function MJourneyDayImportSheet({ date, dayColor, onClose, + prep, ...rest }: JourneyDayImportViewProps) { const { t } = useTranslation(); @@ -27,7 +28,7 @@ export default function MJourneyDayImportSheet({ onClose={onClose} footer={} > - + ); } diff --git a/client/src/mobile/screens/journey/MJourneyDetail.tsx b/client/src/mobile/screens/journey/MJourneyDetail.tsx index a1091c022..0ec192d13 100644 --- a/client/src/mobile/screens/journey/MJourneyDetail.tsx +++ b/client/src/mobile/screens/journey/MJourneyDetail.tsx @@ -624,7 +624,7 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD )} {recordings.dialog && } - {dayImport.dialog && } + {dayImport.dialog && } {/* Journey settings */} {showSettings && ( diff --git a/client/src/pages/JourneyDetailPage.tsx b/client/src/pages/JourneyDetailPage.tsx index abc2a0f35..d02f53784 100644 --- a/client/src/pages/JourneyDetailPage.tsx +++ b/client/src/pages/JourneyDetailPage.tsx @@ -788,7 +788,7 @@ export function JourneyDetailPageDesktop({ journeyId, embedded = false }: Journe )} {recordings.dialog && } - {dayImport.dialog && } + {dayImport.dialog && } {/* Add Trip Dialog */} {showAddTrip && current && ( diff --git a/client/src/pages/JourneyDetailPage.wiring.test.tsx b/client/src/pages/JourneyDetailPage.wiring.test.tsx index 458ad3839..a45c7af74 100644 --- a/client/src/pages/JourneyDetailPage.wiring.test.tsx +++ b/client/src/pages/JourneyDetailPage.wiring.test.tsx @@ -1,4 +1,4 @@ -// FE-JRN-DETWIRE-001 to FE-JRN-DETWIRE-045 +// FE-JRN-DETWIRE-001 to FE-JRN-DETWIRE-046 import { describe, it, expect, beforeEach, vi } from 'vitest'; import { render, screen, fireEvent, waitFor, within } from '../../tests/helpers/render'; import { journeyApi } from '../api/client'; @@ -646,4 +646,19 @@ describe('JourneyDetailPage wiring', () => { expect(screen.getAllByTestId('journey-day-prep-unsettled')).toHaveLength(1); expect(mocks.captured.settings.recordingPrep).toBe(recordingPrep); }); + + it('FE-JRN-DETWIRE-046: an editor without the settings gets the status of their own preparation in the day dialog (JRN-03)', () => { + const recordingPrep = { prep: { enabled: true }, dayPrep: () => null }; + const dialog = { journeyId: 7, date: '2026-05-01', dayColor: '#123456' }; + setup({ + canEditJourney: false, + myRole: 'editor', + canTakeOverRecording: true, + dayImport: { open: vi.fn(), dialog }, + recordingPrep, + }); + + expect(screen.getByTestId('day-import-dialog')).toBeInTheDocument(); + expect(mocks.captured.dayImport.prep).toBe(recordingPrep); + }); }); diff --git a/client/tests/unit/mobile/journey/MJourneyDayImportSheet.test.tsx b/client/tests/unit/mobile/journey/MJourneyDayImportSheet.test.tsx index f60afd349..d0b843a7d 100644 --- a/client/tests/unit/mobile/journey/MJourneyDayImportSheet.test.tsx +++ b/client/tests/unit/mobile/journey/MJourneyDayImportSheet.test.tsx @@ -1,8 +1,9 @@ -// FE-MJRN-DAYIMPORT-001 to FE-MJRN-DAYIMPORT-002 +// FE-MJRN-DAYIMPORT-001 to FE-MJRN-DAYIMPORT-003 // // JRN-02 on the phone: the same review and buttons as the desktop dialog, in a // bottom sheet for the day of the card the journey shows. The frame is the one -// the route sheet (JRN-01) uses too. +// the route sheet (JRN-01) uses too. With the journey preparing its days +// (JRN-03) the sheet is where a phone says, in words, why a day is not final. import userEvent from '@testing-library/user-event'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import MJourneyDayImportSheet from '../../../../src/mobile/screens/journey/MJourneyDayImportSheet'; @@ -82,4 +83,36 @@ describe('MJourneyDayImportSheet', () => { screen.getByText('Only this day, from your Dawarich. Nothing is kept until you confirm.') ).toBeInTheDocument(); }); + + it('FE-MJRN-DAYIMPORT-003: a day no run fetched yet says so, beside the caller status and a fetch by hand', async () => { + const user = userEvent.setup(); + const fetchNow = vi.fn(async () => {}); + render( + ({ state: 'pending', failed: false, lastSuccessAt: null }), + }} + /> + ); + + expect(await screen.findByText('Not fetched yet.')).toBeInTheDocument(); + expect(screen.getByTestId('journey-prep-status')).toHaveTextContent('The next background sync starts it.'); + await user.click(screen.getByRole('button', { name: 'Fetch now' })); + expect(fetchNow).toHaveBeenCalledTimes(1); + }); }); diff --git a/client/tests/unit/mobile/journey/MJourneyDetail.test.tsx b/client/tests/unit/mobile/journey/MJourneyDetail.test.tsx index 8b1327dbb..e5aa97188 100644 --- a/client/tests/unit/mobile/journey/MJourneyDetail.test.tsx +++ b/client/tests/unit/mobile/journey/MJourneyDetail.test.tsx @@ -81,6 +81,13 @@ vi.mock('../../../../src/mobile/screens/journey/MJourneySettingsSheet', () => ({ }, })); +vi.mock('../../../../src/mobile/screens/journey/MJourneyDayImportSheet', () => ({ + default: (props: Record) => { + mocks.captured.dayImport = props; + return
; + }, +})); + // ── Fixtures ───────────────────────────────────────────────────────────────── function buildEntry(over: Partial = {}): JourneyEntry { @@ -745,20 +752,24 @@ describe('MJourneyDetail', () => { expect(screen.queryByTestId('dawarich-panel')).not.toBeInTheDocument(); }); - it('FE-MOB-JDET-045: a waiting day the journey prepares carries a dot that says why it is not final (JRN-03)', () => { + it('FE-MOB-JDET-045: a waiting day the journey prepares carries a dot that says why it is not final, and its sheet gets the status (JRN-03)', () => { useAddonStore.setState({ addons: [{ id: 'dawarich', enabled: true }] as never, loaded: true }); + const recordingPrep = { + prep: { enabled: true }, + dayPrep: () => ({ state: 'running', failed: false, lastSuccessAt: null }), + }; setup({ current: buildDetail({ entries: [], stats: { entries: 0, photos: 0, places: 0 } }), canTakeOverRecording: true, dawarichByDate: new Map([['2026-05-03', [{ id: 1 }]]]), dayImportDates: ['2026-05-03'], - recordingPrep: { - prep: { enabled: true }, - dayPrep: () => ({ state: 'running', failed: false, lastSuccessAt: null }), - }, + dayImport: { open: vi.fn(), dialog: { journeyId: 1, date: '2026-05-03', dayColor: '#123456' } }, + recordingPrep, }); fireEvent.click(screen.getByRole('button', { name: 'dawarich.suggestions.title' })); expect(screen.getByRole('img', { name: 'journey.prep.dayRunning' })).toBeInTheDocument(); + expect(screen.getByTestId('day-import-sheet')).toBeInTheDocument(); + expect(mocks.captured.dayImport.prep).toBe(recordingPrep); }); }); diff --git a/server/src/nest/journey-recordings/journey-recordings.mcp.ts b/server/src/nest/journey-recordings/journey-recordings.mcp.ts index 30a89c9cb..e0c9ad45f 100644 --- a/server/src/nest/journey-recordings/journey-recordings.mcp.ts +++ b/server/src/nest/journey-recordings/journey-recordings.mcp.ts @@ -56,7 +56,7 @@ export class JourneyRecordingsMcp { @Tool({ name: 'get_journey_recording_prep', description: - "Whether a journey prepares its recorded days from Dawarich in the background (its owner's switch, update_journey auto_prepare_recordings) and how the caller's own last runs over its linked trip periods went: when the last one was tried, when one last came through (the stays waiting at the journey's days are as new as that) and why the last one failed, plus whether the caller's connection can prepare anything at all (ready, sync_off, not_connected). Prepared stays are reviewed and taken over with review_journey_day_stays and take_over_journey_day_stays; nothing is ever written into the journey on its own. Needs edit access to the journey.", + "Whether a journey prepares its recorded days from Dawarich in the background (its owner's switch, update_journey auto_prepare_recordings) and how the caller's own last runs over its linked trip periods went: when the last one was tried, when one last came through (the stays waiting at the journey's days are as new as that) and why the last one failed, plus whether the caller's connection can prepare anything at all (ready, sync_off, not_connected) and, while the switch is on, the linked trip periods those runs reach (a trip that ended more than 400 days ago is not prepared; review_journey_day_stays still reads its days by hand). Prepared stays are reviewed and taken over with review_journey_day_stays and take_over_journey_day_stays; nothing is ever written into the journey on its own. Needs edit access to the journey.", inputSchema: { journeyId: idSchema }, annotations: TOOL_ANNOTATIONS_READONLY, when: bothAddonsOn, diff --git a/server/src/nest/journey-recordings/journey-recordings.service.ts b/server/src/nest/journey-recordings/journey-recordings.service.ts index f0553871d..48c7c4533 100644 --- a/server/src/nest/journey-recordings/journey-recordings.service.ts +++ b/server/src/nest/journey-recordings/journey-recordings.service.ts @@ -137,17 +137,20 @@ export class JourneyRecordingsService { /** * Whether the journey prepares its recorded days (JRN-03) and how the - * caller's own last runs over it went, with what their connection allows. + * caller's own last runs over it went, with what their connection allows + * and, while it is on, which linked trips those runs reach. * Only for those who may edit it: a reader has nothing of theirs prepared. */ async prepStatus(userId: number, journeyId: number): Promise { const journey = await this.requireEditable(journeyId, userId); await this.requireDawarich(); const connection = await this.dawarich.getConnection(userId); + const enabled = !!journey.auto_prepare_recordings; return { - enabled: !!journey.auto_prepare_recordings, + enabled, connection: !connection.connected ? 'not_connected' : connection.syncEnabled ? 'ready' : 'sync_off', ...(await this.prep.status(journeyId, userId)), + ...(enabled ? { periods: await this.prep.periodsOf(journeyId, userId) } : {}), }; } diff --git a/server/src/nest/journey/journey-recording-prep.service.ts b/server/src/nest/journey/journey-recording-prep.service.ts index 6d926285b..dde457325 100644 --- a/server/src/nest/journey/journey-recording-prep.service.ts +++ b/server/src/nest/journey/journey-recording-prep.service.ts @@ -2,16 +2,10 @@ import { JourneyRecordingPrep } from '../../db/entities/JourneyRecordingPrep.ent import type { JourneyRecordingPrepRepository } from '../../db/repositories/JourneyRecordingPrep.repository'; import { InjectRepository } from '@mikro-orm/nestjs'; import { Injectable } from '@nestjs/common'; +import { JOURNEY_RECORDING_PREP_REACH_DAYS, type JourneyRecordingPrepPeriod } from '@trek/shared'; const DAY_MS = 86_400_000; -/** - * How far back a finished trip is still read, as `TripsRepository.listTripsToSync` - * reads a person's own trips: a journey must not reach further into the past - * than the trip sync it rides on. - */ -const SYNC_REACH_DAYS = 400; - /** A journey that prepares its recorded days, with the linked trips the next run reads. */ export interface PreparedJourney { journeyId: number; @@ -38,7 +32,7 @@ export class JourneyRecordingPrepService { /** The journeys this person prepares now, each with its linked trips within the sync's reach. */ async listFor(userId: number, now: Date = new Date()): Promise { const rows = await this.prep.listPreparedTrips(userId, { - endedAfter: isoDate(now.getTime() - SYNC_REACH_DAYS * DAY_MS), + endedAfter: isoDate(now.getTime() - JOURNEY_RECORDING_PREP_REACH_DAYS * DAY_MS), startedBy: isoDate(now.getTime() + DAY_MS), }); const byJourney = new Map(); @@ -53,6 +47,18 @@ export class JourneyRecordingPrepService { return [...byJourney.values()]; } + /** + * The linked trips of one journey this person's runs reach, read as + * `listFor` reads them for the sync, so a day is only ever shown as + * prepared when a run actually reads it. + */ + async periodsOf(journeyId: number, userId: number, now: Date = new Date()): Promise { + const journey = (await this.listFor(userId, now)).find((j) => j.journeyId === journeyId); + return (journey?.trips ?? []).flatMap((trip) => + trip.start_date ? [{ start: trip.start_date, end: trip.end_date }] : [], + ); + } + /** * One run's outcome for a journey and person: `error` is Dawarich's reason, * null when every period came through. diff --git a/server/tests/unit/nest/dawarich-sync-journeys.service.test.ts b/server/tests/unit/nest/dawarich-sync-journeys.service.test.ts index 0e3927e95..9c54b07bb 100644 --- a/server/tests/unit/nest/dawarich-sync-journeys.service.test.ts +++ b/server/tests/unit/nest/dawarich-sync-journeys.service.test.ts @@ -270,4 +270,29 @@ describe('JourneyRecordingPrepService', () => { await journeys.updateJourney(f.journey.id, f.owner.id, { auto_prepare_recordings: false }); expect(await prep.listFor(f.owner.id)).toEqual([]); }); + + it('JRNPREP-SVC-003: the periods of a journey are the trips a run reads, an open one included and one out of reach left out', async () => { + const f = await fixture(); + const old = await makeTrip(orm, f.owner.id, { start_date: dayOffset(-420), end_date: dayOffset(-410) }); + const open = await makeTrip(orm, f.owner.id, { start_date: dayOffset(-1), end_date: null }); + await linkTripToJourney(orm, f.journey.id, old.id); + await linkTripToJourney(orm, f.journey.id, open.id); + + expect(await prep.periodsOf(f.journey.id, f.editor.id)).toEqual([ + { start: TRIP_START, end: TRIP_END }, + { start: dayOffset(-1), end: null }, + ]); + expect(await prep.periodsOf(f.journey.id, f.viewer.id)).toEqual([]); + }); + + it('JRNPREP-SVC-004: a journey whose only trip ended out of reach has no period, and a run records nothing for it', async () => { + const { user: owner } = await makeUser(orm); + const journey = await makeJourney(orm, owner.id, { title: 'Lisbon', auto_prepare_recordings: 1 }); + const old = await makeTrip(orm, owner.id, { start_date: dayOffset(-430), end_date: dayOffset(-420) }); + await linkTripToJourney(orm, journey.id, old.id); + + expect(await prep.periodsOf(journey.id, owner.id)).toEqual([]); + await sync.syncUser(owner.id); + expect(await findRow(orm, JourneyRecordingPrep, { journey: journey.id })).toBeNull(); + }); }); diff --git a/server/tests/unit/nest/journey-recordings.service.test.ts b/server/tests/unit/nest/journey-recordings.service.test.ts index e29a5953f..44a0f8adc 100644 --- a/server/tests/unit/nest/journey-recordings.service.test.ts +++ b/server/tests/unit/nest/journey-recordings.service.test.ts @@ -22,9 +22,15 @@ import { JourneyDomainService } from '../../../src/nest/journey/journey-domain.s import { JourneyRecordedDaysService } from '../../../src/nest/journey/journey-recorded-days.service'; import { JourneyRecordingPrepService } from '../../../src/nest/journey/journey-recording-prep.service'; import { createSnapshotTestDb } from '../../helpers/db-mock'; -import { addJourneyContributor, makeJourney, makeJourneyEntry } from '../../helpers/factories/journeys'; +import { + addJourneyContributor, + linkTripToJourney, + makeJourney, + makeJourneyEntry, +} from '../../helpers/factories/journeys'; import { countRows, findRow, upsertRow } from '../../helpers/factories/rows'; import { setAddonEnabled } from '../../helpers/factories/settings'; +import { makeTrip } from '../../helpers/factories/trips'; import { makeUser } from '../../helpers/factories/users'; import { resetTestDb } from '../../helpers/test-db'; import { createTestModule, type TestModule } from '../../helpers/test-module'; @@ -417,7 +423,24 @@ describe('JourneyRecordingsService.prepStatus', () => { sync_enabled: 1, }); - expect(await svc.prepStatus(f.owner.id, f.journey.id)).toMatchObject({ enabled: true, connection: 'ready' }); + expect(await svc.prepStatus(f.owner.id, f.journey.id)).toMatchObject({ + enabled: true, + connection: 'ready', + periods: [], + }); + }); + + it('JRNREC-SVC-017: while on, it names the linked trips the runs reach and leaves out one that ended too long ago', async () => { + const f = await fixture(); + const start = new Date(Date.now() - 5 * 86_400_000).toISOString().slice(0, 10); + const longAgo = new Date(Date.now() - 500 * 86_400_000).toISOString().slice(0, 10); + const recent = await makeTrip(orm, f.owner.id, { start_date: start, end_date: null }); + const old = await makeTrip(orm, f.owner.id, { start_date: longAgo, end_date: longAgo }); + await linkTripToJourney(orm, f.journey.id, recent.id); + await linkTripToJourney(orm, f.journey.id, old.id); + await t.get(JourneyDomainService).updateJourney(f.journey.id, f.owner.id, { auto_prepare_recordings: true }); + + expect((await svc.prepStatus(f.editor.id, f.journey.id)).periods).toEqual([{ start, end: null }]); }); it('JRNREC-SVC-016: a reader, a stranger and a switched off Dawarich are refused as the other routes refuse them', async () => { diff --git a/shared/src/i18n/ar/journey.ts b/shared/src/i18n/ar/journey.ts index 877cb7b27..795bd284a 100644 --- a/shared/src/i18n/ar/journey.ts +++ b/shared/src/i18n/ar/journey.ts @@ -918,6 +918,19 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'لم يتم الجلب بعد.', 'journey.prep.dayProvisional': 'جُلب {time} قبل انتهاء اليوم، لذا قد تكون بعض محطات التوقف مفقودة.', 'journey.prep.dayFailed': 'فشل التحديث الأخير، هذه هي الحالة الأقدم.', + 'journey.prep.outOfReach': + 'الرحلات التي انتهت قبل أكثر من {count} يوم لا تُجهَّز في الخلفية. افتح أحد أيامها لجلبه يدويًا.', + 'journey.prep.outOfReach.zero': + 'الرحلات التي انتهت قبل أكثر من {count} يوم لا تُجهَّز في الخلفية. افتح أحد أيامها لجلبه يدويًا.', + 'journey.prep.outOfReach.one': + 'الرحلات التي انتهت قبل أكثر من يوم واحد لا تُجهَّز في الخلفية. افتح أحد أيامها لجلبه يدويًا.', + 'journey.prep.outOfReach.two': + 'الرحلات التي انتهت قبل أكثر من يومين لا تُجهَّز في الخلفية. افتح أحد أيامها لجلبه يدويًا.', + 'journey.prep.outOfReach.few': + 'الرحلات التي انتهت قبل أكثر من {count} أيام لا تُجهَّز في الخلفية. افتح أحد أيامها لجلبه يدويًا.', + 'journey.prep.outOfReach.many': + 'الرحلات التي انتهت قبل أكثر من {count} يومًا لا تُجهَّز في الخلفية. افتح أحد أيامها لجلبه يدويًا.', + 'journey.prep.alreadyRunning': 'هناك عملية جلب جارية بالفعل في الخلفية. ستظهر محطات التوقف بمجرد انتهائها.', 'journey.dayImport.running': 'هذا اليوم لم ينتهِ بعد. تظهر محطات التوقف المسجلة لاحقًا بمجرد أن تصل إلى Dawarich.', }; export default journey; diff --git a/shared/src/i18n/az/journey.ts b/shared/src/i18n/az/journey.ts index 3d426fe89..5fd8fa318 100644 --- a/shared/src/i18n/az/journey.ts +++ b/shared/src/i18n/az/journey.ts @@ -926,6 +926,11 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Hələ yüklənməyib.', 'journey.prep.dayProvisional': '{time} yükləndi, gün bitməmiş, dayanacaqlar çatışmaya bilər.', 'journey.prep.dayFailed': 'Son yeniləmə alınmadı, bu köhnə vəziyyətdir.', + 'journey.prep.outOfReach': + '{count} gündən çox əvvəl bitmiş səfərlər arxa planda hazırlanmır. Əl ilə almaq üçün onların günlərindən birini açın.', + 'journey.prep.outOfReach.one': + '{count} gündən çox əvvəl bitmiş səfərlər arxa planda hazırlanmır. Əl ilə almaq üçün onların günlərindən birini açın.', + 'journey.prep.alreadyRunning': 'Arxa planda artıq bir alma prosesi gedir. Dayanacaqlar o bitən kimi görünəcək.', 'journey.dayImport.running': 'Bu gün hələ davam edir. Sonra qeydə alınan dayanacaqlar Dawarich-də olan kimi görünəcək.', }; diff --git a/shared/src/i18n/br/journey.ts b/shared/src/i18n/br/journey.ts index 42a8fa407..8ca4f59c3 100644 --- a/shared/src/i18n/br/journey.ts +++ b/shared/src/i18n/br/journey.ts @@ -854,6 +854,12 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Ainda não buscado.', 'journey.prep.dayProvisional': 'Buscado {time}, antes do fim do dia, podem faltar paradas.', 'journey.prep.dayFailed': 'A última atualização falhou, este é o estado anterior.', + 'journey.prep.outOfReach': + 'Viagens que terminaram há mais de {count} dias não são preparadas em segundo plano. Abra um dos dias delas para buscá-lo manualmente.', + 'journey.prep.outOfReach.one': + 'Viagens que terminaram há mais de {count} dia não são preparadas em segundo plano. Abra um dos dias delas para buscá-lo manualmente.', + 'journey.prep.alreadyRunning': + 'Já há uma busca em andamento em segundo plano. As paradas aparecem assim que ela terminar.', 'journey.dayImport.running': 'Este dia ainda está em andamento. Paradas gravadas depois aparecem assim que o Dawarich as tiver.', }; diff --git a/shared/src/i18n/ca/journey.ts b/shared/src/i18n/ca/journey.ts index dc2078fbf..860159b64 100644 --- a/shared/src/i18n/ca/journey.ts +++ b/shared/src/i18n/ca/journey.ts @@ -858,6 +858,11 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Encara no consultat.', 'journey.prep.dayProvisional': 'Consultat {time}, abans que acabés el dia, poden faltar estades.', 'journey.prep.dayFailed': "L'última actualització ha fallat, aquest és l'estat anterior.", + 'journey.prep.outOfReach': + 'Els viatges que van acabar fa més de {count} dies no es preparen en segon pla. Obre un dels seus dies per obtenir-lo a mà.', + 'journey.prep.outOfReach.one': + 'Els viatges que van acabar fa més de {count} dia no es preparen en segon pla. Obre un dels seus dies per obtenir-lo a mà.', + 'journey.prep.alreadyRunning': 'Ja hi ha una obtenció en curs en segon pla. Les estades apareixeran quan acabi.', 'journey.dayImport.running': 'Aquest dia encara no ha acabat. Les estades enregistrades més tard apareixen tan bon punt Dawarich les tingui.', }; diff --git a/shared/src/i18n/cs/journey.ts b/shared/src/i18n/cs/journey.ts index c3903d6c5..017466056 100644 --- a/shared/src/i18n/cs/journey.ts +++ b/shared/src/i18n/cs/journey.ts @@ -867,6 +867,13 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Zatím nenačteno.', 'journey.prep.dayProvisional': 'Načteno {time}, před koncem dne, některé pobyty mohou chybět.', 'journey.prep.dayFailed': 'Poslední obnovení selhalo, toto je starší stav.', + 'journey.prep.outOfReach': + 'Cesty, které skončily před více než {count} dny, se na pozadí nepřipravují. Otevři některý z jejich dnů a načti ho ručně.', + 'journey.prep.outOfReach.one': + 'Cesty, které skončily před více než {count} dnem, se na pozadí nepřipravují. Otevři některý z jejich dnů a načti ho ručně.', + 'journey.prep.outOfReach.few': + 'Cesty, které skončily před více než {count} dny, se na pozadí nepřipravují. Otevři některý z jejich dnů a načti ho ručně.', + 'journey.prep.alreadyRunning': 'Na pozadí už jedno načítání běží. Jeho zastávky se ukážou, jakmile doběhne.', 'journey.dayImport.running': 'Tento den ještě probíhá. Později zaznamenané pobyty se objeví, jakmile je Dawarich bude mít.', }; diff --git a/shared/src/i18n/de/journey.ts b/shared/src/i18n/de/journey.ts index 07215d8e3..8987c7184 100644 --- a/shared/src/i18n/de/journey.ts +++ b/shared/src/i18n/de/journey.ts @@ -862,6 +862,12 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Noch nicht abgerufen.', 'journey.prep.dayProvisional': 'Abgerufen {time}, vor Tagesende, es können Aufenthalte fehlen.', 'journey.prep.dayFailed': 'Die letzte Aktualisierung ist fehlgeschlagen, das ist der ältere Stand.', + 'journey.prep.outOfReach': + 'Reisen, die vor mehr als {count} Tagen endeten, werden nicht im Hintergrund vorbereitet. Öffne einen ihrer Tage, um ihn von Hand abzurufen.', + 'journey.prep.outOfReach.one': + 'Reisen, die vor mehr als {count} Tag endeten, werden nicht im Hintergrund vorbereitet. Öffne einen ihrer Tage, um ihn von Hand abzurufen.', + 'journey.prep.alreadyRunning': + 'Im Hintergrund läuft schon ein Abruf. Seine Aufenthalte erscheinen, sobald er durch ist.', 'journey.dayImport.running': 'Dieser Tag läuft noch. Später aufgezeichnete Aufenthalte erscheinen, sobald Dawarich sie hat.', }; diff --git a/shared/src/i18n/en/journey.ts b/shared/src/i18n/en/journey.ts index 589fdc24e..2907ebfa5 100644 --- a/shared/src/i18n/en/journey.ts +++ b/shared/src/i18n/en/journey.ts @@ -846,6 +846,11 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Not fetched yet.', 'journey.prep.dayProvisional': 'Fetched {time}, before the day ended, so stays may be missing.', 'journey.prep.dayFailed': 'The last refresh failed, this is the older state.', + 'journey.prep.outOfReach': + 'Trips that ended more than {count} days ago are not prepared in the background. Open one of their days to fetch it by hand.', + 'journey.prep.outOfReach.one': + 'Trips that ended more than {count} day ago are not prepared in the background. Open one of their days to fetch it by hand.', + 'journey.prep.alreadyRunning': 'A fetch is already running in the background. Its stays show up once it is through.', 'journey.dayImport.running': 'This day is still running. Stays recorded later show up once Dawarich has them.', }; export default journey; diff --git a/shared/src/i18n/es/journey.ts b/shared/src/i18n/es/journey.ts index 2dd899106..10096ac8a 100644 --- a/shared/src/i18n/es/journey.ts +++ b/shared/src/i18n/es/journey.ts @@ -856,6 +856,12 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Aún sin consultar.', 'journey.prep.dayProvisional': 'Consultado {time}, antes de que terminara el día, pueden faltar estancias.', 'journey.prep.dayFailed': 'La última actualización falló, este es el estado anterior.', + 'journey.prep.outOfReach': + 'Los viajes que terminaron hace más de {count} días no se preparan en segundo plano. Abre uno de sus días para obtenerlo a mano.', + 'journey.prep.outOfReach.one': + 'Los viajes que terminaron hace más de {count} día no se preparan en segundo plano. Abre uno de sus días para obtenerlo a mano.', + 'journey.prep.alreadyRunning': + 'Ya hay una obtención en curso en segundo plano. Las estancias aparecerán en cuanto termine.', 'journey.dayImport.running': 'Este día aún no ha terminado. Las estancias grabadas más tarde aparecen en cuanto Dawarich las tenga.', }; diff --git a/shared/src/i18n/et/journey.ts b/shared/src/i18n/et/journey.ts index a97fdad1d..7a8e4b39f 100644 --- a/shared/src/i18n/et/journey.ts +++ b/shared/src/i18n/et/journey.ts @@ -849,6 +849,11 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Veel laadimata.', 'journey.prep.dayProvisional': 'Laaditud {time}, enne päeva lõppu, peatusi võib puududa.', 'journey.prep.dayFailed': 'Viimane värskendus ebaõnnestus, see on vanem seis.', + 'journey.prep.outOfReach': + 'Reise, mis lõppesid üle {count} päeva tagasi, taustal ette ei valmistata. Ava mõni nende päev, et see käsitsi tuua.', + 'journey.prep.outOfReach.one': + 'Reise, mis lõppesid üle {count} päeva tagasi, taustal ette ei valmistata. Ava mõni nende päev, et see käsitsi tuua.', + 'journey.prep.alreadyRunning': 'Taustal juba käib üks toomine. Selle peatused ilmuvad, kui see on lõpetanud.', 'journey.dayImport.running': 'See päev alles kestab. Hiljem salvestatud peatused ilmuvad kohe, kui Dawarichil need on.', }; diff --git a/shared/src/i18n/fr/journey.ts b/shared/src/i18n/fr/journey.ts index 3ebf30fcb..53b9d348b 100644 --- a/shared/src/i18n/fr/journey.ts +++ b/shared/src/i18n/fr/journey.ts @@ -855,6 +855,12 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Pas encore récupéré.', 'journey.prep.dayProvisional': 'Récupéré {time}, avant la fin de la journée, des séjours peuvent manquer.', 'journey.prep.dayFailed': "La dernière actualisation a échoué, ceci est l'état précédent.", + 'journey.prep.outOfReach': + "Les voyages terminés il y a plus de {count} jours ne sont pas préparés en arrière-plan. Ouvrez l'un de leurs jours pour le récupérer à la main.", + 'journey.prep.outOfReach.one': + "Les voyages terminés il y a plus de {count} jour ne sont pas préparés en arrière-plan. Ouvrez l'un de leurs jours pour le récupérer à la main.", + 'journey.prep.alreadyRunning': + "Une récupération est déjà en cours en arrière-plan. Ses étapes apparaîtront dès qu'elle sera terminée.", 'journey.dayImport.running': "Cette journée n'est pas terminée. Les séjours enregistrés plus tard apparaissent dès que Dawarich les a.", }; diff --git a/shared/src/i18n/gr/journey.ts b/shared/src/i18n/gr/journey.ts index 12b136390..f1b268840 100644 --- a/shared/src/i18n/gr/journey.ts +++ b/shared/src/i18n/gr/journey.ts @@ -866,6 +866,11 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Δεν έχει γίνει λήψη ακόμη.', 'journey.prep.dayProvisional': 'Λήφθηκε {time}, πριν τελειώσει η μέρα, μπορεί να λείπουν στάσεις.', 'journey.prep.dayFailed': 'Η τελευταία ανανέωση απέτυχε, αυτή είναι η παλαιότερη κατάσταση.', + 'journey.prep.outOfReach': + 'Τα ταξίδια που τελείωσαν πριν από περισσότερες από {count} ημέρες δεν προετοιμάζονται στο παρασκήνιο. Άνοιξε μία από τις ημέρες τους για να τη φέρεις χειροκίνητα.', + 'journey.prep.outOfReach.one': + 'Τα ταξίδια που τελείωσαν πριν από περισσότερη από {count} ημέρα δεν προετοιμάζονται στο παρασκήνιο. Άνοιξε μία από τις ημέρες τους για να τη φέρεις χειροκίνητα.', + 'journey.prep.alreadyRunning': 'Μια λήψη τρέχει ήδη στο παρασκήνιο. Οι στάσεις της θα εμφανιστούν μόλις ολοκληρωθεί.', 'journey.dayImport.running': 'Αυτή η μέρα δεν έχει τελειώσει. Στάσεις που καταγράφονται αργότερα εμφανίζονται μόλις τις έχει το Dawarich.', }; diff --git a/shared/src/i18n/hu/journey.ts b/shared/src/i18n/hu/journey.ts index ad4f6717e..0aba763f5 100644 --- a/shared/src/i18n/hu/journey.ts +++ b/shared/src/i18n/hu/journey.ts @@ -853,6 +853,11 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Még nincs lekérve.', 'journey.prep.dayProvisional': 'Lekérve {time}, a nap vége előtt, hiányozhatnak tartózkodások.', 'journey.prep.dayFailed': 'A legutóbbi frissítés nem sikerült, ez a régebbi állapot.', + 'journey.prep.outOfReach': + 'A több mint {count} napja véget ért utak nem készülnek elő a háttérben. Nyisd meg az egyik napjukat, hogy kézzel lekérd.', + 'journey.prep.outOfReach.one': + 'A több mint {count} napja véget ért utak nem készülnek elő a háttérben. Nyisd meg az egyik napjukat, hogy kézzel lekérd.', + 'journey.prep.alreadyRunning': 'A háttérben már fut egy lekérés. A megállói megjelennek, amint végzett.', 'journey.dayImport.running': 'Ez a nap még tart. A később rögzített tartózkodások megjelennek, amint a Dawarich megkapja őket.', }; diff --git a/shared/src/i18n/id/journey.ts b/shared/src/i18n/id/journey.ts index 3d304b231..3eb1d564d 100644 --- a/shared/src/i18n/id/journey.ts +++ b/shared/src/i18n/id/journey.ts @@ -832,6 +832,9 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Belum diambil.', 'journey.prep.dayProvisional': 'Diambil {time}, sebelum hari berakhir, beberapa persinggahan mungkin belum ada.', 'journey.prep.dayFailed': 'Penyegaran terakhir gagal, ini keadaan yang lebih lama.', + 'journey.prep.outOfReach': + 'Perjalanan yang berakhir lebih dari {count} hari lalu tidak disiapkan di latar belakang. Buka salah satu harinya untuk mengambilnya secara manual.', + 'journey.prep.alreadyRunning': 'Pengambilan sudah berjalan di latar belakang. Persinggahannya muncul begitu selesai.', 'journey.dayImport.running': 'Hari ini masih berlangsung. Persinggahan yang terekam kemudian muncul begitu Dawarich memilikinya.', }; diff --git a/shared/src/i18n/it/journey.ts b/shared/src/i18n/it/journey.ts index f292dc383..3d9d5c015 100644 --- a/shared/src/i18n/it/journey.ts +++ b/shared/src/i18n/it/journey.ts @@ -857,6 +857,11 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Non ancora recuperato.', 'journey.prep.dayProvisional': 'Recuperato {time}, prima della fine della giornata, possono mancare soste.', 'journey.prep.dayFailed': "L'ultimo aggiornamento non è riuscito, questo è lo stato precedente.", + 'journey.prep.outOfReach': + 'I viaggi terminati più di {count} giorni fa non vengono preparati in background. Apri uno dei loro giorni per recuperarlo a mano.', + 'journey.prep.outOfReach.one': + 'I viaggi terminati più di {count} giorno fa non vengono preparati in background. Apri uno dei loro giorni per recuperarlo a mano.', + 'journey.prep.alreadyRunning': 'Un recupero è già in corso in background. Le soste compariranno appena sarà finito.', 'journey.dayImport.running': 'Questa giornata è ancora in corso. Le soste registrate dopo compaiono appena Dawarich le ha.', }; diff --git a/shared/src/i18n/ja/journey.ts b/shared/src/i18n/ja/journey.ts index 42918421b..23a7cb25a 100644 --- a/shared/src/i18n/ja/journey.ts +++ b/shared/src/i18n/ja/journey.ts @@ -819,6 +819,9 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'まだ取得していません。', 'journey.prep.dayProvisional': '{time} に取得、一日が終わる前なので滞在先が欠けている可能性があります。', 'journey.prep.dayFailed': '前回の更新に失敗しました。これは古い状態です。', + 'journey.prep.outOfReach': + '{count} 日以上前に終わった旅行はバックグラウンドで準備されません。その日を開くと手動で取得できます。', + 'journey.prep.alreadyRunning': 'バックグラウンドで取得がすでに実行中です。終わり次第、滞在先が表示されます。', 'journey.dayImport.running': 'この日はまだ続いています。後から記録された滞在先は Dawarich に届き次第表示されます。', }; export default journey; diff --git a/shared/src/i18n/ko/journey.ts b/shared/src/i18n/ko/journey.ts index f6d120d0a..5d60cb7c3 100644 --- a/shared/src/i18n/ko/journey.ts +++ b/shared/src/i18n/ko/journey.ts @@ -816,6 +816,9 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': '아직 가져오지 않았습니다.', 'journey.prep.dayProvisional': '{time}에 가져옴, 하루가 끝나기 전이라 머문 곳이 빠졌을 수 있습니다.', 'journey.prep.dayFailed': '마지막 새로 고침에 실패했습니다. 이전 상태입니다.', + 'journey.prep.outOfReach': + '{count}일 이상 전에 끝난 여행은 백그라운드에서 준비되지 않습니다. 해당 날짜를 열어 직접 가져오세요.', + 'journey.prep.alreadyRunning': '백그라운드에서 이미 가져오는 중입니다. 끝나는 대로 머문 곳이 표시됩니다.', 'journey.dayImport.running': '아직 진행 중인 날입니다. 나중에 기록된 머문 곳은 Dawarich에 들어오는 대로 표시됩니다.', }; export default journey; diff --git a/shared/src/i18n/nl/journey.ts b/shared/src/i18n/nl/journey.ts index 5926a0fc5..2a64157a6 100644 --- a/shared/src/i18n/nl/journey.ts +++ b/shared/src/i18n/nl/journey.ts @@ -858,6 +858,12 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Nog niet opgehaald.', 'journey.prep.dayProvisional': 'Opgehaald {time}, voor het einde van de dag, er kunnen verblijven ontbreken.', 'journey.prep.dayFailed': 'De laatste verversing is mislukt, dit is de oudere stand.', + 'journey.prep.outOfReach': + 'Reizen die meer dan {count} dagen geleden eindigden, worden niet op de achtergrond voorbereid. Open een van hun dagen om die met de hand op te halen.', + 'journey.prep.outOfReach.one': + 'Reizen die meer dan {count} dag geleden eindigden, worden niet op de achtergrond voorbereid. Open een van hun dagen om die met de hand op te halen.', + 'journey.prep.alreadyRunning': + 'Er loopt al een ophaalactie op de achtergrond. De verblijven verschijnen zodra die klaar is.', 'journey.dayImport.running': 'Deze dag loopt nog. Later opgenomen verblijven verschijnen zodra Dawarich ze heeft.', }; export default journey; diff --git a/shared/src/i18n/pl/journey.ts b/shared/src/i18n/pl/journey.ts index ba50945b7..ca5583800 100644 --- a/shared/src/i18n/pl/journey.ts +++ b/shared/src/i18n/pl/journey.ts @@ -896,6 +896,15 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Jeszcze nie pobrano.', 'journey.prep.dayProvisional': 'Pobrano {time}, przed końcem dnia, może brakować postojów.', 'journey.prep.dayFailed': 'Ostatnie odświeżenie nie powiodło się, to starszy stan.', + 'journey.prep.outOfReach': + 'Podróże zakończone ponad {count} dnia temu nie są przygotowywane w tle. Otwórz jeden z ich dni, aby pobrać go ręcznie.', + 'journey.prep.outOfReach.one': + 'Podróże zakończone ponad {count} dzień temu nie są przygotowywane w tle. Otwórz jeden z ich dni, aby pobrać go ręcznie.', + 'journey.prep.outOfReach.few': + 'Podróże zakończone ponad {count} dni temu nie są przygotowywane w tle. Otwórz jeden z ich dni, aby pobrać go ręcznie.', + 'journey.prep.outOfReach.many': + 'Podróże zakończone ponad {count} dni temu nie są przygotowywane w tle. Otwórz jeden z ich dni, aby pobrać go ręcznie.', + 'journey.prep.alreadyRunning': 'W tle trwa już pobieranie. Postoje pojawią się, gdy się zakończy.', 'journey.dayImport.running': 'Ten dzień jeszcze trwa. Postoje zarejestrowane później pojawią się, gdy tylko Dawarich je będzie mieć.', }; diff --git a/shared/src/i18n/ru/journey.ts b/shared/src/i18n/ru/journey.ts index 1497d044f..4da7d8380 100644 --- a/shared/src/i18n/ru/journey.ts +++ b/shared/src/i18n/ru/journey.ts @@ -895,6 +895,15 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Ещё не загружено.', 'journey.prep.dayProvisional': 'Загружено {time}, до конца дня, часть остановок может отсутствовать.', 'journey.prep.dayFailed': 'Последнее обновление не удалось, это более старое состояние.', + 'journey.prep.outOfReach': + 'Поездки, закончившиеся более {count} дня назад, не готовятся в фоне. Откройте один из их дней, чтобы загрузить его вручную.', + 'journey.prep.outOfReach.one': + 'Поездки, закончившиеся более {count} дня назад, не готовятся в фоне. Откройте один из их дней, чтобы загрузить его вручную.', + 'journey.prep.outOfReach.few': + 'Поездки, закончившиеся более {count} дней назад, не готовятся в фоне. Откройте один из их дней, чтобы загрузить его вручную.', + 'journey.prep.outOfReach.many': + 'Поездки, закончившиеся более {count} дней назад, не готовятся в фоне. Откройте один из их дней, чтобы загрузить его вручную.', + 'journey.prep.alreadyRunning': 'В фоне уже идёт загрузка. Остановки появятся, как только она завершится.', 'journey.dayImport.running': 'Этот день ещё идёт. Остановки, записанные позже, появятся, как только они будут у Dawarich.', }; diff --git a/shared/src/i18n/sk/journey.ts b/shared/src/i18n/sk/journey.ts index 801f57f5c..2229fef18 100644 --- a/shared/src/i18n/sk/journey.ts +++ b/shared/src/i18n/sk/journey.ts @@ -873,6 +873,13 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Zatiaľ nenačítané.', 'journey.prep.dayProvisional': 'Načítané {time}, pred koncom dňa, niektoré pobyty môžu chýbať.', 'journey.prep.dayFailed': 'Posledná aktualizácia zlyhala, toto je starší stav.', + 'journey.prep.outOfReach': + 'Cesty, ktoré sa skončili pred viac ako {count} dňami, sa na pozadí nepripravujú. Otvor niektorý z ich dní a načítaj ho ručne.', + 'journey.prep.outOfReach.one': + 'Cesty, ktoré sa skončili pred viac ako {count} dňom, sa na pozadí nepripravujú. Otvor niektorý z ich dní a načítaj ho ručne.', + 'journey.prep.outOfReach.few': + 'Cesty, ktoré sa skončili pred viac ako {count} dňami, sa na pozadí nepripravujú. Otvor niektorý z ich dní a načítaj ho ručne.', + 'journey.prep.alreadyRunning': 'Na pozadí už jedno načítanie beží. Jeho zastávky sa zobrazia, hneď ako dobehne.', 'journey.dayImport.running': 'Tento deň ešte prebieha. Neskôr zaznamenané pobyty sa objavia, hneď ako ich Dawarich bude mať.', }; diff --git a/shared/src/i18n/sv/journey.ts b/shared/src/i18n/sv/journey.ts index 24b9c1585..8b6aca84b 100644 --- a/shared/src/i18n/sv/journey.ts +++ b/shared/src/i18n/sv/journey.ts @@ -849,6 +849,11 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Inte hämtat än.', 'journey.prep.dayProvisional': 'Hämtat {time}, innan dagen var slut, vistelser kan saknas.', 'journey.prep.dayFailed': 'Senaste uppdateringen misslyckades, detta är det äldre läget.', + 'journey.prep.outOfReach': + 'Resor som slutade för mer än {count} dagar sedan förbereds inte i bakgrunden. Öppna en av deras dagar för att hämta den för hand.', + 'journey.prep.outOfReach.one': + 'Resor som slutade för mer än {count} dag sedan förbereds inte i bakgrunden. Öppna en av deras dagar för att hämta den för hand.', + 'journey.prep.alreadyRunning': 'En hämtning pågår redan i bakgrunden. Vistelserna visas så snart den är klar.', 'journey.dayImport.running': 'Den här dagen pågår fortfarande. Vistelser som spelas in senare visas så snart Dawarich har dem.', }; diff --git a/shared/src/i18n/th/journey.ts b/shared/src/i18n/th/journey.ts index d4417e6f8..8db071d5b 100644 --- a/shared/src/i18n/th/journey.ts +++ b/shared/src/i18n/th/journey.ts @@ -809,6 +809,9 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'ยังไม่ได้ดึงข้อมูล', 'journey.prep.dayProvisional': 'ดึงเมื่อ {time} ก่อนสิ้นวัน อาจมีจุดแวะพักขาดหาย', 'journey.prep.dayFailed': 'การรีเฟรชล่าสุดล้มเหลว นี่คือสถานะเก่ากว่า', + 'journey.prep.outOfReach': + 'ทริปที่จบไปนานกว่า {count} วันจะไม่ถูกเตรียมเบื้องหลัง เปิดวันใดวันหนึ่งของทริปเพื่อดึงข้อมูลด้วยตนเอง', + 'journey.prep.alreadyRunning': 'มีการดึงข้อมูลทำงานอยู่เบื้องหลังแล้ว จุดแวะพักจะปรากฏเมื่อเสร็จ', 'journey.dayImport.running': 'วันนี้ยังไม่จบ จุดแวะพักที่บันทึกภายหลังจะปรากฏเมื่อ Dawarich ได้รับแล้ว', }; export default journey; diff --git a/shared/src/i18n/tr/journey.ts b/shared/src/i18n/tr/journey.ts index 47cd44de2..f01360d37 100644 --- a/shared/src/i18n/tr/journey.ts +++ b/shared/src/i18n/tr/journey.ts @@ -848,6 +848,11 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Henüz alınmadı.', 'journey.prep.dayProvisional': '{time} alındı, gün bitmeden, eksik duraklar olabilir.', 'journey.prep.dayFailed': 'Son yenileme başarısız oldu, bu daha eski durum.', + 'journey.prep.outOfReach': + '{count} günden daha önce biten geziler arka planda hazırlanmaz. Elle almak için günlerinden birini açın.', + 'journey.prep.outOfReach.one': + '{count} günden daha önce biten geziler arka planda hazırlanmaz. Elle almak için günlerinden birini açın.', + 'journey.prep.alreadyRunning': 'Arka planda zaten bir alma işlemi sürüyor. Duraklar o bitince görünür.', 'journey.dayImport.running': 'Bu gün hâlâ sürüyor. Daha sonra kaydedilen duraklar Dawarich onları aldığında görünür.', }; export default journey; diff --git a/shared/src/i18n/uk/journey.ts b/shared/src/i18n/uk/journey.ts index 8c62d0268..c6ef5e31f 100644 --- a/shared/src/i18n/uk/journey.ts +++ b/shared/src/i18n/uk/journey.ts @@ -902,6 +902,15 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Ще не завантажено.', 'journey.prep.dayProvisional': 'Завантажено {time}, до кінця дня, частини зупинок може бракувати.', 'journey.prep.dayFailed': 'Останнє оновлення не вдалося, це старіший стан.', + 'journey.prep.outOfReach': + 'Подорожі, що закінчилися понад {count} дня тому, не готуються у фоні. Відкрийте один із їхніх днів, щоб завантажити його вручну.', + 'journey.prep.outOfReach.one': + 'Подорожі, що закінчилися понад {count} день тому, не готуються у фоні. Відкрийте один із їхніх днів, щоб завантажити його вручну.', + 'journey.prep.outOfReach.few': + 'Подорожі, що закінчилися понад {count} дні тому, не готуються у фоні. Відкрийте один із їхніх днів, щоб завантажити його вручну.', + 'journey.prep.outOfReach.many': + 'Подорожі, що закінчилися понад {count} днів тому, не готуються у фоні. Відкрийте один із їхніх днів, щоб завантажити його вручну.', + 'journey.prep.alreadyRunning': "У фоні вже триває завантаження. Зупинки з'являться, щойно воно завершиться.", 'journey.dayImport.running': "Цей день ще триває. Зупинки, записані пізніше, з'являться, щойно вони будуть у Dawarich.", }; diff --git a/shared/src/i18n/vi/journey.ts b/shared/src/i18n/vi/journey.ts index 97008f6ce..368b3a383 100644 --- a/shared/src/i18n/vi/journey.ts +++ b/shared/src/i18n/vi/journey.ts @@ -828,6 +828,9 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': 'Chưa lấy.', 'journey.prep.dayProvisional': 'Đã lấy {time}, trước khi ngày kết thúc, có thể thiếu điểm dừng.', 'journey.prep.dayFailed': 'Lần làm mới gần nhất thất bại, đây là trạng thái cũ hơn.', + 'journey.prep.outOfReach': + 'Các chuyến đi kết thúc hơn {count} ngày trước không được chuẩn bị ở nền. Mở một ngày của chuyến để lấy thủ công.', + 'journey.prep.alreadyRunning': 'Đang có một lượt lấy dữ liệu chạy ở nền. Các điểm dừng sẽ hiện khi nó xong.', 'journey.dayImport.running': 'Ngày này vẫn đang diễn ra. Các điểm dừng ghi sau sẽ hiện khi Dawarich có chúng.', }; export default journey; diff --git a/shared/src/i18n/zh-TW/journey.ts b/shared/src/i18n/zh-TW/journey.ts index 30294782e..778490ed3 100644 --- a/shared/src/i18n/zh-TW/journey.ts +++ b/shared/src/i18n/zh-TW/journey.ts @@ -799,6 +799,8 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': '尚未取得。', 'journey.prep.dayProvisional': '於 {time} 取得,當時這一天還沒結束,可能缺少停留點。', 'journey.prep.dayFailed': '上次重新整理失敗,這是較早的狀態。', + 'journey.prep.outOfReach': '結束超過 {count} 天的旅行不會在背景準備。開啟其中某一天即可手動取得。', + 'journey.prep.alreadyRunning': '背景已有一次取得正在進行。完成後停留點就會顯示。', 'journey.dayImport.running': '這一天還沒結束。之後記錄的停留點會在 Dawarich 收到後顯示。', }; export default journey; diff --git a/shared/src/i18n/zh/journey.ts b/shared/src/i18n/zh/journey.ts index d704982a5..96ffc757d 100644 --- a/shared/src/i18n/zh/journey.ts +++ b/shared/src/i18n/zh/journey.ts @@ -799,6 +799,8 @@ const journey: TranslationStrings = { 'journey.prep.dayPending': '尚未获取。', 'journey.prep.dayProvisional': '于 {time} 获取,当时这一天还没结束,可能缺少停留点。', 'journey.prep.dayFailed': '上次刷新失败,这是较早的状态。', + 'journey.prep.outOfReach': '结束超过 {count} 天的旅行不会在后台准备。打开其中某一天即可手动获取。', + 'journey.prep.alreadyRunning': '后台已有一次获取正在进行。完成后停留点就会显示。', 'journey.dayImport.running': '这一天还没结束。之后记录的停留点会在 Dawarich 收到后显示。', }; export default journey; diff --git a/shared/src/journey/journey-recording-prep.schema.spec.ts b/shared/src/journey/journey-recording-prep.schema.spec.ts index 7c5d05b95..a4c304cec 100644 --- a/shared/src/journey/journey-recording-prep.schema.spec.ts +++ b/shared/src/journey/journey-recording-prep.schema.spec.ts @@ -31,6 +31,15 @@ describe('journeyRecordingPrepSchema', () => { const { lastSuccessAt: _dropped, ...withoutSuccess } = PREP; expect(journeyRecordingPrepSchema.safeParse(withoutSuccess).success).toBe(false); }); + + it('JRNPREP-SCHEMA-003: the periods it reaches are optional, an open trip has no end', () => { + const periods = [ + { start: '2026-05-10', end: '2026-05-14' }, + { start: '2026-06-01', end: null }, + ]; + expect(journeyRecordingPrepSchema.parse({ ...PREP, periods }).periods).toEqual(periods); + expect(journeyRecordingPrepSchema.safeParse({ ...PREP, periods: [{ start: '2026-05-10' }] }).success).toBe(false); + }); }); describe('the journey switch', () => { diff --git a/shared/src/journey/journey-recording-prep.schema.ts b/shared/src/journey/journey-recording-prep.schema.ts index a171b7a94..060172720 100644 --- a/shared/src/journey/journey-recording-prep.schema.ts +++ b/shared/src/journey/journey-recording-prep.schema.ts @@ -13,6 +13,19 @@ import { z } from 'zod'; /** Whether the caller's own Dawarich can prepare anything: connected with its background sync on, with it off, or not connected. */ export const JOURNEY_RECORDING_PREP_CONNECTIONS = ['ready', 'sync_off', 'not_connected'] as const; +/** + * How many days after its end a linked trip is still prepared: the reach of + * the trip sync it rides on (`TripsRepository.listTripsToSync`), so a journey + * never reaches further back. Older trips are read by hand only. + */ +export const JOURNEY_RECORDING_PREP_REACH_DAYS = 400; + +/** A linked trip the caller's runs reach; `end` is null for a trip still open. */ +export const journeyRecordingPrepPeriodSchema = z.object({ + start: z.string(), + end: z.string().nullable(), +}); + /** GET /api/journeys/:id/recordings/prep */ export const journeyRecordingPrepSchema = z.object({ /** The journey's switch, `auto_prepare_recordings`. */ @@ -24,5 +37,11 @@ export const journeyRecordingPrepSchema = z.object({ lastSuccessAt: z.string().nullable(), /** Dawarich's reason (a DAWARICH_ERROR_CODES code) when the last run failed; null when it came through. */ lastError: z.string().nullable(), + /** + * The linked trips the caller's runs reach, so a day outside them is never + * shown as prepared. Omitted while the switch is off. + */ + periods: z.array(journeyRecordingPrepPeriodSchema).optional(), }); export type JourneyRecordingPrep = z.infer; +export type JourneyRecordingPrepPeriod = z.infer;