Abhishek Thakur
commited on
Commit
·
4447bdd
1
Parent(s):
4cb6f1b
invalidate user token after download
Browse files- competitions/evaluate.py +3 -0
- competitions/submissions.py +5 -5
competitions/evaluate.py
CHANGED
@@ -40,6 +40,9 @@ def generate_submission_file(params):
|
|
40 |
# push the submission.csv file to the repo using upload_submission_file
|
41 |
logger.info("Generating submission file")
|
42 |
|
|
|
|
|
|
|
43 |
# Copy socket-kit.so to submission_dir
|
44 |
shutil.copyfile("socket-kit.so", f"{submission_dir}/socket-kit.so")
|
45 |
|
|
|
40 |
# push the submission.csv file to the repo using upload_submission_file
|
41 |
logger.info("Generating submission file")
|
42 |
|
43 |
+
# invalidate USER_TOKEN env var
|
44 |
+
os.environ["USER_TOKEN"] = ""
|
45 |
+
|
46 |
# Copy socket-kit.so to submission_dir
|
47 |
shutil.copyfile("socket-kit.so", f"{submission_dir}/socket-kit.so")
|
48 |
|
competitions/submissions.py
CHANGED
@@ -34,7 +34,7 @@ class Submissions:
|
|
34 |
return todays_submissions
|
35 |
|
36 |
def _is_submission_allowed(self, team_id):
|
37 |
-
todays_date = datetime.
|
38 |
if todays_date > self.end_date:
|
39 |
raise PastDeadlineError("Competition has ended.")
|
40 |
|
@@ -70,7 +70,7 @@ class Submissions:
|
|
70 |
)
|
71 |
with open(team_fname, "r", encoding="utf-8") as f:
|
72 |
team_submission_info = json.load(f)
|
73 |
-
datetime_now = datetime.
|
74 |
|
75 |
# here goes all the default stuff for submission
|
76 |
team_submission_info["submissions"].append(
|
@@ -88,7 +88,7 @@ class Submissions:
|
|
88 |
}
|
89 |
)
|
90 |
# count the number of times user has submitted today
|
91 |
-
todays_date = datetime.
|
92 |
todays_submissions = self._num_subs_today(todays_date, team_submission_info)
|
93 |
self._upload_team_submissions(team_id, team_submission_info)
|
94 |
return todays_submissions
|
@@ -117,7 +117,7 @@ class Submissions:
|
|
117 |
return team_submission_info
|
118 |
|
119 |
def update_selected_submissions(self, user_token, selected_submission_ids):
|
120 |
-
current_datetime = datetime.
|
121 |
if current_datetime > self.end_date:
|
122 |
raise PastDeadlineError("Competition has ended.")
|
123 |
|
@@ -167,7 +167,7 @@ class Submissions:
|
|
167 |
|
168 |
def my_submissions(self, user_token):
|
169 |
user_info = self._get_user_info(user_token)
|
170 |
-
current_date_time = datetime.
|
171 |
private = False
|
172 |
if current_date_time >= self.end_date:
|
173 |
private = True
|
|
|
34 |
return todays_submissions
|
35 |
|
36 |
def _is_submission_allowed(self, team_id):
|
37 |
+
todays_date = datetime.now()
|
38 |
if todays_date > self.end_date:
|
39 |
raise PastDeadlineError("Competition has ended.")
|
40 |
|
|
|
70 |
)
|
71 |
with open(team_fname, "r", encoding="utf-8") as f:
|
72 |
team_submission_info = json.load(f)
|
73 |
+
datetime_now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
74 |
|
75 |
# here goes all the default stuff for submission
|
76 |
team_submission_info["submissions"].append(
|
|
|
88 |
}
|
89 |
)
|
90 |
# count the number of times user has submitted today
|
91 |
+
todays_date = datetime.now().strftime("%Y-%m-%d")
|
92 |
todays_submissions = self._num_subs_today(todays_date, team_submission_info)
|
93 |
self._upload_team_submissions(team_id, team_submission_info)
|
94 |
return todays_submissions
|
|
|
117 |
return team_submission_info
|
118 |
|
119 |
def update_selected_submissions(self, user_token, selected_submission_ids):
|
120 |
+
current_datetime = datetime.now()
|
121 |
if current_datetime > self.end_date:
|
122 |
raise PastDeadlineError("Competition has ended.")
|
123 |
|
|
|
167 |
|
168 |
def my_submissions(self, user_token):
|
169 |
user_info = self._get_user_info(user_token)
|
170 |
+
current_date_time = datetime.now()
|
171 |
private = False
|
172 |
if current_date_time >= self.end_date:
|
173 |
private = True
|