Skip to content

Added 'Works by Decade Published' chart to reading log stats#12822

Merged
cdrini merged 9 commits into
internetarchive:masterfrom
Saad259:add-reading-stats-by-decade
Jun 3, 2026
Merged

Added 'Works by Decade Published' chart to reading log stats#12822
cdrini merged 9 commits into
internetarchive:masterfrom
Saad259:add-reading-stats-by-decade

Conversation

@Saad259

@Saad259 Saad259 commented May 30, 2026

Copy link
Copy Markdown
Contributor

Closes #12805

Technical

Adds a "Works by Decade Published" chart to the reading log stats page. A new decade-chart type is introduced in readinglog_stats.js that preprocesses each work's first_publish_year into a decade string (e.g. 1987 → 1980s) before passing it to the existing createWorkChart function. Works with no first_publish_year are handled gracefully via the existing excluded works behaviour. A corresponding chart entry is added to the Work Stats section in readinglog_stats.html.

Testing

  1. Ensure several books with varying publication years are added to 'Already Read'
  2. Navigate to https://openlibrary.org/people/{username}/books/already-read/stats
  3. Scroll to the Work Stats section
  4. Verify that the "Works by Decade Published" chart appears as expected.

Screenshot

Screenshot 2026-05-30 151332

Stakeholders

@cdrini

@mekarpeles

Copy link
Copy Markdown
Member

Thanks for the contribution!

🤖 Copilot has been assigned for an initial review.

@cdrini is assigned to this PR and currently has:

  • 6 open PR(s) of equal or higher priority to review first
PR triage checklist (maintainers / Pam)
  • PR description — not empty; explains what the change does and how to verify it
  • References an issue — PR body contains a #NNN reference
    • Linked issue is triaged — has a Priority: * label (not just Needs: Triage)
    • Linked issue is assigned — has at least one assignee
  • Commit history clean — no WIP/fixup/conflict noise; commit messages are meaningful
  • CI passing — no failing check-runs
  • Test cases present — if the change touches substantive logic, test coverage exists or is explained
  • Proof of testing — PR body includes a description of what was tested, a screenshot, or a video

Note

This comment was automatically generated by Pam, Open Library's Project AI Manager, on behalf of @mekarpeles. Pam is designed to provide status visibility, perform basic project management functions and relevant codebase research, and provide actionable feedback so contributors aren't left waiting.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new “Works by Decade Published” chart to reading log stats, using existing work publication-year data and the existing chart rendering flow.

Changes:

  • Adds a decade-chart branch that derives decade labels from first_publish_year.
  • Adds the new decade chart to the Work Stats section.
  • Extends work typing metadata for publication year/decade data.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
openlibrary/plugins/openlibrary/js/readinglog_stats.js Computes decade buckets and renders them through the existing work chart path.
openlibrary/templates/account/readinglog_stats.html Adds the new chart configuration to the Work Stats charts list.

Comment thread openlibrary/plugins/openlibrary/js/readinglog_stats.js Outdated
Comment thread openlibrary/plugins/openlibrary/js/readinglog_stats.js Outdated

@cdrini cdrini left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Niiiice working swimmingly!

Image

Hmmm could you add another graph for "Century published"? Books from the last 2 centuries will likely dominate this graph, but it would be interesting to also see data from the others!

Comment thread openlibrary/templates/account/readinglog_stats.html Outdated
Comment thread openlibrary/plugins/openlibrary/js/readinglog_stats.js Outdated
Comment thread openlibrary/plugins/openlibrary/js/readinglog_stats.js
Comment thread openlibrary/plugins/openlibrary/js/readinglog_stats.js Outdated
Comment thread openlibrary/templates/account/readinglog_stats.html Outdated
@cdrini cdrini added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Jun 1, 2026
@github-actions github-actions Bot removed the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Jun 3, 2026
@Saad259

Saad259 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author
Screenshot 2026-06-03 211413 @cdrini Looking good?

@cdrini cdrini left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Wooohoooo looks great! I moved the first published graphs to the top, and tested on testing and works like a charm!

Image

@cdrini cdrini merged commit dde46f6 into internetarchive:master Jun 3, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add reading stats graph for work published year

4 participants