Skip to content

Commit de36e19

Browse files
committed
hw1
1 parent bbdda7b commit de36e19

File tree

315 files changed

+225
-211090
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

315 files changed

+225
-211090
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.in
2+
*.out
3+
*.ans
4+
*.diff

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# dpooj
22

3-
项目目前部署于:http://123.60.80.220/
3+
项目目前部署于:http://49.232.214.149/ (即将过期)
44

55
凭借兴趣完成的针对[2023春季北航计算机学院面向对象程序设计](https://github.com/quanshr/Object-Oriented-Programming)课程提供非官方测试的代码在线测评网站,所有代码均从0开始自主完成,获150+注册,最高同时有40+人使用
66

__pycache__/genargs.cpython-310.pyc

259 Bytes
Binary file not shown.

__pycache__/init.cpython-310.pyc

100755100644
31 Bytes
Binary file not shown.

__pycache__/methods.cpython-310.pyc

100755100644
-5 Bytes
Binary file not shown.

__pycache__/models.cpython-310.pyc

100755100644
-5 Bytes
Binary file not shown.

app.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from flask import Flask, Response, make_response, render_template, send_file, send_from_directory,url_for, flash, request, redirect
55
from flask_sqlalchemy import SQLAlchemy
66
from werkzeug.security import generate_password_hash, check_password_hash
7+
from genargs import genargs_1
78
from init import app, db
89
from methods import send_email, generate_code, get_ipaddr
910
from models import User, Validation_code,IPinfo
@@ -68,7 +69,9 @@ def uploader():
6869
username=current_user.username
6970
user_path=f"{app.config['WORKPLACE_FOLDER']}/users/{username}"
7071
havefile=request.form['havefile']
72+
7173
if(havefile=="1"):
74+
# print(username,"upload with file")
7275
f = request.files['file']
7376
exp=f.filename.split(".")[-1]
7477
if(exp!="jar" or exp==f.filename):
@@ -92,17 +95,9 @@ def uploader():
9295

9396
amount=request.form['amount']
9497
runargs_path=f'{user_path}/runargs.json'
95-
if(not os.path.exists(runargs_path)):
96-
os.system('echo \'{"num_runs": 30, "num_instr": %d}\' > %s'%(int(amount),runargs_path))
97-
else:
98-
runargs=None
99-
with open(runargs_path,'r',encoding='utf8') as fp:
100-
runargs=json.load(fp)
101-
runargs['num_instr']=int(amount)
102-
with open(runargs_path,'w',encoding='utf8') as fp:
103-
json.dump(runargs,fp)
98+
os.system('echo \'%s\' > %s'%(genargs_1(amount), runargs_path))
10499

105-
print(f"{username} set num_instr to {amount}")
100+
print(f"{username} update args {amount}")
106101
return json.loads('{"code":"0","info":"%s"}'%("上传成功!"))
107102

108103

@@ -238,7 +233,7 @@ def download():
238233
@login_required
239234
def update():
240235
username = current_user.username
241-
print(username, "wants to update")
236+
# print(username, "wants to update")
242237
json_path = f"{app.config['WORKPLACE_FOLDER']}/users/{username}/result.json"
243238
if os.path.exists(json_path):
244239
with open(json_path, "r") as file:

clear.sh

100644100755
File mode changed.

data.db

16 KB
Binary file not shown.
585 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)