Repository navigation
fix: complete a parent's count when it covers only its own posts - #199
Merged
Merged
Conversation
- a parent category read 9 over sub-categories holding 359 and opened a page of 368: Tistory had written its direct count, and with the rail folded that was the only number on screen - add `rollUpCount` to category.ts, which compares each parent with the sum of the rows beneath it, bottom-up - complete a parent only when it is below that sum, since a total cannot be smaller than its parts; at or above it, leave it as Tistory wrote it - adding the two for every parent was the first attempt and is wrong: Projects, 10 over 0+5+5, came out as 20 - leave the "all posts" row alone and skip any branch with an unreadable count rather than print a sum with a hole in it - a direct count that reaches its children's sum is still indistinguishable from a total and is not corrected - no setting, template or stylesheet changes
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Merged
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.
Summary
A parent category whose count covers only its own posts is completed with the posts under its sub-categories, so the number matches the page it opens. Parents Tistory already totals are left as written.
Why
Closes #198
Engineeringread 9 in the sidebar and/category/Engineeringlists 368. Tistory had written the category's direct count (9), the page lists the category and everything beneath it, and with the rail folded, which is how it starts, that 9 was the only number on screen.My first hypothesis was wrong, and it is the reason this is not a one-line sum. I read it as "Tistory counts a parent's own posts only" and added the two together for every parent. That is wrong for the blog it was meant for:
Projectsreads 10 over 0+5+5 and has no posts of its own, so the sum made it 20. Four of the five parents on this blog read exactly the sum of their children. Surveying other blogs, Tistory usually does roll a parent up:Below is impossible for a total, so those three are direct counts: this blog's
Engineering(9 vs 359) and two others. The rule that fits all 64 is the one implemented: complete a parent only when it is below the sum of its children.How it was verified
node scripts/check.mjs— 27 checks, passed.Against the sidebar markup fetched from the live blog (
isaac-christian.tistory.com/category/Engineering, the five parents and their rows) in jsdom, once from source and once from the builtdist/images/app.js:Constructed cases on top of that: a three-level branch (1 over 2 over 4 became 7 over 6 over 4), and a branch with one row that has no count, which was left as written all the way up.
368 is checked against the site, not only against the arithmetic.
/category/Engineeringpaged through to its 46th page lists 368 posts: 9 filed inEngineeringitself, and 93, 120, 118, 8 and 20 under it./category/Projectslists 10 and/category/Life19, both with none of their own.The rule checked on a second blog, one not used to derive it:
moonsiri.tistory.com,infra, reads 1 over sub-categories holding 11, and its listing holds 12.Not run: a real browser, because none is installed on this machine. jsdom needed
matchMediaandrequestAnimationFramesupplied, which are the harness's gaps and not the skin's. Nothing was uploaded to a Tistory blog.Limitations
states.cssalready argues is the worse of the two.index.xmlfield or template changed; the release that carries this is a separate PR.