submission exists api
This commit is contained in:
@@ -94,11 +94,11 @@ def check_contest_permission(check_type="details"):
|
||||
(self.contest.id not in request.session["accessible_contests"]):
|
||||
return self.error("Password is required.")
|
||||
|
||||
# regular use get contest problems, ranks etc. before contest started
|
||||
# regular user get contest problems, ranks etc. before contest started
|
||||
if self.contest.status == ContestStatus.CONTEST_NOT_START and check_type != "details":
|
||||
return self.error("Contest has not started yet.")
|
||||
|
||||
# check is user have permission to get ranks, submissions OI Contest
|
||||
# check does user have permission to get ranks, submissions OI Contest
|
||||
if self.contest.status == ContestStatus.CONTEST_UNDERWAY and self.contest.rule_type == ContestRuleType.OI:
|
||||
if not self.contest.real_time_rank and (check_type == "ranks" or check_type == "submissions"):
|
||||
return self.error(f"No permission to get {check_type}")
|
||||
|
||||
@@ -21,7 +21,7 @@ class UserAdminAPI(APIView):
|
||||
data = request.data["users"]
|
||||
omitted_count = created_count = get_count = 0
|
||||
for user_data in data:
|
||||
if len(user_data) != 3:
|
||||
if len(user_data) != 3 or len(user_data[0]) > 32:
|
||||
omitted_count += 1
|
||||
continue
|
||||
user, created = User.objects.get_or_create(username=user_data[0])
|
||||
@@ -167,7 +167,7 @@ class GenerateUserAPI(APIView):
|
||||
number_max_length = max(len(str(data["number_from"])), len(str(data["number_to"])))
|
||||
if number_max_length + len(data["prefix"]) + len(data["suffix"]) > 32:
|
||||
return self.error("Username should not more than 32 characters")
|
||||
if data["number_from"] >= data["number_to"]:
|
||||
if data["number_from"] > data["number_to"]:
|
||||
return self.error("Start number must be lower than end number")
|
||||
|
||||
password_length = data.get("password_length", 8)
|
||||
|
||||
Reference in New Issue
Block a user