File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
app/profile/[login]/ranks/utils Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 11import { RankingType } from '@/types/ranking.types' ;
22
33export function getBestRankType ( params : {
4- ownedStars ?: number ;
5- contributedStars ?: number ;
6- followersCount ?: number ;
4+ ownedStars ?: number | null ;
5+ contributedStars ?: number | null ;
6+ followersCount ?: number | null ;
77} ) : RankingType {
8- const { ownedStars = Infinity , contributedStars = Infinity , followersCount = Infinity } = params ;
8+ const { ownedStars, contributedStars, followersCount } = params ;
99
10- if ( ownedStars < contributedStars && ownedStars < followersCount ) {
10+ if (
11+ ( ownedStars || Infinity ) < ( contributedStars || Infinity ) &&
12+ ( ownedStars || Infinity ) < ( followersCount || Infinity )
13+ ) {
1114 return RankingType . Star ;
1215 }
1316
14- if ( contributedStars < followersCount ) {
17+ if ( ( contributedStars || Infinity ) < ( followersCount || Infinity ) ) {
1518 return RankingType . Contribution ;
1619 }
1720
You can’t perform that action at this time.
0 commit comments