You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: Deduct points when a daily task is cancelled #996
TASK_CONSTS is located at src/dailyTasks/consts/taskConstants.ts
The existing successful 204 No Content response can remain unchanged.
How do you think this should work?
Apply the penalty when a player-owned daily task is relinquished through:
PUT /dailyTasks/unreserve
DELETE /dailyTasks/:_id
Read the penalty from TASK_CONSTS.POINTS.DAILY_TASK.CANCEL_PENALTY.
Deduct regular player points, not battlePoints or clan points.
Implement a dedicated point-deduction method in PlayerRewarder. Do not pass a negative value to rewardForPlayerTask, because that method rejects negative rewards.
Perform the task cancellation and point deduction in the same transaction.
Use an atomic update that prevents the stored value from falling below zero.
Deduct points only after confirming that the task exists and belongs to the requesting player.
Do not deduct points for failed, unauthorized, repeated, or otherwise ineffective cancellation requests.
Ensure concurrent requests cannot charge the same cancellation more than once.
Add tests for both endpoints, the zero boundary, invalid ownership, repeated requests, and transaction rollback.
The player schema already defines regular points with a minimum value of zero, but the cancellation logic must also enforce the lower bound atomically rather than relying only on schema validation.
Activity