Skip to content

[BUG] Score phrase system appends to defaults instead of replacing them and has defaults in templates #778

@safepay

Description

@safepay

Problems

  1. Custom phrases append to defaults instead of replacing them. Any phrases entered in the settings UI are concatenated onto the 15 hardcoded built-in phrases rather than overriding them.

  2. Built-in defaults are hardcoded in JS, not Python. The 15 default phrases live only inside a PikaraokeConfig JavaScript object in splash.html. They are unreachable from Python and there is no single source of truth. preference_manager.py has empty strings as the defaults for all three phrase keys.

Solution

  • Move the 15 built-in phrases into a Python helper function in splash.py (where Flask-Babel translation has request context), replacing the hardcoded JS block.
  • Add a GET /splash/score_phrases JSON endpoint that returns translated built-ins when no custom phrases are configured, or the user's custom phrases otherwise (never translated).
  • Have splash.js fetch from this endpoint at startup instead of reading the baked-in config object — enabling future live updates without a page refresh.
  • Store custom phrases as |-separated strings in config.ini (cleaner than multi-line configparser values).
  • Update the settings UI help text to make clear that filling the textboxes overrides the defaults; leaving them empty restores the defaults.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions