kodadot / nft-gallery

Generative Art Marketplace
https://koda.art
MIT License
645 stars 363 forks source link

Filter selection order changes result's order #10054

Open hassnian opened 7 months ago

hassnian commented 7 months ago
          something is not right

scenario a: sort by "Least Supply" and after add "Newest" scenario b: sort by "Newest" and after add "Least Supply"

Expected

Grid order to be same

Originally posted by @daiagi in https://github.com/kodadot/nft-gallery/issues/10039#issuecomment-2046854936


> Grid order to be same

well, order wont be the same as preffered sorting is the first one and then second applied

This is a default behaviour of PSQL :) only if we would sort the filters?

select id, name, supply, created_at from collection_entity order by created_at desc, supply limit 10;
[
  {
    "id": "119",
    "name": "Aurora",
    "supply": 0,
    "created_at": "2024-04-09 12:32:12.000000 +00:00"
  },
  {
    "id": "118",
    "name": null,
    "supply": 0,
    "created_at": "2024-04-09 12:09:24.000000 +00:00"
  },
  {
    "id": "117",
    "name": "Eka the Italian Greyhound & friends",
    "supply": 14,
    "created_at": "2024-04-01 10:46:24.000000 +00:00"
  },
  {
    "id": "116",
    "name": "Shapes",
    "supply": 81,
    "created_at": "2024-03-27 12:51:48.000000 +00:00"
  },
  {
    "id": "115",
    "name": "Tilescapes",
    "supply": 96,
    "created_at": "2024-03-26 12:50:48.000000 +00:00"
  },
  {
    "id": "114",
    "name": "Tied to Pink",
    "supply": 0,
    "created_at": "2024-03-21 10:04:36.000000 +00:00"
  },
  {
    "id": "113",
    "name": "The Break",
    "supply": 16,
    "created_at": "2024-03-19 11:02:06.000000 +00:00"
  },
  {
    "id": "112",
    "name": "Convergente",
    "supply": 171,
    "created_at": "2024-03-12 05:50:36.000000 +00:00"
  },
  {
    "id": "111",
    "name": "KodaDot at Sub0 Asia 2024",
    "supply": 21,
    "created_at": "2024-03-12 04:55:00.000000 +00:00"
  },
  {
    "id": "110",
    "name": "Buddhist Scriptures",
    "supply": 30,
    "created_at": "2024-03-08 08:14:48.000000 +00:00"
  }
]
select id, name, supply, created_at from collection_entity order by supply, created_at desc limit 10;
[
  {
    "id": "119",
    "name": "Aurora",
    "supply": 0,
    "created_at": "2024-04-09 12:32:12.000000 +00:00"
  },
  {
    "id": "118",
    "name": null,
    "supply": 0,
    "created_at": "2024-04-09 12:09:24.000000 +00:00"
  },
  {
    "id": "114",
    "name": "Tied to Pink",
    "supply": 0,
    "created_at": "2024-03-21 10:04:36.000000 +00:00"
  },
  {
    "id": "109",
    "name": "Buddhist Scriptures",
    "supply": 0,
    "created_at": "2024-03-08 05:55:24.000000 +00:00"
  },
  {
    "id": "105",
    "name": "e1f42999-0c9e-4170-a6fb-17943f4c0832",
    "supply": 0,
    "created_at": "2024-02-26 11:36:36.000000 +00:00"
  },
  {
    "id": "100",
    "name": "Markedot - $PINK is $DED",
    "supply": 0,
    "created_at": "2024-02-20 21:24:18.000000 +00:00"
  },
  {
    "id": "94",
    "name": null,
    "supply": 0,
    "created_at": "2024-02-10 12:26:30.000000 +00:00"
  },
  {
    "id": "90",
    "name": null,
    "supply": 0,
    "created_at": "2024-02-04 17:41:48.000000 +00:00"
  },
  {
    "id": "79",
    "name": "Polkadots",
    "supply": 0,
    "created_at": "2024-01-18 04:13:42.000000 +00:00"
  },
  {
    "id": "75",
    "name": "Cindy Mark I",
    "supply": 0,
    "created_at": "2024-01-09 13:03:06.000000 +00:00"
  }
]

Originally posted by @vikiival in https://github.com/kodadot/nft-gallery/issues/10039#issuecomment-2047263191

kodabot commented 7 months ago

ASSIGNED ISSUES LIMIT REACHED - @hassnian, you have been already assigned with 5 issues: 6955,8163,8890,10050,9921,10069,10071. Finish one of them in order to get more issues assigned!

hassnian commented 7 months ago

up for grabs

sanjaykohli commented 5 months ago

If you want the grid order to be the same in both scenarios, you need to use the same sorting criteria in the same order. If you have specific requirements for sorting that need to be met, you might need to rethink how you're applying those sorting criteria.