Spaces:
Running on CPU Upgrade

lunarflu HF Staff commited on
Commit
8c6117d
·
verified ·
1 Parent(s): 65ae6b1

replacing startswith with [] for integers

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -242,11 +242,11 @@ async def add_exp(member_id):
242
  # str -> int temporarily
243
  new_xp = int(old_xp) + XP_PER_MESSAGE
244
  # check + convert back to string + google sheet proofing
245
- if not new_xp.startswith("L") and not new_xp.endswith("L"):
246
  new_xp = f"L" + str(new_xp) + f"L"
247
 
248
  # add back to dataframe in memory after checking redundantly;
249
- if new_xp.startswith("L") and new_xp.endswith("L"):
250
  global_df.loc[index, 'discord_exp'] = new_xp # do not change column name
251
  print(f"Record for {member} updated from {old_xp} to {global_df.loc[index, 'discord_exp']} (+{XP_PER_MESSAGE}) ")
252
 
@@ -354,7 +354,7 @@ async def add_exp(member_id):
354
  print(f"Creating new record for {member}")
355
 
356
  xp = 10 # define somewhere else?
357
- if not xp.startswith("L") and not xp.endswith("L"):
358
  xp = f"L" + str(xp) + f"L"
359
  member_id = str(member_id)
360
  if not member_id.startswith("L") and not member_id.endswith("L"):
 
242
  # str -> int temporarily
243
  new_xp = int(old_xp) + XP_PER_MESSAGE
244
  # check + convert back to string + google sheet proofing
245
+ if not new_xp[0] == "L" and not new_xp[-1] == "L":
246
  new_xp = f"L" + str(new_xp) + f"L"
247
 
248
  # add back to dataframe in memory after checking redundantly;
249
+ if new_xp[0] == "L" and new_xp[-1] == "L":
250
  global_df.loc[index, 'discord_exp'] = new_xp # do not change column name
251
  print(f"Record for {member} updated from {old_xp} to {global_df.loc[index, 'discord_exp']} (+{XP_PER_MESSAGE}) ")
252
 
 
354
  print(f"Creating new record for {member}")
355
 
356
  xp = 10 # define somewhere else?
357
+ if not xp[0] == "L" and not xp[-1] == "L":
358
  xp = f"L" + str(xp) + f"L"
359
  member_id = str(member_id)
360
  if not member_id.startswith("L") and not member_id.endswith("L"):