Skip to content

fix: ensure ECTS is coerced to number in CourseOccasion from JSON - #71

Open
SpiderQubit wants to merge 2 commits into
masterfrom
68-rounding-error
Open

fix: ensure ECTS is coerced to number in CourseOccasion from JSON#71
SpiderQubit wants to merge 2 commits into
masterfrom
68-rounding-error

Conversation

@SpiderQubit

@SpiderQubit SpiderQubit commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

refactor: improve study pace text formatting and add consistent rounding for ECTS sums

Summary by CodeRabbit

  • Bug Fixes
    • Corrected study-pace displays so period ECTS values consistently add up to the rounded overall total.
    • Improved handling of ECTS values received in different formats, preventing calculation errors and incorrect totals.
    • Updated period headers to show more reliable, consistent ECTS information.

refactor: improve study pace text formatting and add consistent rounding for ECTS sums
@SpiderQubit SpiderQubit linked an issue Jul 18, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@SpiderQubit, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 36 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a8046dd6-7031-41ae-9297-5820da52b670

📥 Commits

Reviewing files that changed from the base of the PR and between 14c27f2 and d83630a.

📒 Files selected for processing (1)
  • rodatraden/static/rodatraden/block_schedule/block_schedule_renderer.js
📝 Walkthrough

Walkthrough

The changes coerce deserialized ECTS values to numbers and add consistent one-decimal rounding for per-period study-pace values, adjusting rounding discrepancies before period headers are rendered.

Changes

ECTS consistency

Layer / File(s) Summary
Normalize ECTS input
rodatraden/static/rodatraden/block_schedule/course_occasion.js
CourseOccasion.fromJSON converts incoming ects values with Number(...) before constructing the occasion.
Align period ECTS rounding
rodatraden/static/rodatraden/block_schedule/block_schedule_renderer.js
Per-period ECTS values are rounded to one decimal, one value is adjusted for discrepancy, and the resulting array is used when rendering period headers.

Estimated code review effort: 3 (Moderate) | ~15–30 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes one real part of the changeset: coercing ECTS to a number in CourseOccasion from JSON.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 68-rounding-error

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@rodatraden/static/rodatraden/block_schedule/block_schedule_renderer.js`:
- Around line 269-275: In the discrepancy distribution block, update the
`errors` calculation used by `targetIndex` to reverse the subtraction order,
measuring each period’s distance from its rounded value in the discrepancy
direction. Keep the existing `Math.max` selection and final
`rounded[targetIndex]` adjustment unchanged so the period that best compensates
the discrepancy is selected.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3a96e506-95f5-49df-aa6e-eb194db3dd96

📥 Commits

Reviewing files that changed from the base of the PR and between 8bb409e and 14c27f2.

📒 Files selected for processing (2)
  • rodatraden/static/rodatraden/block_schedule/block_schedule_renderer.js
  • rodatraden/static/rodatraden/block_schedule/course_occasion.js

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.

Rounding error

1 participant