Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PAY-2035] Only claim challenges past cooldown period #6378

Merged
merged 3 commits into from
Oct 18, 2023
Merged

Conversation

dharit-tan
Copy link
Contributor

Description

Filter out challenges that are not past the cooldown period and don't attempt to claim them.

How Has This Been Tested?

Local stack with 3 DNs + AAO - confirmed only challenge past cooldown was disbursed, and no errors from trying to claim other challenges that were not past cooldown.

Copy link
Member

@raymondjacobson raymondjacobson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweet!

Copy link
Contributor

@schottra schottra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My coffee kicked in and I got too philosophical on code structure, but LGTM!

@@ -36,6 +36,14 @@ export const getUndisbursedUserChallenges = (state: CommonState) =>
).includes(challenge.specifier)
})

export const getUndisbursedUserChallengeBySpecifier = createSelector(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: A comment or example of how this is used might be helpful. I don't know that I understand it just by the function name :-)

return specifiers.filter((s) => {
const challenge = undisbursedUserChallenges.filter(
(c) => c.specifier === s.specifier
)[0] // specifiers are unique
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@@ -330,6 +336,19 @@ const ChallengeRewardsBody = ({ dismissModal }: BodyProps) => {
challenge.max_steps > 1 &&
challenge.challenge_type !== 'aggregate'

/* Filter for only claimable challenges */
const getClaimableChallengeSpecifiers = useCallback(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious about using useCallback here. Was the intent to memoize the result? As it is, it will still be computed each time it's called. And if those values don't change often, it might make more sense to do useMemo?
Or, if this is just meant to be a helper for the onClaimRewardClicked below, maybe move it outside of the component and pass in both specifiers and undisbursedChallenges so we aren't running through the useCallback check on every render when we only need the logic during the click handler?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty great callout

@dharit-tan dharit-tan enabled auto-merge (squash) October 18, 2023 15:45
@audius-infra
Copy link
Collaborator

Preview this change https://demo.audius.co/rt-cooldown

@dharit-tan dharit-tan merged commit 96aa772 into main Oct 18, 2023
1 check passed
@dharit-tan dharit-tan deleted the rt-cooldown branch October 18, 2023 16:10
audius-infra pushed a commit that referenced this pull request Oct 21, 2023
[e4ce2bf] Run all service tests on self-hosted machines (#6419) Danny
[fa08183] [PAY-2059] Make sure we show buyer challenges for verified users (#6422) Raymond Jacobson
[85a4703] Re-land jimp improvements (#6361) Raymond Jacobson
[01853d6] [C-3233, C-3218, C-3240] Update button styles; fix dark mode styles (#6400) Andrew Mendelsohn
[406b39e] Change flag in setup.sh to check file existence, not dir (#6420) Danny
[c1907f2] Use regular merge in deploys (#6421) Theo Ilie
[7eaca91] [PROTO-1348] [PROTO-1357] Query node by endpoint in protocol dashboard (#6377) Theo Ilie
[c6e55a4] [PAY-1980] Fix pay extra form validation (#6410) Raymond Jacobson
[f19f19e] [PAY-2034] Mobile cooldown schedule UI (#6418) Reed
[579eaef] [PAY-2067] Fix preview now playing drawer layout issues (#6411) Raymond Jacobson
[4f28190] Mobile SummaryTable component (#6416) Reed
[75ea950] Configure bootstrap dev CNs in sdk consumer (#6399) Isaac Solo
[1ea1673] Disk cleanup cron job for self-hosted runners (#6415) Danny
[d40c860] Fix dev-tools setup script (#6413) Sebastian Klingler
[03c3b86] [C-3193] Harmony Text Input (#6329) JD Francis
[2da9cc9] Make proto dash @types/react version consistent (#6374) Theo Ilie
[f4da166] Fix race condition in compose deploy (#6407) Theo Ilie
[3499aaa] [INF-490] Update readme (#6402) Sebastian Klingler
[4e2aa22] Fix nav audio layout (#6412) Raymond Jacobson
[2a546b5] Bump version to 0.4.38 audius-infra
[9d29b6d] [PAY-2019] Update premium content remixes and stems logic (#6409) Saliou Diallo
[d5d5ad7] Fix cooldown challenge schedule wrong dates (#6403) Reed
[0625f9f] Commit package-lock (#6406) Sebastian Klingler
[589a587] Float audio matching challenges to the top (#6404) Reed
[ce95ab6] Fix sign typed data issues in develop app creation (#6405) Raymond Jacobson
[c2e295b] Merge branch 'main' of github.com:AudiusProject/audius-protocol into jd/harmony-text-input JD Francis
[785a815] [PAY-2060] Fix wrong challenge claimed so far amounts (#6398) Reed
[75d0866] [PAY-2038] Catch errors creating stripe session and cancel purchase (#6401) Randy Schott
[7e55bce] [C-3238] Enable harmony themes in web and storybook (#6388) Andrew Mendelsohn
[c2f7545] update helper text to ReactNode JD Francis
[e81e86f] [C-3152] Fix remove artwork (#6392) Dylan Jeffers
[3b2c93b] Bump version to 0.4.37 audius-infra
[8c2d9a0] Add missing GH context to deploy msg job (#6396) Theo Ilie
[daa8358] final PR feedback JD Francis
[5560f61] [PROTO-1356] Tear down containers following self-hosted test (#6397) Danny
[451fd66] [PAY-2036] Reduce spam from websocket errors (#6395) Randy Schott
[0e66586] Bump version to 0.4.36 audius-infra
[76eb3fa] [PROTO-1356] Use self-hosted gcp runners for circleci (#6393) Danny
[e125a8e] [PROTO-1539] Automate audius-docker-compose deploys (#6391) Theo Ilie
[f38a5be] [INF-453] Remove npm link (#6394) Sebastian Klingler
[f850434] mediorum: scroll upload by created_at (#6385) Steve Perkins
[5be4007] Bump version to 0.4.35 audius-infra
[e246162] [C-3239] Fix accidental unset of required prop in upload form (#6390) Randy Schott
[b1d818b] Make web build and dist non-persistent (#6389) Sebastian Klingler
[492a51a] [INF-484] Remove postinstall builds (#6381) Sebastian Klingler
[8387f1b] Automate bundle install in postinstall script (#6387) Sebastian Klingler
[699d329] [C-3230] Improve mobile feature-flag icon (#6384) Dylan Jeffers
[e9b5d0f] [PAY-2027] Implement new challenge badge for audio matching challenges (#6386) Randy Schott
[df9384b] [INF=-458] Upgrade cocoapods to 1.13.0 (#6383) Sebastian Klingler
[16c10e3] [C-3169] Make mac app universal (#6373) Dylan Jeffers
[9a1b3b0] [C-2769] Migrate from altool to notarytool (#6372) Dylan Jeffers
[312717d] [C-3215] Fix transaction table error (#6371) Dylan Jeffers
[f4b4867] fix type error JD Francis
[7100708] [PAY-1985] Implement now playing previews (#6380) Raymond Jacobson
[be95d6e] clean up some tokens JD Francis
[96aa772] [PAY-2035] Only claim challenges past cooldown period (#6378) Reed
[f5e6f36] Merge branch 'main' of github.com:AudiusProject/audius-protocol into jd/harmony-text-input JD Francis
[eff06a3] add ids for labels, tweak css, add comments, fix centering, fix disabled state JD Francis
[7d01e1e] Bump version to 0.4.34 audius-infra
[8cc5a64] [PAY-2009] Challenge cooldown UI (#6363) Reed
[5debe03] [C-3232] Change tertiary button usages to secondary (#6376) Andrew Mendelsohn
[d4043b2] [PAY-1990] Fix premium to public edit bug (#6370) Saliou Diallo
[d221808] Merge branch 'main' of github.com:AudiusProject/audius-protocol into jd/harmony-text-input JD Francis
[945ae96] lots of PR and design feedback JD Francis
[c461087] [C-3217] Add chromatic to harmony and run in CI (#6357) Andrew Mendelsohn
[d75360d] [PROTO-1349] Build healthz in discovery workflow to ensure staging availability (#6368) Danny
[38c324e] [PAY-1973] Fix Android crash and buy button text for purchase flow (#6369) Randy Schott
[b697b1e] [C-3045] Improve Table render and layout (#6358) Dylan Jeffers
[e4b5bf3] [C-3101] Fix table action hover state (#6359) Dylan Jeffers
[9e11abd] [C-3216] Add react-slot, implement asChild for drag/drop (#6353) Dylan Jeffers
[c1624b6] [PAY-1978] Read pay extra presets from remote config (#6366) Randy Schott
[671931f] [PAY-1954] Fix display of $0 existing balance on web purchase form (#6367) Randy Schott
[6e612a8] [PAY-1982] Add AudioMatchSection in premium purchase modal/drawer (#6364) Raymond Jacobson
[a4166ab] [PAY-1882] Update landing page (#6351) Saliou Diallo
[741a0a6] Revert "Revert "[INF-498] Leverage turborepo cache in docker builds i… (#6365) Sebastian Klingler
[a4506e3] [PAY-1994] Finish audio matching challenge UI on mobile (#6355) Randy Schott
[0d73cc6] Bump version to 0.4.33 audius-infra
[e7073d0] PROTO-1261: trending rewards plugin QOL improvements (#6360) Alec Savvy
[5162831] PROTO-1335: relay upload delay (#6281) Alec Savvy
[3e28ebe] Delay foundation deploy by 1hr (#6347) Theo Ilie
[e279afa] Remove gcp-cleanup job (#6356) Danny
[60b8b2a] fix font size not working for helper text JD Francis
[2d00892] Merge branch 'main' of github.com:AudiusProject/audius-protocol into jd/harmony-text-input JD Francis
[344d4f9] make aria label required + fix assistive text size JD Francis
[4f15758] [PROTO-1349] Continuous deployment for healthz (#6350) Danny
[efe94f5] [PAY-1993] Order challenges by claimable amt (#6348) Raymond Jacobson
[14dd710] fix placeholder font + make labels required JD Francis
[c3de6b6] Tune celery worker concurrency (#6352) Isaac Solo
[6a4236b] [PROTO-1329] Disable DLC (#6349) Danny
[541424c] Bump version to 0.4.32 audius-infra
[4b1a4c6] Dedicated queue for ACDC indexing (#6277) Isaac Solo
[1177a60] minor tweaks JD Francis
[a55cf3a] Add TextInput to Harmony based off of InputV2 JD Francis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants