Skip to content

refactor: route vote scoring through voteConfig.ts instead of reimplementing it #164

Description

@chiptus

Problem

src/lib/voteConfig.ts already defines the canonical vote values (mustGo: 2, interested: 1, wontGo: -1) with getVoteValue()/getVoteConfig() accessors, but two call sites reimplement the same scoring logic independently with raw vote_type literals instead of calling it:

  • src/pages/EditionView/tabs/ArtistsTab/useSetFiltering.ts:20-41 (calculateRating, getWeightedPopularityScore)
  • src/pages/SetDetails/SetGroupVoting.tsx:46-48

If the vote value scheme in voteConfig.ts ever changes (e.g. rebalancing weights, adding a 4th vote type), these two call sites have to be found and fixed by hand — voteConfig.ts isn't actually the single source of truth it appears to be.

Fix

Delete the local reimplementations in useSetFiltering.ts and SetGroupVoting.tsx; call getVoteValue/getVoteConfig instead. No new code, only deletion of two shallow reimplementations.

Architecture note

Filed from an architecture review (module/interface/depth vocabulary, see /codebase-design). The canonical seam already exists — this is pure leverage left on the table.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions