Nattyboi commited on
Commit
beb1fb0
·
1 Parent(s): 964d262

added the ability for leaderboard to be recalculated upon every new point, which may slow down performance so I will make it a background process

Browse files
Files changed (1) hide show
  1. app.py +2 -6
app.py CHANGED
@@ -524,15 +524,11 @@ def handle_change(change=None,new_point=None):
524
  print("inserting user",f"user id {user['_id']}")
525
  points = get_all_simple_points_func(userId=str(user['_id']))
526
  tempDreamJob = get_dream_job(userId=str(user['_id']))
 
527
  dreamJob = tempDreamJob if type(tempDreamJob)==str else "IncompleteProfile"
528
 
529
  create_leaderboard_ranking(LeaderBoardRanking(userId=str(user['_id']),firstName=user['first_name'],lastName=user['last_name'],totalpoints=points.totalpoints,lastUpdated=datetime.now(),careerPath=dreamJob,))
530
- leaderBoardcollection = db['LeaderBoard']
531
- # index = leaderBoardcollection.create_index([
532
- # ('lastName', 1),
533
- # ('totalpoints', -1)
534
- # ])
535
- # print("index",index)
536
  else:
537
  if change['operationType'] == 'insert':
538
  # Extract the full document
 
524
  print("inserting user",f"user id {user['_id']}")
525
  points = get_all_simple_points_func(userId=str(user['_id']))
526
  tempDreamJob = get_dream_job(userId=str(user['_id']))
527
+
528
  dreamJob = tempDreamJob if type(tempDreamJob)==str else "IncompleteProfile"
529
 
530
  create_leaderboard_ranking(LeaderBoardRanking(userId=str(user['_id']),firstName=user['first_name'],lastName=user['last_name'],totalpoints=points.totalpoints,lastUpdated=datetime.now(),careerPath=dreamJob,))
531
+
 
 
 
 
 
532
  else:
533
  if change['operationType'] == 'insert':
534
  # Extract the full document