Project

General

Profile

Actions

Feature (development) #14991

open

Feature - Claimable tasks

Added by Peter Mačuga 9 months ago. Updated 9 months ago.

Status:
Testing
Priority:
Normal
Target version:
-
Start date:
07/29/2024
Due date:
% Done:

100%

Estimated time:
custom category:
Backend
Co-assignee:
Sprint:
the LISTING (Feb 26 - Feb 29)

Description

The goal of this feature is to expand the functionality of task service to include claimable tasks - tasks which only award rewards after they are claimed. The claiming of the task is done in a seperate endpoint with the task_id and user_id as parameters.

Multiple claimable solution options:
1. Insert claimable into tags - maybe the best solution, dont know what it might break, tags dont seem to be used
2. create new column claimable
3. use configuration json

New assigned task state flow
- ACTIVE
- FAILED
- ABANDONED
- COMPLETED
- CLAIMED if claimable

Expiration of tasks should work the same, if you competed the task and didnt claim you dont get anyhing, and if its not claimable then just send rewards as before.

Sending rewards:

Options:
- Send rewards from task service to where it has to go depending on reward configuration
- Send task completed event to related servcies and handle the task event there and distribute rewards accordingly
- if we go with this approach it would be appropriate to restructure atleast at first the new tasks to have rewards as a dictionary not as with keys being the name of the service, so we can access related rewards in that service

Tasks:

  1. Get familiar with task service structure, notably the task model and methods and expiration of tasks
  2. Investigate if its possible to include 'claimable' into tags and integrate it into the functions and queries
  3. Add new state of tasks (CLAIMED) and implement endpoints to get list of claimable tasks with paginations for user and endpoint to claim task
    1. EP to claim task
      1. should take a user_id and list of task_ids
      2. Should return proper and meaningfull internal exceptions, as they will be handled on php proxy layer, you can choose to handle middleware connections issues as well with retry if you want but for the sake of time its not required
  4. Reward, if claimable then reward thoruhg EP if not then keep the current logic

Add a amount field to either extras and configuration and add this "amount" to GET endpoint so its available for PHP, alongside the "game" parameter in extras

Actions

Also available in: Atom PDF