Skip to content

Centralize scoring configuration in taskConstants.ts - #1006

Merged
tickBit merged 4 commits into
devfrom
995-centralize-scoring-configuration-in-taskconstantsts
Sep 27, 2026
Merged

tickBit merged 4 commits into
devfrom
995-centralize-scoring-configuration-in-taskconstantsts

Conversation

@CapoMK25

Copy link
Copy Markdown
Collaborator

Brief description

Closes issue #995

Implements a centralized scoring config essentially. Removes the requested file on the side. Uses the same structure for now as was mentioned on the issue. Rewrites tests accordingly, Tested via in-memory testing:

[capomk@lianli Altzone-Server]$ npx ts-node -T -e '
import { TASK_CONSTS } from "./src/dailyTasks/consts/taskConstants";

console.log("--- Step 2: Daily Task Systems Validation ---");
const smallPoints = TASK_CONSTS.POINTS.DAILY_TASK.SMALL;
const penalty = TASK_CONSTS.POINTS.DAILY_TASK.CANCEL_PENALTY;
const generatedCoins = smallPoints * TASK_CONSTS.COINS.FACTOR;

console.log("1. Small Daily Task Points (20 expected):", smallPoints === 20 ? "PASS" : `FAIL (${smallPoints})`);
console.log("2. Cancel Penalty Points (10 expected):", penalty === 10 ? "PASS" : `FAIL (${penalty})`);
console.log("3. Calculated Coins (10 expected):", generatedCoins === 10 ? "PASS" : `FAIL (${generatedCoins})`);
'
npm notice run altzone-server@1.0.0 npx
npm notice run 'ts-node' -T -e 
npm notice run import { TASK_CONSTS } from "./src/dailyTasks/consts/taskConstants";
npm notice run
npm notice run console.log("--- Step 2: Daily Task Systems Validation ---");
npm notice run const smallPoints = TASK_CONSTS.POINTS.DAILY_TASK.SMALL;
npm notice run const penalty = TASK_CONSTS.POINTS.DAILY_TASK.CANCEL_PENALTY;
npm notice run const generatedCoins = smallPoints * TASK_CONSTS.COINS.FACTOR;
npm notice run
npm notice run console.log("1. Small Daily Task Points (20 expected):", smallPoints === 20 ? "PASS" : `FAIL (${smallPoints})`);
npm notice run console.log("2. Cancel Penalty Points (10 expected):", penalty === 10 ? "PASS" : `FAIL (${penalty})`);
npm notice run console.log("3. Calculated Coins (10 expected):", generatedCoins === 10 ? "PASS" : `FAIL (${generatedCoins})`);
--- Step 2: Daily Task Systems Validation ---
1. Small Daily Task Points (20 expected): PASS
2. Cancel Penalty Points (10 expected): PASS
3. Calculated Coins (10 expected): PASS
[capomk@lianli Altzone-Server]$

Edit: I accidentally deleted 2 comments. I'll add them back in in a later commit on this PR.

Change list

  • Revamped src/__tests__/dailyTasks/dailyTaskScoringValues.test.ts
  • Revamped src/__tests__/matchmaking/MatchmakingService/flow.test.ts
  • Revamped src/__tests__/rewarder/ClanRewarder/rewardForClanEvent.test.ts
  • New const setup according to the boilerplate from the issue on src/dailyTasks/consts/taskConstants.ts
  • src/box/dailyTask/defaultPredefinedDailyTasks.ts and others like it revamped acoording to the new const variables for centralized scoring
  • Removed src/common/values/scoring.values.ts as redundant
  • Linter changes in another commit
  • Comments added back in in a later commit on this PR

@codecov-alt

codecov-alt Bot commented Sep 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/box/dailyTask/defaultPredefinedDailyTasks.ts 100.00% <100.00%> (ø)
src/dailyTasks/consts/taskConstants.ts 100.00% <ø> (ø)
src/dailyTasks/taskGenerator.service.ts 95.45% <100.00%> (-0.07%) ⬇️
src/dailyTasks/uiDailyTasks/uiDailyTasks.ts 100.00% <100.00%> (ø)
src/matchmaking/matchmaking.service.ts 81.77% <100.00%> (+0.09%) ⬆️
src/rewarder/clanRewarder/points.ts 100.00% <100.00%> (ø)
src/rewarder/playerRewarder/points.ts 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tickBit tickBit left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks very solid 👍 ! Approved.

@tickBit
tickBit merged commit e29674f into dev Sep 27, 2026
5 checks passed
@tickBit
tickBit deleted the 995-centralize-scoring-configuration-in-taskconstantsts branch September 27, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Centralize scoring configuration in taskConstants.ts

2 participants