Closed tommyzhao451 closed 1 month ago
@tommyzhao451 What's the logic on backend?
return { userStatus: { ... }, };
just add
xPoints: info.xPoints ?? 0,
?
Logic in backend will be in 2 separate PRs.
https://github.com/Aperture-Finance/automation-backend/pull/683/files
xPoints: isXPointsUploaded(nowMoment) ? info.x_points : undefined,
where isXPointsUploaded depends on a environment flag that we'll manually flip after we've run the script to upload xPoints.
The 2nd PR isn't drafted yet, but it'll read user_points.csv (posted in product channel https://app.slack.com/client/T032M7F555M/C041ZB5C9T7), retweets (https://docs.google.com/spreadsheets/d/1p6FXtZSNxjtIXpgV8JAYVX95hbyK27dIH_RLSbfRZK0/edit#gid=2103406110), and followers (not obtained yet); and also read allUserInfo, map userInfos by x_id order by x_bound_at ascending limit 1, and for each of the csv lines, add up the xPoints and write it to dynamo.
Frontend needs to check whether xPoints exists and not undefined. if so, then it's done tabulating and frontend can display it. Even if it returns 0, it means that backend is done tabulating and we can display it on frontend.
@tommyzhao451 What's the logic on backend?
https://github.com/Aperture-Finance/automation-backend/blob/e65499a9bfdd7966a9c61ffd3cb2665f2ebf7db0/src/handlers/pointUserStatus.ts#L87C1-L105C5
just add
xPoints: info.xPoints ?? 0,
?