mirror of
https://github.com/ltcptgeneral/cs239-caching.git
synced 2025-04-01 12:33:25 +00:00
Merge branch 'main' of https://github.com/ltcptgeneral/cs239-caching
This commit is contained in:
commit
474d827de6
@ -28,7 +28,8 @@ def get_friends(user_id, num_friends):
|
||||
random.seed(0)
|
||||
if not curr_user:
|
||||
return {}
|
||||
for f in random.sample(curr_user[0]["friends"], num_friends):
|
||||
sample_size = min(num_friends, len(curr_user[0]["friends"]))
|
||||
for f in random.sample(curr_user[0]["friends"], sample_size):
|
||||
friends[f] = db.search(User.user_id == user_id)[0]
|
||||
return friends
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user