Yichong Lu commited on
Commit
e9b1c22
·
1 Parent(s): fcc6e41
Files changed (2) hide show
  1. competitions/app.py +6 -6
  2. competitions/utils.py +2 -4
competitions/app.py CHANGED
@@ -332,7 +332,7 @@ def new_submission(
332
  if team_id not in team_file_api.get_team_white_list():
333
  return {"response": "You are not allowed to make submissions."}
334
 
335
- team_submission_limit_dict = team_file_api.get_team_submission_limit(user_token)
336
 
337
  lock = FileLock(f"./submission_lock/{team_id}.lock", blocking=False)
338
  try:
@@ -340,11 +340,11 @@ def new_submission(
340
  if submission_api.exists_submission_info(team_id) and submission_api.count_by_status(team_id, [SubmissionStatus.QUEUED, SubmissionStatus.PENDING, SubmissionStatus.PROCESSING]) > 0:
341
  return {"response": "Another submission is being processed. Please wait a moment."}
342
  competition_info = CompetitionInfo(competition_id=COMPETITION_ID, autotrain_token=HF_TOKEN)
343
- # if team_id in team_submission_limit_dict.keys():
344
- # submission_limit = team_submission_limit_dict[team_id]
345
- # else:
346
- # submission_limit = competition_info.submission_limit
347
- submission_limit = competition_info.submission_limit
348
  sub = Submissions(
349
  end_date=competition_info.end_date,
350
  submission_limit=submission_limit,
 
332
  if team_id not in team_file_api.get_team_white_list():
333
  return {"response": "You are not allowed to make submissions."}
334
 
335
+ team_submission_limit_dict = team_file_api.get_team_submission_limit()
336
 
337
  lock = FileLock(f"./submission_lock/{team_id}.lock", blocking=False)
338
  try:
 
340
  if submission_api.exists_submission_info(team_id) and submission_api.count_by_status(team_id, [SubmissionStatus.QUEUED, SubmissionStatus.PENDING, SubmissionStatus.PROCESSING]) > 0:
341
  return {"response": "Another submission is being processed. Please wait a moment."}
342
  competition_info = CompetitionInfo(competition_id=COMPETITION_ID, autotrain_token=HF_TOKEN)
343
+ if team_id in team_submission_limit_dict.keys():
344
+ submission_limit = team_submission_limit_dict[team_id]
345
+ else:
346
+ submission_limit = competition_info.submission_limit
347
+ # submission_limit = competition_info.submission_limit
348
  sub = Submissions(
349
  end_date=competition_info.end_date,
350
  submission_limit=submission_limit,
competitions/utils.py CHANGED
@@ -418,10 +418,8 @@ class TeamFileApi:
418
  )
419
 
420
  with open(file, "r", encoding="utf-8") as f:
421
- try:
422
- team_submission_limit = json.load(f)
423
- except json.decoder.JSONDecodeError as e:
424
- print(f"Error decoding JSON: {e}")
425
  return team_submission_limit
426
 
427
 
 
418
  )
419
 
420
  with open(file, "r", encoding="utf-8") as f:
421
+ team_submission_limit = json.load(f)
422
+
 
 
423
  return team_submission_limit
424
 
425