diff --git a/.idea/workspace.xml b/.idea/workspace.xml index c35871b..903b913 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,9 +3,12 @@ + + + @@ -178,7 +181,8 @@ - - + + + \ No newline at end of file diff --git a/IDManager.py b/IDManager.py index 121f2a7..f8ba428 100644 --- a/IDManager.py +++ b/IDManager.py @@ -2,9 +2,11 @@ import random import csv class idManager(): levelNum = 200 + timeMin = 1 ip_dic = {} ip_recent = {} ip_control = {} + ip_time = {} def __int__(self): self.levelNum = 200 @@ -32,7 +34,20 @@ class idManager(): self.ip_control[ip] = 0 else: self.ip_control[ip] = 1 - + def getTimes(self,ip): + print(self.ip_time[ip]) + if ip not in self.ip_time.keys(): + return 0 + else: + if self.ip_time[ip]>=self.timeMin: + return 1 + else: + return 0 + def addTimes(self,ip): + if ip not in self.ip_time.keys(): + self.ip_time[ip] = 0 + self.ip_time[ip] = self.ip_time[ip]+1 + return self.ip_time[ip] def getControl(self,ip): return self.ip_control[ip] diff --git a/__pycache__/IDManager.cpython-39.pyc b/__pycache__/IDManager.cpython-39.pyc index 510d907..4981508 100644 Binary files a/__pycache__/IDManager.cpython-39.pyc and b/__pycache__/IDManager.cpython-39.pyc differ diff --git a/__pycache__/main.cpython-39.pyc b/__pycache__/main.cpython-39.pyc index 3b0b9e3..3665657 100644 Binary files a/__pycache__/main.cpython-39.pyc and b/__pycache__/main.cpython-39.pyc differ diff --git a/data/annotation.csv b/data/annotation.csv index 6e4caf4..5223c4b 100644 --- a/data/annotation.csv +++ b/data/annotation.csv @@ -10,3 +10,11 @@ 10.16.33.201,28,73,A 10.27.169.251,160,10,N 10.27.169.251,143,173,N +127.0.0.1,139,181,N +127.0.0.1,58,70,B +127.0.0.1,83,183,N +127.0.0.1,74,191,E +127.0.0.1,22,188,A +127.0.0.1,11,162,A +127.0.0.1,156,22,E +127.0.0.1,47,30,E diff --git a/data/questionare.csv b/data/questionare.csv index 5498ca9..db31561 100644 --- a/data/questionare.csv +++ b/data/questionare.csv @@ -46,3 +46,8 @@ IP,Style,Frequency,Age,Gender 127.0.0.1,D,E,D,, 127.0.0.1,,,,, 127.0.0.1,D,,,, +127.0.0.1,D,C,G,, +127.0.0.1,D,A,A,A, +127.0.0.1,,,,, +127.0.0.1,,,,, +127.0.0.1,,,,, diff --git a/main.py b/main.py index 4e6df64..2c9a4a8 100644 --- a/main.py +++ b/main.py @@ -57,12 +57,10 @@ def gameplay(id): def getJSONData(id): if request.method == 'POST': print("POST Game") - # print(request.form) - # print(list(request.form)) resultList = list(request.form)[0].split(",") print(resultList) saveFile(replayDataPath, id + resultList[0][:-2], resultList[1:]) - return "get!" + return "return!" @@ -77,16 +75,19 @@ def gameanno(id): @app.route('/annotation/radioresult', methods=['POST']) def getRadioData(): + ip = request.remote_addr + if request.method == 'POST': print("POST Eval") result = request.form print(result) - ip = request.remote_addr ipRecent = idm.getRecent(ip) idm.write_csv(annotationPath, [ip, ipRecent[0], ipRecent[1], result["fun"]]) - + idm.addTimes(ip) # saveFile(evalDataPath,"gameanno",request.json[0]+request.json[1]+request.json[2]) - return render_template("GameOver.html") + finish = idm.getTimes(ip) + + return render_template("GameOver.html",finish = finish) diff --git a/templates/GameAnnotation.html b/templates/GameAnnotation.html index b009226..2b545ad 100644 --- a/templates/GameAnnotation.html +++ b/templates/GameAnnotation.html @@ -17,7 +17,6 @@ - @@ -221,6 +220,10 @@ function Replay(id){
@@ -200,18 +159,17 @@
- +
-
@@ -223,9 +181,7 @@