Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Display correct author dates when birth/death years contain non-numeric characters #10420

Conversation

SharkyBytes
Copy link
Contributor

Closes #10352

Fix: Display correct author dates when birth/death years contain non-numeric characters

Technical

-> Updated the extract_year method in helpers.py to handle non-numeric characters in birth/death dates.
-> Modified the BookByline.html template to ensure proper display of dates, even when non-numeric characters (e.g., "19xx") are present.
-> Added an optional int_only parameter to the extract_year method to avoid breaking changes in other parts of the codebase.

Testing

-> Verify that the author's dates are displayed correctly without empty brackets.
-> Run the test suite to ensure no regressions:

Screenshot

What I changed -:
image

Stakeholders

@cdrini

Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work @SharkyBytes ! A few pieces of feedback to make the logic a little clearer 👍

openlibrary/core/helpers.py Show resolved Hide resolved
openlibrary/core/helpers.py Outdated Show resolved Hide resolved
openlibrary/core/helpers.py Show resolved Hide resolved
openlibrary/macros/BookByline.html Outdated Show resolved Hide resolved
openlibrary/macros/BookByline.html Outdated Show resolved Hide resolved
@cdrini cdrini added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Feb 5, 2025
@SharkyBytes SharkyBytes force-pushed the 10352/fix/empty-brackets-after-author-name-v3 branch from 71e8994 to 77636cd Compare February 9, 2025 08:55
@github-actions github-actions bot removed the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Feb 9, 2025
@SharkyBytes SharkyBytes requested a review from cdrini February 9, 2025 19:00
@SharkyBytes
Copy link
Contributor Author

Hi @cdrini,
Just checking in— is there anything else I need to work on, or are you satisfied with the resolved changes? If any further adjustments are needed, please let me know, and I'll be happy to address them.

@github-actions github-actions bot added the Needs: Response Issues which require feedback from lead label Feb 13, 2025
Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Made one small change to take advantage of the default return of extract_year being '', and tested on testing.openlibrary.org :

✅ Only has birth + inexact; has no birth or death year (eg)
image

✅ Has both birth/death (eg)

@cdrini cdrini merged commit b3a7779 into internetarchive:master Feb 18, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Response Issues which require feedback from lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Librarian-only: Empty brackets after author name
2 participants