summaryrefslogtreecommitdiff
path: root/monkey
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2015-10-13 16:08:15 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2015-10-13 16:08:15 +0200
commit2566475184377b4fe10e96918b54747b9bc9ce73 (patch)
tree4937e6112ed4d1c58d9ca0e21b061081aef0fcef /monkey
parent9203276ce88b584a41b40e2583e815d928f35645 (diff)
Remove unused code from monkey.action
Diffstat (limited to 'monkey')
-rwxr-xr-xmonkey/action.py57
1 files changed, 5 insertions, 52 deletions
diff --git a/monkey/action.py b/monkey/action.py
index e894dfc..468e80b 100755
--- a/monkey/action.py
+++ b/monkey/action.py
@@ -68,52 +68,6 @@ def parse(data):
time = 0
code = ''
-# i = 0
-# while i < len(data):
-# # parse one action
-# type = data[i]
-# i += 1
-# dt = int(((data[i] << 8) + (data[i+1])) * 100.0)
-# time += dt
-# i += 2
-# if type == 1: # insert
-# offset = (data[i] << 8) + data[i+1]
-# i += 2
-# length = (data[i] << 8) + data[i+1]
-# i += 2
-# text = data[i:i+length].decode()
-# i += length
-# action = Action('insert', time, offset=offset, text=text)
-# elif type == 2: # remove
-# offset = (data[i] << 8) + data[i+1]
-# i += 2
-# length = (data[i] << 8) + data[i+1]
-# i += 2
-# text = code[offset:offset+length]
-# action = Action('remove', time, offset=offset, text=text)
-# elif type == 3 or type == 4: # solve / solve all
-# length = (data[i] << 8) + data[i+1]
-# i += 2
-# query = data[i:i+length].decode()
-# i += length
-# act_type = 'solve' + ('_all' if type == 4 else '')
-# action = Action(act_type, time, text=query)
-# elif type == 5: # next solution
-# action = Action('next', time)
-# elif type == 7: # stop/end
-# action = Action('stop', time)
-# elif type == 8: # test
-# total = data[i]
-# i += 1
-# passed = data[i]
-# i += 1
-# action = Action('test', time, total=total, passed=passed)
-# elif type == 9: # hint
-# action = Action('hint', time)
-# else:
-# # unsupported action type
-# continue
-
for packet in data:
try:
time += packet['dt']
@@ -253,16 +207,15 @@ if __name__ == '__main__':
import sys, os.path
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/..') # the parent directory is the app directory
- from db.models import Solution
+ from db.models import Problem, Solution
# print all problem ids
-# print('problems:')
-# for problem in Problem.objects.all():
-# print(' {}\t{}'.format(problem.pk, problem.name))
-# print()
+ print('problems:')
+ for problem in Problem.list():
+ print(' {}\t{}'.format(problem.id, problem.identifier))
+ print()
pid = input('enter problem id: ')
-# problem = Problem.objects.get(pk=pid)
# print all attempt ids for the selected problem
print('users solving problem ' + str(pid) + ':')