Skip to content

Account quality metrics #2212

Ben requested to merge feat/account-quality-metrics-2212 into master

Ticket(s) / Related Merge Requests

Closes #2212 (closed)

Summary of Changes

Changes to add account quality score to metrics and restrict rewards based on a configurable float, defaulted to 0.5 but can be set in settings.php

Testing Considerations

Getting your data manually in Cassandra

kubectl exec -it cassandra-0 cqlsh

### Initial insert into the DB - use your own guid and an epoch timestamp in MS for the second param, third param is the score 
INSERT INTO minds.account_quality_scores (user_guid, last_updated_timestamp, score) VALUES (991463054707265537, 1643989488000, 1);

# Set score when there's already an entry - replace guid and last updated timestamp to match the one created.
UPDATE minds.account_quality_scores SET score=0 WHERE user_guid=991463054707265537 AND last_updated_timestamp=1643989488000;

# Check your score (replace guid)
SELECT * FROM minds.account_quality_scores WHERE user_guid=991463054707265537;

Bridging ES to your local

I recommend connecting with Elasticvue so that you can easily see the latest data - we want to log into the site with the user above and check for the latest entries in this months metrics table - you should see your account score reflected

Note: to proxy the sandbox ES to your local you can use kubectl port-forward -n elasticsearch elasticsearch-opendistro-es-master-0 9200:9200 - ask for credentials.

Testing metrics

Log in, check it appears with the score, change the score, log in again, check the new score appears

image

Testing contributions

Manually inserting data into contributions table

# For the first value, set your GUID, for the second, set the epoch timestamp of midnight for the day you're testing on.
INSERT INTO minds.contributions (user_guid, timestamp, metric, amount, score) VALUES (1285556899399340038, 1643932800000, 'votes', 1, 1);

# To check
SELECT * FROM minds.contributions WHERE user_guid=1285556899399340038; 

Running the CLI job

Keep your Cassandra shell open - you're going to have to use the above commands to change the bot scores to test - you want to run this with a value greater than and lower than the contribution score threshold.

kubectl exec -it [podname] sh
cd engine
php cli.php Rewards calculate

Look for output that engagement was paid out to your user - as mentioned above, change the bot score to be below the threshold (0.5 by default - just set it to 0.1) and make sure you don't see the payout. Set it back and make sure that you do.

Regression Scope

Effects metrics and contribution scores

Platform Affected (web, mobile, etc)

Metrics and runners

Developer Testing Completed

Specs and manual

Screenshots

N/A

Does this impact

  • Localization
  • Dark/light mode
  • Guest mode
Edited by Ben

Merge request reports