mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
do not rank candidates and just return them all if less than 10 candidates
This commit is contained in:
parent
d1d7f93fc3
commit
c7de24e9f8
4 changed files with 11 additions and 10 deletions
|
|
@ -1310,7 +1310,7 @@ export type HomeItem = {
|
|||
likeCount?: Maybe<Scalars['Int']>;
|
||||
previewContent?: Maybe<Scalars['String']>;
|
||||
saveCount?: Maybe<Scalars['Int']>;
|
||||
score: Scalars['Float'];
|
||||
score?: Maybe<Scalars['Float']>;
|
||||
seen_at?: Maybe<Scalars['Date']>;
|
||||
slug?: Maybe<Scalars['String']>;
|
||||
source?: Maybe<HomeItemSource>;
|
||||
|
|
@ -6103,7 +6103,7 @@ export type HomeItemResolvers<ContextType = ResolverContext, ParentType extends
|
|||
likeCount?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>;
|
||||
previewContent?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
||||
saveCount?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>;
|
||||
score?: Resolver<ResolversTypes['Float'], ParentType, ContextType>;
|
||||
score?: Resolver<Maybe<ResolversTypes['Float']>, ParentType, ContextType>;
|
||||
seen_at?: Resolver<Maybe<ResolversTypes['Date']>, ParentType, ContextType>;
|
||||
slug?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
||||
source?: Resolver<Maybe<ResolversTypes['HomeItemSource']>, ParentType, ContextType>;
|
||||
|
|
|
|||
|
|
@ -1179,7 +1179,7 @@ type HomeItem {
|
|||
likeCount: Int
|
||||
previewContent: String
|
||||
saveCount: Int
|
||||
score: Float!
|
||||
score: Float
|
||||
seen_at: Date
|
||||
slug: String
|
||||
source: HomeItemSource
|
||||
|
|
|
|||
|
|
@ -159,6 +159,11 @@ const rankCandidates = async (
|
|||
userId: string,
|
||||
candidates: Array<Candidate>
|
||||
): Promise<Array<Candidate>> => {
|
||||
if (candidates.length <= 10) {
|
||||
logger.info('Not enough candidates to rank')
|
||||
return candidates
|
||||
}
|
||||
|
||||
const unscoredCandidates = candidates.filter((item) => item.score === 0)
|
||||
|
||||
const data = {
|
||||
|
|
@ -396,8 +401,8 @@ export const updateHome = async (data: UpdateHomeJobData) => {
|
|||
message: `Found ${candidates.length} candidates`,
|
||||
})
|
||||
|
||||
if (candidates.length <= 10) {
|
||||
logger.info('Not enough candidates found')
|
||||
if (candidates.length === 0) {
|
||||
logger.info('No candidates found')
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -405,10 +410,6 @@ export const updateHome = async (data: UpdateHomeJobData) => {
|
|||
|
||||
logger.profile('ranking')
|
||||
const rankedCandidates = await rankCandidates(userId, candidates)
|
||||
if (rankedCandidates.length === 0) {
|
||||
logger.info('No candidates found')
|
||||
return
|
||||
}
|
||||
logger.profile('ranking', {
|
||||
level: 'info',
|
||||
message: `Ranked ${rankedCandidates.length} candidates`,
|
||||
|
|
|
|||
|
|
@ -3148,7 +3148,7 @@ const schema = gql`
|
|||
canShare: Boolean
|
||||
canArchive: Boolean
|
||||
canDelete: Boolean
|
||||
score: Float!
|
||||
score: Float
|
||||
}
|
||||
|
||||
type HomeSection {
|
||||
|
|
|
|||
Loading…
Reference in a new issue