Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
print + tryexcept for rank
Browse files
app.py
CHANGED
@@ -83,6 +83,7 @@ async def on_ready():
|
|
83 |
|
84 |
# updates both leaderboards
|
85 |
await remove_huggingfolks() # to initialize
|
|
|
86 |
remove_huggingfolks.start()
|
87 |
#await periodic_api_test()
|
88 |
print(f"------------------------------------------------------------------------")
|
@@ -238,14 +239,14 @@ async def add_exp(member_id):
|
|
238 |
current_role = lvls[current_level]
|
239 |
if current_role not in member.roles: # if we leveled up
|
240 |
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
target_exp = row['discord_exp'].values[0]
|
246 |
rank = (community_global_df['discord_exp'] > target_exp).sum() + 1
|
247 |
print(f"The rank for discord_id {member_id} based on discord_exp is: {rank}")
|
248 |
-
|
249 |
print(f"Discord ID {member_id} not found in the DataFrame.")
|
250 |
rank = "🤗"
|
251 |
|
|
|
83 |
|
84 |
# updates both leaderboards
|
85 |
await remove_huggingfolks() # to initialize
|
86 |
+
print(community_global_df)
|
87 |
remove_huggingfolks.start()
|
88 |
#await periodic_api_test()
|
89 |
print(f"------------------------------------------------------------------------")
|
|
|
239 |
current_role = lvls[current_level]
|
240 |
if current_role not in member.roles: # if we leveled up
|
241 |
|
242 |
+
|
243 |
+
try:
|
244 |
+
# finding leaderboard rank
|
245 |
+
row = community_global_df[community_global_df['discord_user_id'] == str(member_id)] # does this need to be string?
|
246 |
target_exp = row['discord_exp'].values[0]
|
247 |
rank = (community_global_df['discord_exp'] > target_exp).sum() + 1
|
248 |
print(f"The rank for discord_id {member_id} based on discord_exp is: {rank}")
|
249 |
+
except Exception as e:
|
250 |
print(f"Discord ID {member_id} not found in the DataFrame.")
|
251 |
rank = "🤗"
|
252 |
|