BEJ-103: admin trial event and result creation - #340
Draft
asku1990 wants to merge 29 commits into
Draft
Conversation
ref bej-103
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Implement BEJ-103 Gate E1 with a stable full-page
workspace for an
existing trial event at /admin/trials/[trialEventId].
- reuse the existing event summary, result list, edit
dialogs, PDF action,
and result deletion
- add loading, not-found, generic error, and retry
states
- link the selected event to its workspace with
centralized route helpers
- preserve the current final-result deletion lifecycle
- add Finnish and Swedish translations and focused
tests
- update trial-management documentation and the
changelog
Refs: BEJ-103
heading wrapper Remove an unnecessary layout wrapper around the trial event workspace heading without changing its appearance or behaviour. ref bej-103
Implement BEJ-103 Gate E2 with full-page trial event creation
and explicit management of empty events.
- add contracts, Server Actions, mutations, and persistence use cases
for creating and deleting trial events
- require a positive SKL event ID, date, and place during creation
- default new events to the current Helsinki business date
- resolve active rule windows through the shared DB repository
- preserve an event when its final result is deleted
- allow explicit deletion only for events without results
- add localized confirmation and toast feedback for event deletion
- reuse event form fields without changing existing edit behavior
- retain empty events in admin views while excluding them publicly
- add focused web, server, DB, and integration coverage
- update trial-management documentation and the changelog
Refs: BEJ-103
…lifecycle feat(admin-trials): add event creation and empty-event lifecycle
ref bej-103
ref bej-103
- add contracts, server action, service, and atomic persistence for
manual trial entries
- share normalized entry validation between create and update flows
- reject duplicate registrations, lisätieto rows, and per-era
lisätieto values
- link manually created results to known dog registrations
- allow API upserts to replace matching manual results authoritatively
- store trial event dates as PostgreSQL DATE values
- add MANUAL_ADMIN trial source tagging and update trial documentation
- cover creation, validation, identity, date-only, and API overwrite
behavior
ref bej-103
…t-backend BEJ-103 R1: manual trial entry backend foundation
Add the full-page result creation route with reusable entry, era, and lisätieto sections. Support saving another result or returning to the event workspace, prefill event judge details, and protect unsaved form changes during navigation and page unload. Route newly created events directly to their first result form and invalidate affected admin, trial, dog-profile, and statistics queries after successful creation. Return safe structured validation details, identify rejected lisätieto rows, persist integer row ordering, and omit unused rows from create requests. Add Finnish and Swedish messages, workflow tests, feature documentation, and the follow-up plan for rule-window-aware result fields. ref bej-103
Remove the unreliable browser Back recovery based on asynchronous history.forward() and history.back() calls. Keep confirmation for explicit internal navigation and native unload protection for refresh or tab close. Ignore modified and new-tab link clicks, ensure confirmed actions run only once, and add focused tests and documentation for the intentionally unguarded browser Back behavior. ref BEJ-103
Validate trial entry integer fields against PostgreSQL Int bounds before payload construction so oversized values cannot be silently saved as null. Cover create and edit flows with boundary, overflow, and long-input tests. ref BEJ-103
feat(admin-trials): add event-scoped manual result entry workflow
ref bej-103
Resolve the manual result-create field set from the trial event’s
persisted
rule window.
- add trialRuleWindowId to admin event details
- configure and verify the current 2023+ score, era, and lisätieto
fields
- hide obsolete tja and pin score fields for current rules
- use Ajotaito for the current rule period
- align lisätieto codes, parts, input types, and marker persistence
with the PDF
- retain a warned legacy fallback for older and unknown rule windows
- preserve existing result-edit behavior
ref bej-103
…creation feat(trials): make result creation rule-window aware
Organize manual result creation into collapsible cards following the
official trial PDF domain structure without copying its matrix layout.
Add a searchable, grouped Lisätiedot workspace with responsive desktop
and mobile editors, accessible focus handling, localized controls, and
stable reset behavior. Keep R3A field visibility, draft ownership,
serialization, validation, mutations, navigation protection, and
editing
behavior unchanged.
Files:
- CHANGELOG.md
-
apps/web/components/admin/trials/admin-trial-entry-create-page-client.tsx
-
apps/web/components/admin/trials/internal/__tests__/entry-meta-section.test.tsx
-
apps/web/components/admin/trials/internal/__tests__/era-section.test.tsx
-
apps/web/components/admin/trials/internal/__tests__/result-create-card.test.tsx
-
apps/web/components/admin/trials/internal/entry-meta-basic-fields.tsx
- apps/web/components/admin/trials/internal/entry-meta-field.tsx
-
apps/web/components/admin/trials/internal/entry-meta-judge-fields.tsx
- apps/web/components/admin/trials/internal/entry-meta-loss-fields.tsx
-
apps/web/components/admin/trials/internal/entry-meta-result-fields.tsx
-
apps/web/components/admin/trials/internal/entry-meta-score-fields.tsx
- apps/web/components/admin/trials/internal/entry-meta-section.tsx
- apps/web/components/admin/trials/internal/era-section.tsx
- apps/web/components/admin/trials/internal/lisatiedot-workspace.tsx
- apps/web/components/admin/trials/internal/result-create-card.tsx
- apps/web/components/ui/sheet.tsx
-
apps/web/hooks/admin/trials/manage/__tests__/use-result-create-workspace-mobile.test.ts
-
apps/web/hooks/admin/trials/manage/use-result-create-workspace-mobile.ts
-
apps/web/lib/admin/trials/__tests__/lisatiedot-workspace-state.test.ts
-
apps/web/lib/admin/trials/__tests__/result-create-field-registry.test.ts
- apps/web/lib/admin/trials/entry-edit-config.ts
- apps/web/lib/admin/trials/lisatiedot-workspace-state.ts
- apps/web/lib/admin/trials/result-create-field-registry.ts
- apps/web/lib/i18n/messages/admin/trials/manage.ts
- docs/features/admin-trial-management.md
Ref BEJ-103
Remove unfinished Lisätiedot search, filtering, bulk expansion controls, and selected-row chips. Keep PDF-domain groups individually collapsible with shared desktop/mobile row activation and draft ownership. Update reducer tests, accessibility labels, translations, and admin trial documentation to reflect the simpler workflow. Validation already run successfully: focused tests, web typecheck, targeted ESLint, and git diff --check.
Remove the unreachable reducer reset action and its test. Add rendered workspace coverage for PDF-domain ordering, collapsible groups, active-row editor rendering, and accessible remove labels. Align the changelog, UX planning documentation, and PR description with the simplified Lisätiedot workflow. ref bej-103
…on-ux feat(trials): redesign result creation workspace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ref bej-103
Summary
Integration pull request for the staged BEJ-103 implementation of admin trial event and manual result creation.
Each implementation gate is developed and reviewed in its own branch and pull request targeting this integration branch. Approved gates are merged here, and this pull request will be merged into
developonly after the complete BEJ-103 workflow is finished and validated.Implemented gates
E1 — Event workspace
/admin/trials/[trialEventId]route.E2 — Event creation and empty-event lifecycle
R1 — Manual result backend foundation
TrialEntry,TrialEra, andTrialEraLisatietorows atomically.DogRegistrationwhen a matching dog exists while allowing unknown registrations to remain unlinked.SKL:<sklKoeId>|REG:<canonicalRegistration>MANUAL_ADMINas a canonical trial source.DATEsemantics and serialize them as timezone-freeYYYY-MM-DDvalues.Remaining gate
R2 — Manual result UI and workflow
R2 will add the full-page result creation form and connect it to the approved R1 backend contract, including:
Migration note
This branch updates existing Prisma migration files to reflect the intended final schema, including the trial source enum and PostgreSQL
DATEstorage for trial event dates.There is currently no production data or deployed production migration history that must be preserved, so these migration edits are intentional and do not require corrective forward migrations.
Validation
The staged implementation includes focused coverage for:
Each gate must pass lint, typecheck, tests, coverage checks, and review before being merged into this integration branch.
Checklist
develop.