CollActionteam / collaction_backend

Backend code for CollAction
6 stars 4 forks source link

Crowdaction badge threshold #111

Open rubenhorn opened 2 years ago

rubenhorn commented 2 years ago

⚠ Blocked by #73

image At the end of the crowdaction the points of the selected commitments will be summed up and compared to the threshold values to determine the badge that should be awarded.

edreinoso commented 2 years ago

How is this ticket dependent of the crowdactions? The way I look at it is that the participants are the ones that needed to be awarded.

Maybe when you fetch the crowdaction you can get to see the different badges from each participant. Similar to a competition, just kind of showing which participant received Golden, Silver, Bronze?

rubenhorn commented 2 years ago

The badge-instances are properties of the profiles, but the crowdactions need to define thresholds for how many points are required to earn them.
Basically this is just adding this array property to the crowdaction records in DynamoDB.
The client may use this property to determine and display which badge a user might earn and other lambdas will use this property to actually calculate the reward at the end of the crowdaction.

edreinoso commented 2 years ago

So when you fetch a crowdaction, you should be able to see how many points are required to get one of the 4 different badges: diamond, gold, silver, bronze?

Is there anything else that needs to be done besides just adding the additional fields for the badges in the DDB table?

I thought of this task in this way, maybe correct me if I'm wrong:

rubenhorn commented 2 years ago

No, not in the scope of this task. We will go with the minimum for now.

edreinoso commented 2 years ago

Okay so the task for this is to create an extra attribute in DDB with badges with the values specified in the array? Couple of follow up questions regarding this:

rubenhorn commented 2 years ago
edreinoso commented 2 years ago

Okay I will create some new attributes manually in my DDB single table.

I am not sure if I have to do some code changes. It seems like the CMS task would own some of these checkpoints, but maybe I'm wrong (hence the discussion haha).

For me this task does not really make much sense if we don't build the logic behind getting the points, and rewarding the badges 😅. But I assume there are other tasks for this to be implemented.

rubenhorn commented 2 years ago

Yes, the points are calculated and compared to the threshold in #120
...and it should just be one attribute, but an array (see description of issue above)

edreinoso commented 2 years ago

All right, I will get on that today. That was my bad, I accidentally typed the plural

rubenhorn commented 2 years ago

Re-opening issue, since change has not yet been merged.
Please reference it from some PR. 😉
Also make sure to update the YAML file for the API.

rubenhorn commented 2 years ago

Added additional field (s. description above)

edreinoso commented 2 years ago

Screenshot 2022-04-07 at 13 16 58

Is this more or less the change that needs to be done for the second checkpoint? The value of points need to be according to the table in Confluence:

Screenshot 2022-04-07 at 13 18 57

Since this is type of commitment is: Vegan, it receives 70 points.

I am doing this manually for now, but this needs to be taken care of when the CMS part is getting implemented

rubenhorn commented 2 years ago

Actually, this also needs to be changed in the GoLang code (here and maybe somewhere else as well, such as the crowdactions file), so we can access this fields after fetching a record from dynamo, since we don't work on the raw dynamo response and instead map them to a plain GoLang object.

In the case of "Vegan", it would be 20 here and the rest of the points come from the commitments in "required".

edreinoso commented 2 years ago

Perfect, I have already made the appropriate changes to the API documentation, as well as to the Commitment models. Please revise it in this branch:

https://github.com/CollActionteam/collaction_backend/tree/feat/gh-111/badge_threshold