LearnCard icon indicating copy to clipboard operation
LearnCard copied to clipboard

[WE-3308] Recipient Count

Open TaylorBeeston opened this issue 1 year ago โ€ข 3 comments

  • :sparkles: Add Boost Recipient Count
  • :bookmark: Changesets

Overview

๐ŸŽŸ Relevant Jira Issues

[WE-3308] Aug - badge count is inaccurate

๐Ÿ“š What is the context and goal of this PR?

We don't have a good way to count the number of recipients for a boost

๐Ÿฅด TL; RL:

Adds a resolver to count boost recipients

๐Ÿ’ก Feature Breakdown (screenshots & videos encouraged!)

  • New route: getBoostRecipientCount
  • New plugin method: countBoostRecipients

๐Ÿ›  Important tradeoffs made:

None!

๐Ÿ” Types of Changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Chore (refactor, documentation update, etc)

๐Ÿ’ณ Does This Create Any New Technical Debt? ( If yes, please describe and add JIRA TODOs )

  • [x] No
  • [ ] Yes

Testing

๐Ÿ”ฌ How Can Someone QA This?

Run test suite, run this locally and connect a learncard to it in the CLI:

# First set up Neo4j by spinning up an instance and setting its info in .env inside of services/learn-card-network/brain-service
cd services/learn-card-network/brain-service

# Start local instance
pnpm start
# Open the CLI
pnpm exec nx start cli # Add --skip-nx-cache if it doesn't seem to be working

// Once it's open
let test = await initLearnCard({ seed: 'a', network: 'http://localhost:3000/trpc' });
let test2 = await initLearnCard({ seed: 'b', network: 'http://localhost:3000/trpc' });

// If you don't have accounts yet, make them

await test.invoke.createProfile({ profileId: 'testa' });
await test2.invoke.createProfile({ profileId: 'testb' });


// Create a boost
const uvc = test.invoke.getTestVc();
const uri = await test.invoke.createBoost(uvc);

// Count recipients (should be 0)
await test.invoke.countBoostRecipients(uri);

// Send boost
await test.invoke.sendBoost('testb', uri);

// Count recipients (should be 1)
await test.invoke.countBoostRecipients(uri);

๐Ÿ“ฑ ๐Ÿ–ฅ Which devices would you like help testing on?

N/A

๐Ÿงช Code Coverage

I wrote tests for this!

Documentation

๐Ÿ“œ Gitbook

๐Ÿ“Š Storybook

โœ… PR Checklist

  • [x] Related to a Jira issue (create one if not)
  • [x] My code follows style guidelines (eslint / prettier)
  • [x] I have manually tested common end-2-end cases
  • [x] I have reviewed my code
  • [x] I have commented my code, particularly where ambiguous
  • [x] New and existing unit tests pass locally with my changes
  • [ ] I have made corresponding changes to gitbook documentation

๐Ÿš€ Ready to squash-and-merge?:

  • [x] Code is backwards compatible
  • [x] There is not a "Do Not Merge" label on this PR
  • [x] I have thoughtfully considered the security implications of this change.
  • [x] This change does not expose new public facing endpoints that do not have authentication

TaylorBeeston avatar Aug 01 '24 18:08 TaylorBeeston

๐Ÿฆ‹ Changeset detected

Latest commit: a284be8c95ab248261d56cb3b2f3f26175c4b505

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@learncard/network-brain-service Patch
@learncard/network-plugin Patch
@learncard/network-brain-client Patch
@learncard/init Patch
@learncard/chapi-example Patch
@learncard/create-http-bridge Patch
@learncard/cli Patch
@learncard/react Patch
learn-card-discord-bot Patch
@learncard/snap-chapi-example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Aug 01 '24 18:08 changeset-bot[bot]

Deploy Preview for learn-card-chapi-example canceled.

Name Link
Latest commit a284be8c95ab248261d56cb3b2f3f26175c4b505
Latest deploy log https://app.netlify.com/sites/learn-card-chapi-example/deploys/66abd73a1876aa0008ce6d7b

netlify[bot] avatar Aug 01 '24 18:08 netlify[bot]

Deploy Preview for learncarddocs canceled.

Name Link
Latest commit a284be8c95ab248261d56cb3b2f3f26175c4b505
Latest deploy log https://app.netlify.com/sites/learncarddocs/deploys/66abd73a438b640008709193

netlify[bot] avatar Aug 01 '24 18:08 netlify[bot]