Skip to content

Commit eb9d9d0

Browse files
committed
cleanup of sql folder
1 parent e0143e7 commit eb9d9d0

File tree

1 file changed

+0
-54
lines changed

1 file changed

+0
-54
lines changed

sql/create_test_bot.py sql/create_test_data.py

-54
Original file line numberDiff line numberDiff line change
@@ -2,63 +2,9 @@
22
import os
33
import sys
44
import random
5-
import zipfile
65
import MySQLdb
76
from server_info import server_info
87

9-
def create_test_bot(name):
10-
bot_filename = os.path.join("../ants/bots/python", name + ".py")
11-
bot_support_filename = "../ants/bots/python/ants.py"
12-
if not os.path.exists(bot_filename):
13-
print("No bot named %s" % name)
14-
return False
15-
16-
17-
connection = MySQLdb.connect(host = server_info["db_host"],
18-
user = server_info["db_username"],
19-
passwd = server_info["db_password"],
20-
db = server_info["db_name"])
21-
cursor = connection.cursor(MySQLdb.cursors.DictCursor)
22-
23-
# get next bot name number
24-
cursor.execute("""
25-
select username
26-
from user
27-
where username like '%s%%'
28-
""" % name)
29-
bot_id = max([int(row["username"][len(name):])
30-
for row in cursor.fetchall()] or [0]) + 1
31-
32-
# create user database entry
33-
cursor.execute("""
34-
insert into user
35-
values (null,'%s%s','$6$rounds=54321$hQd}`.j1e#X&PuN*$D8.wbEp6vwwLoC27GpiGVOFediuAWaGTQ2MPHD64i/bVGxtj0XNeRJeJRKVgDC/uTh.W2m5YoaoA6To1cJ7ZF/',
36-
'%s%[email protected]',1,'7b3f9842775fa9c9d489a3714e857580',0,'Test Account',11,current_timestamp(),0,0);
37-
""" % (name, bot_id, name, bot_id))
38-
user_id = cursor.lastrowid
39-
print("user_id: %s" % user_id)
40-
41-
# create submission entry
42-
cursor.execute("""
43-
insert into submission (user_id, version, status, timestamp, language_id)
44-
values (%s, 1, 20, current_timestamp(), 6)
45-
""" % (user_id))
46-
submission_id = cursor.lastrowid
47-
print("submission_id: %s" % submission_id)
48-
49-
connection.commit()
50-
connection.close()
51-
52-
# create submission file
53-
bot_dir = os.path.join(server_info['submissions_path'], str(submission_id))
54-
os.mkdir(bot_dir)
55-
56-
bot_zip_filename = os.path.join(bot_dir, "entry.zip")
57-
with zipfile.ZipFile(bot_zip_filename, 'w') as bot_zip:
58-
bot_zip.write(bot_filename, 'MyBot.py')
59-
bot_zip.write(bot_support_filename, 'ants.py')
60-
61-
628
def create_test_data(user_count=10000, map_count=1000, game_count=30000, matchup_count=10):
639
connection = MySQLdb.connect(host = server_info["db_host"],
6410
user = server_info["db_username"],

0 commit comments

Comments
 (0)