Align STL Export Tower Grid with Real Weekdays - #8316
Conversation
…nment instead of idx % 7
|
Someone is attempting to deploy a commit to the jhasourav07's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
This pull request addresses an important issue by aligning the STL export's tower grid with actual weekdays, which enhances the consistency of the exported models with the 2D badge representation. This change is crucial for users who rely on accurate date representations in their exports. Additionally, it includes new tests to verify the correct alignment and incrementing of week-columns. It's worth noting that similar past decisions focused on enhancing timezone normalization and calendar boundary handling, which underscores the importance of accurate date calculations in our application. Thank you for your contribution, and I look forward to your updates! |
📦 Next.js Bundle Size Report (Gzipped Sizes)✨ No significant bundle size changes detected. 📊 Summary of Totals
|
Aamod007
left a comment
There was a problem hiding this comment.
Aligning the STL export tower grid with real weekdays — significant refactoring of the 3D export logic. CI failing, please fix.
Labels: level:intermediate (3 files, 167+93), quality:clean, type:bug, type:testing, mentor:Aamod007
Aamod007
left a comment
There was a problem hiding this comment.
Re-reviewing after noting the only CI failure is Vercel authorization (not code-related). All other checks (Format · Lint · Typecheck · Test, Production Build, CodeQL) pass. Approving — the Vercel deploy auth is a repo-level config issue, not a code problem.
Description
Fixes #8315
Pillar
What this PR does
activityToTowers()(the 3D STL print export) derived each tower's gridrowfromidx % 7— the flat array index — rather than the day'sactual weekday. Every other tower-grid builder in the codebase
(
computeTowers()inlib/svg/layout.ts,chunkDaysIntoWeeks()inlib/calculate.ts) anchors rows to real, Sunday-first weekdays. Thismade the exported 3D-printable model's grid pattern not match the same
user's actual 2D badge whenever the export's date range didn't happen to
start on a Sunday (the common case). Fixed by computing real weekday via
getUTCDay()and tracking week-column boundaries explicitly at realSunday transitions.
Changes
lib/export3d.tsactivityToTowers()now derivesrowfromgetUTCDay()and incrementscolonly at Sunday boundarieslib/export3d.test.tsChecklist before requesting a review:
CONTRIBUTING.mdfile.npm run formatandnpm run lintlocally and resolved all errors.