-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add some functions、Fix some bugs #253
base: master
Are you sure you want to change the base?
Changes from 1 commit
69d487c
b373dae
1d52d6e
db3b3fa
0d354d8
efc4f3f
3242c56
aa5673b
4bd37f9
ccaebba
ee4e9f6
a1b6626
d00648a
7813c2b
522c2fd
a03493f
3c21ab9
5251ef5
1128f62
0e1dc73
80fae07
80e98ba
5df6867
1ec09a4
d8e36a1
22d2ab9
8634151
5370c94
5dbd8ee
0140cce
d64e10f
68cb328
cf6fbdd
2596b31
775ece9
8c6ed1e
9150053
431847e
f606583
4bd5078
c66c31f
bc6ba0e
e53c662
5bd3a7f
0d6880d
4ab80fa
7627199
9b1fc05
13d09cc
12ec4df
79459ab
68eb023
3f7aaf0
1f5dcf4
13fdd1a
6c0cb62
fa273fb
a4a49d9
d827688
226f1da
a7c0d8f
ab3270e
798776d
9ff2324
8720a19
662dd60
7e84802
43a8e39
970dcd5
2bc5112
ed16473
82986de
c1224bb
a1bd341
624fea0
b9cf579
cc43dc7
1cf08f2
7756231
8591798
1bb7197
0d8814d
9bd3fb3
2d8a3c7
62e428d
5721a65
2542b00
5acae1a
e4611f9
2075499
4579d18
7bba8ea
7b0e0d5
267a069
a6a83cf
8a7a1d6
e6ea5d0
5020349
52f4ba0
a80bcdb
464ed5d
f193c5c
77dcfe4
faffd7f
ad43ae7
e696e87
a8d7416
18a024b
2c09460
ef19b30
ab63ed4
73475e7
4462910
1249bb4
d0a5c53
6f6ea3c
eff19aa
020de76
7676ed9
9c58047
6d09da3
e825a16
2ccd75f
ff6bf78
e28a522
65ba399
60e8910
17530c4
8f15bc8
eac6844
dd071bb
d707ab2
c6f9fcd
7d5bbdf
839929a
370bc77
ecb62c2
9df3237
bae5528
cd3c299
a576dc7
c137e0b
07bf2e2
0fac47b
5e42af2
2434ed4
cfed97f
79b72e8
236ae72
9891670
7864fd4
a0fee49
b18f2f8
5dccd3e
59d8df6
7c43429
789b9fb
4c39a68
0a2fb56
0254541
24cd0e4
f3a0579
7fc60f6
7d5bc32
2eb44c9
3c942f4
f4534a5
a3a216c
3b13d7d
1e631e2
dd2a52b
9be5ea8
18d672c
a886e2b
27b29b9
186dad9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,7 +203,7 @@ def _dump_submissions(self, contest, exclude_admin=True): | |
submissions = Submission.objects.filter(contest=contest, result=JudgeStatus.ACCEPTED).order_by("-create_time") | ||
user_ids = submissions.values_list("user_id", flat=True) | ||
users = User.objects.filter(id__in=user_ids) | ||
path = f"/tmp/{rand_str()}.zip" | ||
path = f"/tmp/{contest.title}-{rand_str()}.zip" | ||
with zipfile.ZipFile(path, "w") as zip_file: | ||
for user in users: | ||
if user.is_admin_role() and exclude_admin: | ||
|
@@ -214,7 +214,17 @@ def _dump_submissions(self, contest, exclude_admin=True): | |
problem_id = submission.problem_id | ||
if user_ac_map[problem_id]: | ||
continue | ||
file_name = f"{user.username}_{id2display_id[submission.problem_id]}.txt" | ||
suffix = "cpp" | ||
if submission.language == "Java": | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这种映射关系不应该硬编码,需要在 https://github.com/QingdaoU/OnlineJudge/blob/master/judge/languages.py 定义,然后在 https://github.com/QingdaoU/OnlineJudge/blob/master/options/options.py#L257 取。 但是现在并没有拓展名那一项,需要加入,然后手动的 reset 一下。https://github.com/QingdaoU/OnlineJudge/blob/master/options/options.py#L276 |
||
suffix = "java" | ||
elif submission.language == "C": | ||
suffix = "c" | ||
elif submission.language == "Python2": | ||
suffix = "py" | ||
elif submission.language == "Python3": | ||
suffix = "py" | ||
|
||
file_name = f"{user.username}/{user.username}_{id2display_id[submission.problem_id]}." + suffix | ||
compression = zipfile.ZIP_DEFLATED | ||
zip_file.writestr(zinfo_or_arcname=f"{file_name}", | ||
data=submission.code, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contest.title 可能含有特殊字符导致不能作为文件名