amy-jung / collectivedaoarchives.catalog

The Collective DAO Catalog is an open source index of DAO historical events. Together, as an open source database that anyone can contribute to, we can use the power of collective intelligence to highlight patterns and improve the development of new and existing DAOs
https://www.daocatalog.xyz/
MIT License
6 stars 1 forks source link

Show recent records on the home page #70

Open damianmarti opened 6 months ago

damianmarti commented 6 months ago

closes #68

vercel[bot] commented 6 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
collectivedaoarchives-catalog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 27, 2024 10:27am
carletex commented 6 months ago

Hey @damianmarti ,

now the ones that show first, are the ones that don't have a Date:

image

damianmarti commented 6 months ago

Hey @damianmarti ,

now the ones that show first, are the ones that don't have a Date:

image

Thanks @carletex

Now I'm filtering the records with date not null.

carletex commented 6 months ago

Hey @damianmarti thanks for this!

I see one «problem» when filtering out the ones without a date: the /records page uses the same endpoint

This is off because of it: (total count still gets ALL the records) image

Not sure if this is a big deal, but just mentioning it here.


I remember tweaking the search query for this same reason, but it was rawSQL: "date-desc": Prisma.sqlCASE WHEN date IS NULL THEN 1 ELSE 0 END, "date" DESC,

What do you think?

damianmarti commented 6 months ago

Hey @damianmarti thanks for this!

I see one «problem» when filtering out the ones without a date: the /records page uses the same endpoint

This is off because of it: (total count still gets ALL the records) image

Not sure if this is a big deal, but just mentioning it here.

I remember tweaking the search query for this same reason, but it was rawSQL: "date-desc": Prisma.sqlCASE WHEN date IS NULL THEN 1 ELSE 0 END, "date" DESC,

What do you think?

Thanks!! I thought it was not used in another place. Let me check for a better solution.

damianmarti commented 6 months ago

@carletex please take a look now. I created a new backend endpoint for the home records, so we can do whatever we want to the records shown on the home page and not affect the rest of the site. Thanks and sorry for the previous issues!

carletex commented 6 months ago

@carletex please take a look now. I created a new backend endpoint for the home records, so we can do whatever we want to the records shown on the home page and not affect the rest of the site. Thanks and sorry for the previous issues!

This still has the same problem on the /records page, since we are filtering out the records with no dates (and pagination is off because off it too)

Let me try to come up with a solution!

carletex commented 6 months ago

@damianmarti so I added this: https://github.com/amy-jung/collectivedaoarchives.catalog/pull/70/commits/80fcb74dce710768db6eecdbb900ec0ba176d525

It's a raw query so we can order elements with no date at the end and everything keeps working the same.

Let me know what you think. Thanks!!

damianmarti commented 6 months ago

@carletex Oh, no, sorry! I forgot to push the changes to records.ts, to leave it at it was before, so the change only affects the home page!

Your change looks good, I was trying to avoid using raw SQL to keep it simple.

We can go with your change or we can add again the backend endpoint for the home page, but keeping the records endpoint as it was before. Please let me know what you prefer. Thanks!!

carletex commented 6 months ago

We can go with your change or we can add again the backend endpoint for the home page, but keeping the records endpoint as it was before. Please let me know what you prefer. Thanks!!

The only PRO I see of doing the raw SQL is that we are also sorting by date DESC correctly on the /records page. If we don't need that, let's use the homepage endpoint.

Let's ask @amy-jung !!

Amy, do we want to sort by date DESC the /records page, or just the homepage?

Thanks all! <3

amy-jung commented 6 months ago

Sorry what is DESC?

Ideally we would just have both! (Assuming when you search, the default is by closest to search, then by date)

damianmarti commented 6 months ago

Sorry what is DESC?

Ideally we would just have both! (Assuming when you search, the default is by closest to search, then by date)

It means the most recent record first. We can show the most recent records on the home page and with the same ordering on the records page too. Is it ok for you?