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

feat: add max buy and reorder collection #2556

Merged
merged 7 commits into from
Apr 2, 2022

Conversation

Jarsen136
Copy link
Contributor

Thank you for your contribution to the KodaDot NFT gallery.
👇 _ Let's make a quick check before the contribution.

PR type

  • Bugfix
  • Feature
  • Refactoring

What's new?

Before submitting Pull Request, please make sure:

  • My contribution builds clean without any errors or warnings
  • I've merged recent default branch -- main and I've no conflicts
  • I've tried to respect high code quality standards
  • I've didn't break any original functionality
  • I've posted a screenshot of demonstrated change in this PR

Optional

  • I've tested it at </rmrk/collection/26902bc2f7c20c546a-1FVG7>
  • I've tested PR on mobile and everything seems works
  • I found edge cases
  • I've written some unit tests 🧪

Had issue bounty label?

  • Fill up your KSM address: Payout

Community participation

Screenshot

  • My fix has changed something on UI; a screenshot is best to understand changes for others.

image

@netlify
Copy link

netlify bot commented Mar 16, 2022

Deploy Preview for koda-nuxt ready!

Name Link
🔨 Latest commit 1ab68fb
🔍 Latest deploy log https://app.netlify.com/sites/koda-nuxt/deploys/623c45cbeaa20e00088750fb
😎 Deploy Preview https://deploy-preview-2556--koda-nuxt.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@vikiival
Copy link
Member

Like the code is legit, but it's like using duct tape to glue two pieces of paper together

Copy link
Member

@vikiival vikiival left a comment

Choose a reason for hiding this comment

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

query totalCollectionEvents($id: ID!, $and: [EventWhereInput!]) {
  list: eventsConnection(where: {nft: {collection: {id_eq: $id}}, AND: $and }, orderBy: meta_DESC) {
    count: totalCount
  }
  max: events(where: {nft: {collection: {id_eq: $id}}, AND: $and }, orderBy: meta_DESC, limit: 1) {
    id
    meta
  }
}

@Jarsen136
Copy link
Contributor Author

Jarsen136 commented Mar 16, 2022

query totalCollectionEvents($id: ID!, $and: [EventWhereInput!]) {
  list: eventsConnection(where: {nft: {collection: {id_eq: $id}}, AND: $and }, orderBy: meta_DESC) {
    count: totalCount
  }
  max: events(where: {nft: {collection: {id_eq: $id}}, AND: $and }, orderBy: meta_DESC, limit: 1) {
    id
    meta
  }
}

Thanks for your idea! This solution can get the 'totalCount' correctly, but don't work well on 'max' because of the sorting method. Meta is a string type so that the sorting result is not correct.
In my pull request, I transform the string to number and then sort the meta number. It can get the correct result.

I think we need a custom sorting method in graphql. graphql/graphql-spec#8

Any ideas? @vikiival

@vikiival
Copy link
Member

Any ideas? @vikiival

Yup, we need to write the resolver to the kodadot/rubick which will return the correct max and count

@Jarsen136
Copy link
Contributor Author

Thanks, I will have a try!

@yangwao
Copy link
Member

yangwao commented Mar 19, 2022

Now it needs to redeploy 👀

@vikiival
Copy link
Member

Waiting to resolve kodadot/rubick#37

@Jarsen136
Copy link
Contributor Author

Jarsen136 commented Mar 21, 2022

Waiting to resolve kodadot/rubick#37

Hi, it seems that the new resolver has been merged into main branch. I wonder when it will be deployed well so that I could change the frontend code. @vikiival

@vikiival
Copy link
Member

@Jarsen136 🦑 should be up in a couple of minutes

@Jarsen136 Jarsen136 requested a review from vikiival March 21, 2022 11:34
@yangwao
Copy link
Member

yangwao commented Mar 24, 2022

Can we test this so we can launch it with the upcoming push to production? cc @vikiival

@vikiival
Copy link
Member

Can we test this so we

yup

@vikiival
Copy link
Member

vikiival commented Apr 2, 2022

@Jarsen136 please add translations and we are good to go 🫣

@yangwao
Copy link
Member

yangwao commented Apr 2, 2022

Follow up issue

  • add translations
  • plus fix alignment
    image

@yangwao
Copy link
Member

yangwao commented Apr 2, 2022

pay 300 usd

@yangwao
Copy link
Member

yangwao commented Apr 2, 2022

😍 Perfect, I’ve sent the payout
💵 $300 @ 196.55 USD/KSM ~ 1.526 $KSM
🧗 Caiv9TbPz68q5dC8EcHu5xKYPRnremimGzqmEejDFNpWWLG
🔗 0xf5bd7c31947c7238ccdc88afcf5cfeee39fa72d6ed987b97ef904aa2307af3ae

🪅 Let’s grab another issue and get rewarded!
🪄 github.com/kodadot/nft-gallery/issues

@yangwao yangwao merged commit 82bb527 into kodadot:main Apr 2, 2022
@yangwao yangwao added the paid pull-request has been paid label Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
paid pull-request has been paid
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add max buy and reorder collection insights
3 participants