Task #16423
Updated by Peter Mačuga 5 months ago
This task is to change the source of data of NFT leaderboard from transfer_erc721 table to loyalty_nft table. Nft leaderboard stored a number of points per wallet per contract (we have 2 contracts for this functionality defined in the config) and ranks them by points. This rank is done by a seperate query and is NOT is scope of this task. Loyalty NFT table stores current owners of nfts, so every row in the table refers to 1 nft 1. Edit or replace the <get_transfers_for_collection> method **[nft_leaderboard.py, line 53]** to take the necesasry data (wallet_address, points) from loyalty_nft table. 2. Edit the rest of the function where <get_transfers_for_collection> was userd (has only 1 usage) and modify it to reflect the changes if any. 3. Remove unncessary parts of the code - anything with listing is not used anymore, you can omit that, take data only from loyalty_nft table, likewise qorpo_power_points in nft_leaderboard can be ignore, they are already in loyalty_nft table 4. only edit the snapshot = 'current', this is a legacy solution that is not ideal, buy since its like we have to work with it. 5. ideally leave the achievements functions be if the input parameters can be adjusted correctly, than its fine. 6. the for loop form nft_leaderboard line 172 to line 208 is used to calculate and validate the points for the wallets, if the updated function is done correctly (returns sum and count) then most if this can be removed i think Notes: contract identifier is sometimes refered to as contract_id, you can use contract_id its a bit better, and also in legacy code contract_id has a '-' as a delimiter, delimited, if you are changing the function try to use '_' as a delimiter, but if it is too anooying than it can be ommited. since the main focus is for the numbers to fit Goal: Make a version of the <get_transfers_for_collection> function that returns the summed and counted data and adjust the rest of the function by removing obsolete code. Peter will then check and test the functionality.