Skip to content

Commit 830cfd5

Browse files
committed
fixed some bugs
1 parent 30d48cc commit 830cfd5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Distribution/Server/Features/PackageRank.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,17 @@ rankIO
112112
-> ServerEnv
113113
-> TarIndexCacheFeature
114114
-> [PkgInfo]
115+
-> PkgInfo
115116
-> IO Scorer
116117

117-
rankIO _ _ _ _ _ _ [] = return (Scorer (118 + 16 + 4 + 1) 0)
118-
rankIO vers recentDownloads maintainers docs env tarCache pkgs = do
118+
rankIO _ _ _ _ _ _ _ Nothing = return (Scorer (118 + 16 + 4 + 1) 0)
119+
rankIO vers recentDownloads maintainers docs env tarCache pkgs pkg = do
119120
temp <- temporalScore pkg lastUploads versionList recentDownloads
120121
versS <- versionScore versionList vers lastUploads pkg
121122
codeS <- codeScore documentLines srcLines
122123
return (temp <> versS <> codeS <> authorScore maintainers pkg)
123124

124125
where
125-
pkg = packageDescription <$> pkgDesc $ last pkgs
126126
pkgId = package pkg
127127
lastUploads =
128128
sortBy (flip compare)
@@ -132,10 +132,10 @@ rankIO vers recentDownloads maintainers docs env tarCache pkgs = do
132132
versionList = sortBy (flip compare)
133133
$ map (pkgVersion . package . packageDescription) (pkgDesc <$> pkgs)
134134
packageEntr = do
135-
tarB <- mapM (packageTarball tarCache) (safeHead pkgs)
135+
tarB <- packageTarball tarCache $ pkg
136136
return
137137
$ (\(path, _, index) -> (path, ) <$> T.lookup index path)
138-
=<< (join $ rightToMaybe <$> tarB)
138+
=<< rightToMaybe tarB
139139
rightToMaybe (Right a) = Just a
140140
rightToMaybe (Left _) = Nothing
141141

@@ -279,5 +279,5 @@ rankPackage
279279
rankPackage versions recentDownloads maintainers docs tarCache env pkgs =
280280
total
281281
. (<>) (rankPackagePage pkgD)
282-
<$> rankIO versions recentDownloads maintainers docs env tarCache pkgs
282+
<$> rankIO versions recentDownloads maintainers docs env tarCache pkgs (safeLast pkgs)
283283
where pkgD = packageDescription . pkgDesc <$> safeLast pkgs

0 commit comments

Comments
 (0)