Git Product home page Git Product logo

Comments (15)

hassnian avatar hassnian commented on September 27, 2024 1

thread where we discussed this


query x {
  tokenEntityList(orderBy: [
    "price_ASC"
  ]) {
    cheapest {
      price
    }
  }
}

returns

{
  "data": {
    "tokenEntityList": [
      {
        "cheapest": {
          "price": "0"
        }
      },
      {
        "cheapest": {
          "price": "0"
        }
      },
      {
        "cheapest": {
          "price": "0"
        }
      }
       ....

    ]
  }
}

when this filter is applied it should show listed first - sorted by price and then the rest

shows non-listed first , but we need listed first sorted by price and then non-listed

from stick.

roiLeo avatar roiLeo commented on September 27, 2024 1

query x {
tokenEntityList(orderBy: [
"price_ASC"
]) {
cheapest {
price
}
}
}

you should be able to remove "0" price

query x {
  tokenEntityList(orderBy: ["price_ASC"], limit: 10, price_gt: 0) {
    cheapest {
      price
    }
  }
}

from stick.

exezbcz avatar exezbcz commented on September 27, 2024 1

It does not make sense show unlisted nft as they do not have price,

yes it does, because you don't have to have buy now filter applied to see low to high price sort

from stick.

vikiival avatar vikiival commented on September 27, 2024 1

Thanks for the explanation @exezbcz

therefore I have only two possible solutions:
Check how does the null behaves
or introduce new field like listed: boolean and hack it the way that sorting works

EDIT:

soo appartently nulls last would work

Just figure out how to write it in query

from stick.

vikiival avatar vikiival commented on September 27, 2024 1

So got to the point:

  • we either do resolver for this
  • introduce something called "priority / score" that would give NFT score and therefore renders it with some score - unlisted will have lower score than listed

from stick.

exezbcz avatar exezbcz commented on September 27, 2024

👀

from stick.

vikiival avatar vikiival commented on September 27, 2024

Isnt this issue of the query than the app ?

from stick.

exezbcz avatar exezbcz commented on September 27, 2024

cc @hassnian

from stick.

hassnian avatar hassnian commented on September 27, 2024

query x {
tokenEntityList(orderBy: [
"price_ASC"
]) {
cheapest {
price
}
}
}

you should be able to remove "0" price

query x {
  tokenEntityList(orderBy: ["price_ASC"], limit: 10, price_gt: 0) {
    cheapest {
      price
    }
  }
}

@roiLeo yep, thought the same.

my concern was regarding pagination.

so for example, you have x pages of listed items. where you use the query above, then when there aren't more items, you show non-listed using priceEq: '0'

once we change the query first and offset which uses page are not the same as the first query

I reckon this can be done but wouldn't this add more complexity or am I missing something?

from stick.

roiLeo avatar roiLeo commented on September 27, 2024

my concern was regarding pagination.

use offset?

so for example, you have x pages of listed items. where you use the query above, then when there aren't more items, you show non-listed using priceEq: '0'

once we change the query first and offset which uses page are not the same as the first query

Do you have a query to illustrate your example?

I reckon this can be done but wouldn't this add more complexity or am I missing something?

if it add more complexity on the frontend then it's a data issue and should be fixed on backend

from stick.

hassnian avatar hassnian commented on September 27, 2024

ItemsGrid.vue -> useFetchSearch (153 line) -> useItemsGrid.ts (useFetchSearch) (141 line) we have

    const defaultSearchVariables = {
      first: first.value,
      offset: (page - 1) * first.value,
      orderBy: getRouteQueryOrderByDefault(route.query.sort, [
        'blockNumber_DESC',
      ]),
    }

to calculate the offset we use page and first which is 40

we can use this query for the listed items

query x {
  tokenEntityList(
    limit: 40,
    price_gt: 0,
    offset: 0,
    orderBy: [
    "price_ASC"
  ]) {
    id
    cheapest {
      price
    }
  }
}

let's say that we are on page 10 and we don't have more listed items , next page 11 , now we can use this query

query x {
  tokenEntityList(
    limit: 40,
    price_lte: 0,
    offset: 400,
    orderBy: [
    "price_ASC"
  ]) {
    id
    cheapest {
      price
    }
  }
}

  offset: (page - 1) * first.value,

page 11 would be 400 offset ((11 -1) * 40) , but that wouldn't be right since the first. 400 items of this query are not the same as the other one.

so we would need to change the offset logic to start from 0 here , also keep track of this new "page" for the second query

also some parts useListInfiniteScroll wouldn't work as expected , for exampletotal would be wrong

    const { entities, count } = getQueryResults(result.value)
    total.value = count

CleanShot 2024-01-22 at 15 17 20@2x

to make this work, wouldn't we end up adding more complexity?

I hope my concern is clearer now.

let me know if it's a non-issue and I'm missing something.

thanks

from stick.

vikiival avatar vikiival commented on September 27, 2024

it's a data issue and should be fixed on backend

Like what specifically? What have you illustrated is matter of query

I hope my concern is clearer now.

I do not understand, sorry

Can you plase say

What is the expected output?

If it is this one

when this filter is applied it should show listed first - sorted by price and then the rest - by @exezbcz

It does not make sense show unlisted nft as they do not have price,
The only one thing that could make sense is to check how null behaves.

from stick.

yangwao avatar yangwao commented on September 27, 2024
  • we either do resolver for this

isn't easier this one?

from stick.

vikiival avatar vikiival commented on September 27, 2024

isn't easier this one?

Then you need to rewrite most of the view page. (I am not against)

from stick.

vikiival avatar vikiival commented on September 27, 2024

So apparently it exists on SubSquid.

Screenshot 2024-01-23 at 14 31 06

So guess #194 will fix it

from stick.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.