Correct date field component labels in batch edit headers#7925
Open
foozleface wants to merge 1 commit intospecify:mainfrom
Open
Correct date field component labels in batch edit headers#7925foozleface wants to merge 1 commit intospecify:mainfrom
foozleface wants to merge 1 commit intospecify:mainfrom
Conversation
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.
Fixes #6808
Contributed by @foozleface
Batch edit column headers for date fields show wrong component labels. When multiple date components of the same field are present (e.g. catalogedDate Full Date, Day, Month, Year), all columns get the same label because the localization lookup key is just the base field name, so each component consumes labels in insertion order rather than matching by date part.
Implementation
_get_date_part_field_name()which returns a distinct key per date component (e.g.catalogedDate__Full Date,catalogedDate__Day) for localization lookups.RowPlanCanonical._create_row_plan()andrun_batch_edit_query()to use the date-part-aware key instead of the bare field name when looking up and registering field labels.naive_field_format()to append the date part suffix (e.g. "(Day)", "(Month)", "(Year)") for non-"Full Date" components.apply_absolute_date()forquery_field.valuebeingNone.generateMappingPathPreviewto verify date component labels.naive_field_format,_get_date_part_field_name, and end-to-end batch edit header generation with and without captions.Testing instructions
python manage.py test specifyweb.backend.stored_queries.tests.test_batch_editnpx jest --testPathPattern=mappingPreview