Skip to content

Commit 9491f42

Browse files
committed
Hotfix User.github_repositories sort
1 parent c8d9dc4 commit 9491f42

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/models/user.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ def github_repositories
366366
end
367367

368368
def github_repositories_cache_key
369-
"github-repos:#{github}"
369+
"github-repos:#{github}:1"
370370
end
371371

372372
def self.fetch_github_repositories(user_id)
@@ -396,7 +396,7 @@ def self.fetch_github_repositories(user_id)
396396
description: a1['description']
397397
}
398398
end
399-
items = items.sort_by { |item| item[:watchers] }.take(10)
399+
items = items.sort { |a, b| b[:watchers] <=> a[:watchers] }.take(10)
400400
$file_store.write(user.github_repositories_cache_key, items, expires_in: 15.days)
401401
items
402402
end

0 commit comments

Comments
 (0)