Skip to content

fix: remove duplicate POINTS_*/PROGRESS_TARGET_* constant block in script.js (declared at lines 177-192 and 215-231) #1864

Description

@ionfwsrijan

Summary

The gamification constants in src/static/script.js are declared twice with identical values (POINTS_* at lines 177-192 and again at 215-231). The second var re-declaration is redundant dead code; if the two copies ever diverge, progress totals and the target calculation will silently disagree.

Evidence

src/static/script.js:177-192:

var POINTS_PER_SEARCH     = 5;
var POINTS_PER_VIEW       = 10;
var POINTS_PER_CODE_OPEN  = 15;
var POINTS_PER_COMPLETION = 30;
var PROGRESS_TARGET_SEARCHES     = 10;
var PROGRESS_TARGET_VIEWS        = 10;
var PROGRESS_TARGET_CODE_OPENS   = 10;
var PROGRESS_TARGET_COMPLETIONS  = 5;

src/static/script.js:215-231 — the same eight declarations repeated verbatim, immediately followed by another copy of the target-total expression (lines 227-230).

The totals are computed from these constants at line 290, so only the second block is actually used; the first is pure duplication.

Impact

  • Maintenance hazard: editing one copy and not the other produces inconsistent gamification (points/targets) with no error.
  • Unnecessary dead code in the largest frontend file.

Suggested Fix

Delete the first block (lines 177-192), keeping the single canonical definition. (This is the same file that also carries the duplicate math/random-style leftovers addressed in #1838/#1839 — a quick cleanup pass on script.js would remove all three.)

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions