Skip to content

Commit c3aa816

Browse files
committed
fixed some basic bugs
1 parent 82444ac commit c3aa816

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Distribution/Server/Features/PackageRank.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ import System.FilePath ( isExtensionOf )
4242
import qualified System.IO as SIO
4343

4444
data Scorer = Scorer
45-
{ maximum :: Float
45+
{ maximumS :: Float
4646
, score :: Float
4747
}
4848
deriving Show
4949

5050
instance Semigroup Scorer where
51-
(Scorer a b) <> (Scorer c d) = Scorer (a + b) (c + d)
51+
(Scorer a b) <> (Scorer c d) = Scorer (a + c) (b + d)
5252

5353
scorer :: Float -> Float -> Scorer
5454
scorer maxim scr =
@@ -62,7 +62,7 @@ boolScor k True = Scorer k k
6262
boolScor k False = Scorer k 0
6363

6464
total :: Scorer -> Float
65-
total (Scorer a b) = a / b
65+
total (Scorer a b) = b / a
6666

6767
major :: Num a => [a] -> a
6868
major (x : _) = x
@@ -257,7 +257,7 @@ rankPackagePage p = tests <> benchs <> desc <> homeP <> sourceRp <> cats
257257
where
258258
tests = boolScor 50 (hasTests p)
259259
benchs = boolScor 10 (hasBenchmarks p)
260-
desc = Scorer 30 (min 1 (int2Float (S.length $ description p) / 300))
260+
desc = scorer 30 (min 1 (int2Float (S.length $ description p) / 300))
261261
-- documentation = boolScor 30 ()
262262
homeP = boolScor 30 (not $ S.null $ homepage p)
263263
sourceRp = boolScor 8 (not $ null $ sourceRepos p)

0 commit comments

Comments
 (0)