Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -95,11 +95,11 @@ scheduler.start()
|
|
95 |
"""
|
96 |
|
97 |
|
98 |
-
|
99 |
return int(xp ** (1.0 / 3.0))
|
100 |
|
101 |
|
102 |
-
|
103 |
return (int(level ** 3))
|
104 |
|
105 |
|
@@ -203,7 +203,7 @@ async def add_exp(member_id):
|
|
203 |
|
204 |
|
205 |
# level up
|
206 |
-
current_level =
|
207 |
print(f"Current_level for {member}: {current_level}")
|
208 |
if current_level >= 2 and current_level <=30:
|
209 |
current_role = lvls[current_level]
|
@@ -224,7 +224,7 @@ async def add_exp(member_id):
|
|
224 |
xp = 10 # define somewhere else?
|
225 |
member_id = str(member_id)
|
226 |
member_name = str(member.name)
|
227 |
-
current_level =
|
228 |
row_data = [member_id, member_name, xp, current_level]
|
229 |
global_df.loc[len(global_df.index)] = row_data
|
230 |
|
@@ -313,8 +313,8 @@ async def update_leaderboard(ctx, num_results: int = 10): # needs rewrite
|
|
313 |
|
314 |
|
315 |
def xp_required_to_next_level(current_level, current_xp):
|
316 |
-
level_floor_xp =
|
317 |
-
level_ceiling_xp =
|
318 |
xp_to_level_up = level_ceiling_xp - current_xp
|
319 |
return (xp_to_level_up)
|
320 |
|
|
|
95 |
"""
|
96 |
|
97 |
|
98 |
+
def calculate_level(xp):
|
99 |
return int(xp ** (1.0 / 3.0))
|
100 |
|
101 |
|
102 |
+
def calculate_xp(level):
|
103 |
return (int(level ** 3))
|
104 |
|
105 |
|
|
|
203 |
|
204 |
|
205 |
# level up
|
206 |
+
current_level = calculate_level(new_xp)
|
207 |
print(f"Current_level for {member}: {current_level}")
|
208 |
if current_level >= 2 and current_level <=30:
|
209 |
current_role = lvls[current_level]
|
|
|
224 |
xp = 10 # define somewhere else?
|
225 |
member_id = str(member_id)
|
226 |
member_name = str(member.name)
|
227 |
+
current_level = calculate_level(xp)
|
228 |
row_data = [member_id, member_name, xp, current_level]
|
229 |
global_df.loc[len(global_df.index)] = row_data
|
230 |
|
|
|
313 |
|
314 |
|
315 |
def xp_required_to_next_level(current_level, current_xp):
|
316 |
+
level_floor_xp = calculate_xp(current_level)
|
317 |
+
level_ceiling_xp = calculate_xp(current_level+1)
|
318 |
xp_to_level_up = level_ceiling_xp - current_xp
|
319 |
return (xp_to_level_up)
|
320 |
|