Skip to content

996 feature deduct points when a daily task is cancelled - #1013

Merged
tickBit merged 4 commits into
devfrom
996-feature-deduct-points-when-a-daily-task-is-cancelled
Oct 2, 2026
Merged

tickBit merged 4 commits into
devfrom
996-feature-deduct-points-when-a-daily-task-is-cancelled

Conversation

@EemeliJ

@EemeliJ EemeliJ commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Brief description

Adds a 10 point (regular) penalty when a player relinquishes an active daily task. The penalty is applied when unreserving, switching to another task, or deleting an owned task. Released tasks return to the pool as fresh tasks, and all cancellation changes run transactionally.

Change list

  • Deduct TASK_CONSTS.POINTS.DAILY_TASK.CANCEL_PENALTY from regular player points.
  • Clamp point deductions atomically at zero.
  • Reset unreserved/switched tasks before returning them to the pool.
  • Apply one penalty when switching from an active task to another.
  • Add a cancellation specific delete flow for owned tasks.
  • Preserve penalty-free task completion behavior.
  • Add coverage for zero boundary, ownership, repeated/concurrent requests, rollback, switching, and deletion.

closes #996

…nts-when-a-daily-task-is-cancelled

# Conflicts:
#	src/__tests__/dailyTasks/formAnInnerConnection.test.ts
@codecov-alt

codecov-alt Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.68293% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/dailyTasks/dailyTasks.service.ts 94.28% 2 Missing ⚠️
.../rewarder/playerRewarder/playerRewarder.service.ts 83.33% 1 Missing ⚠️
Files with missing lines Coverage Δ
.../rewarder/playerRewarder/playerRewarder.service.ts 97.14% <83.33%> (-2.86%) ⬇️
src/dailyTasks/dailyTasks.service.ts 87.20% <94.28%> (+11.79%) ⬆️

... and 2 files 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.

Comment thread src/dailyTasks/dailyTasks.service.ts Outdated
);
if (unreserveErrors) return cancelTransaction(newSession, unreserveErrors);

return endTransaction(newSession, wasUnreserved);

@tickBit tickBit Oct 1, 2026 •

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.

Just wondering, that should this be asynchronous return statement like this:

return await endTransaction(newSession, wasUnreserved);

I noticed, that elsewhere in the code base we have used statements like that.

Comment thread src/dailyTasks/dailyTasks.service.ts Outdated
TASK_CONSTS.POINTS.DAILY_TASK.CANCEL_PENALTY,
session,
);
if (deductionErrors) return cancelTransaction(session, deductionErrors);

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.

Similar as above.

@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.

I think it would safer to use await in those return statements.

Please include also some output from testing the implementation.

@CapoMK25 CapoMK25 assigned CapoMK25 and unassigned CapoMK25 Oct 1, 2026
@EemeliJ

EemeliJ commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator Author
testOutput Provided through Codex @tickBit

@EemeliJ
EemeliJ requested a review from tickBit October 2, 2026 08:51

@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.

Seems good and working solution 👍 . Approved.

With testing output I meant some kind of runtime output via Postman or similar, or from command line using curl or something like that. But I believe, that this is a working solution 👍

@EemeliJ

EemeliJ commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator Author

Seems good and working solution 👍 . Approved.

With testing output I meant some kind of runtime output via Postman or similar, or from command line using curl or something like that. But I believe, that this is a working solution 👍

Oh, understood. I tested this via Swagger and established it as functional, Postman wasn't strictly needed for this i think, as i was able to log in and test this as a previously created test -profile. I can provide more proof if needed, but through swagger and automated tests everything seems to work as expected 😊

@tickBit

tickBit commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

Seems good and working solution 👍 . Approved.
With testing output I meant some kind of runtime output via Postman or similar, or from command line using curl or something like that. But I believe, that this is a working solution 👍

Oh, understood. I tested this via Swagger and established it as functional, Postman wasn't strictly needed for this i think, as i was able to log in and test this as a previously created test -profile. I can provide more proof if needed, but through swagger and automated tests everything seems to work as expected 😊

I'm pretty sure, that this works as expected, no need for more proof :-)

@tickBit
tickBit merged commit 3b8bf56 into dev Oct 2, 2026
5 checks passed
@tickBit
tickBit deleted the 996-feature-deduct-points-when-a-daily-task-is-cancelled branch October 2, 2026 09:27
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.

Feature request: Deduct points when a daily task is cancelled

3 participants