listAllContracts: sort by createdTime by default
This commit is contained in:
parent
650aa68bcd
commit
3313b55853
|
@ -125,9 +125,10 @@ export async function listTaggedContractsCaseInsensitive(
|
|||
|
||||
export async function listAllContracts(
|
||||
n: number,
|
||||
before?: string
|
||||
before?: string,
|
||||
sortDescBy = 'createdTime'
|
||||
): Promise<Contract[]> {
|
||||
let q = query(contracts, orderBy('popularityScore', 'desc'), limit(n))
|
||||
let q = query(contracts, orderBy(sortDescBy, 'desc'), limit(n))
|
||||
if (before != null) {
|
||||
const snap = await getDoc(doc(contracts, before))
|
||||
q = query(q, startAfter(snap))
|
||||
|
|
|
@ -4,7 +4,7 @@ import { getServerSideSitemap, ISitemapField } from 'next-sitemap'
|
|||
import { listAllContracts } from 'web/lib/firebase/contracts'
|
||||
|
||||
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||
const contracts = await listAllContracts(1000, undefined)
|
||||
const contracts = await listAllContracts(1000, undefined, 'popularityScore')
|
||||
|
||||
const score = (popularity: number) => Math.tanh(Math.log10(popularity + 1))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user