Skip to content

Fix #12: Add score normalization for AniList formats - #14

Merged
bigspawn merged 6 commits into
mainfrom
fix/issue-12-score-normalization
Jan 5, 2026
Merged

Fix #12: Add score normalization for AniList formats#14
bigspawn merged 6 commits into
mainfrom
fix/issue-12-score-normalization

Conversation

@bigspawn

@bigspawn bigspawn commented Jan 5, 2026

Copy link
Copy Markdown
Owner
  • Add GetUserScoreFormat() to retrieve user's AniList score format
  • Change Score type from float64 to int (always stored as 0-10)
  • Implement normalizeScoreForMAL() to convert AniList scores to 0-10
  • Implement denormalizeScoreForAniList() to convert back to user's format
  • Support all 5 AniList formats: POINT_100, POINT_10_DECIMAL, POINT_10, POINT_5, POINT_3
  • Add comprehensive tests for normalization/denormalization functions
  • Apply same changes to both anime and manga

Fixes #12

This fixes MAL API rejecting scores > 10 with '400 invalid score bad_request'

- Add GetUserScoreFormat() to retrieve user's AniList score format
- Change Score type from float64 to int (always stored as 0-10)
- Implement normalizeScoreForMAL() to convert AniList scores to 0-10
- Implement denormalizeScoreForAniList() to convert back to user's format
- Support all 5 AniList formats: POINT_100, POINT_10_DECIMAL, POINT_10, POINT_5, POINT_3
- Add comprehensive tests for normalization/denormalization functions
- Apply same changes to both anime and manga

This fixes MAL API rejecting scores > 10 with '400 invalid score bad_request'
@bigspawn bigspawn self-assigned this Jan 5, 2026
@bigspawn
bigspawn requested a review from Copilot January 5, 2026 07:37

Copilot AI 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.

Pull request overview

Addresses MAL API rejecting scores exceeding 10 by normalizing AniList scores to 0-10 format and denormalizing when writing back to AniList.

  • Changed Score type from float64 to int and stored internally as normalized 0-10 format
  • Added normalization/denormalization functions supporting all 5 AniList score formats (POINT_100, POINT_10_DECIMAL, POINT_10, POINT_5, POINT_3)
  • Integrated score format retrieval at startup and applied transformations across the sync pipeline

Reviewed changes

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

Show a summary per file
File Description
app.go Retrieves user's AniList score format at startup; passes it to data fetching functions; denormalizes scores when writing to AniList
anime.go Changes Score field to int; adds normalization/denormalization functions; updates format strings from %f to %d
anime_test.go Comprehensive tests for anime score normalization/denormalization and round-trip conversions
manga.go Changes Score field to int; adds normalization/denormalization functions; updates format strings from %f to %d
manga_test.go Comprehensive tests for manga score normalization/denormalization and round-trip conversions
anilist.go Adds GetUserScoreFormat() to retrieve user's score format preference from AniList API
Makefile Adds fmt target for code formatting with gofumpt
CLAUDE.md Documents the new score normalization architecture and development workflows
.golangci.yml Excludes dupl linter for test files to allow identical test structures

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app.go Outdated
Comment thread app.go Outdated
- Move score normalization functions to score.go
- Move score normalization tests to score_test.go
- Add detailed comments explaining intentional code duplication
- Remove duplicate code from anime.go and manga.go
- Remove duplicate tests from anime_test.go and manga_test.go

Addresses Copilot review comments about documenting intentional
duplication in fetch functions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

@bigspawn bigspawn left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

All Copilot review comments have been addressed:

  • Added detailed comments explaining intentional code duplication in both fetch functions
  • Refactored score normalization code into separate files (score.go and score_test.go)
  • All tests passing ✅
  • Linter checks passing ✅

@bigspawn
bigspawn merged commit 9f3190d into main Jan 5, 2026
3 checks passed
@bigspawn
bigspawn deleted the fix/issue-12-score-normalization branch January 5, 2026 08:50
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 score normalization for AniList → MAL sync (MAL rejects scores > 10)

2 participants