the score works finely
This commit is contained in:
parent
6b6f110019
commit
f469963470
Binary file not shown.
@ -112,9 +112,10 @@ def functionsession():
|
|||||||
return(session)
|
return(session)
|
||||||
|
|
||||||
# THIS IS NOT WORKING YET DUNNO WHY
|
# THIS IS NOT WORKING YET DUNNO WHY
|
||||||
# @app.context_processor
|
@app.context_processor
|
||||||
# def context_processor():
|
def context_processor():
|
||||||
# return dict(functionsession=functionsession)
|
functionsession = session['wordpath']
|
||||||
|
return dict(functionsession=functionsession)
|
||||||
|
|
||||||
@app.route('/about/')
|
@app.route('/about/')
|
||||||
def about():
|
def about():
|
||||||
@ -182,7 +183,21 @@ def get_file():
|
|||||||
idlist = session["id"]
|
idlist = session["id"]
|
||||||
timelist = session["clicktime"]
|
timelist = session["clicktime"]
|
||||||
veryfirstnow = session['veryfirstnow']
|
veryfirstnow = session['veryfirstnow']
|
||||||
|
clickongetfiletime = datetime.now()
|
||||||
|
|
||||||
tadam = None
|
tadam = None
|
||||||
|
initialtime = None
|
||||||
|
|
||||||
|
if not (timelist[0] is None):
|
||||||
|
thetime = timelist[0]
|
||||||
|
thetime = str(thetime)
|
||||||
|
thetime = dt.datetime.strptime(thetime, '%Y-%m-%d %H:%M:%S.%f')
|
||||||
|
initialtime = thetime - veryfirstnow
|
||||||
|
initialtime = initialtime.total_seconds()
|
||||||
|
initialtime = int(initialtime)
|
||||||
|
initialtime = "."*initialtime
|
||||||
|
|
||||||
|
print(initialtime)
|
||||||
|
|
||||||
for t in timelist :
|
for t in timelist :
|
||||||
t = str(t)
|
t = str(t)
|
||||||
@ -192,7 +207,16 @@ def get_file():
|
|||||||
prev = None
|
prev = None
|
||||||
wholestringy = None
|
wholestringy = None
|
||||||
|
|
||||||
|
print("veryfirstnow : "+str(veryfirstnow)+"\n")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (word, time, uniqueid) in zip(wordpath,timelistforoperations, idlist):
|
for (word, time, uniqueid) in zip(wordpath,timelistforoperations, idlist):
|
||||||
|
print("word : "+word+"\n")
|
||||||
|
print("timeofclick : "+str(time)+"\n")
|
||||||
|
print("============")
|
||||||
|
print(wordpath)
|
||||||
|
print("============")
|
||||||
filler = int(uniqueid)
|
filler = int(uniqueid)
|
||||||
upperword = word.upper()
|
upperword = word.upper()
|
||||||
|
|
||||||
@ -225,18 +249,41 @@ def get_file():
|
|||||||
fullscore = wholestringy
|
fullscore = wholestringy
|
||||||
|
|
||||||
|
|
||||||
#If fullscore length superior 60 characters, insert linebreak
|
# #If fullscore length superior 60 characters, insert linebreak
|
||||||
|
|
||||||
|
# # Defining splitting point
|
||||||
|
# n = 60
|
||||||
|
# # Using list comprehension
|
||||||
|
# out = [(fullscore[i:i+n]) for i in range(0, len(fullscore), n)]
|
||||||
|
# #joining the strings with linebreaks
|
||||||
|
# tadam = '\n'.join(out)
|
||||||
|
|
||||||
|
|
||||||
|
if not (fullscore is None):
|
||||||
|
# outside of the loop calculate seconds from "clickongetfiletime" minus the last "time" from the loop
|
||||||
|
lastdifftime = clickongetfiletime - prev
|
||||||
|
lastdifftime = lastdifftime.total_seconds()
|
||||||
|
lastdifftime = int(lastdifftime)
|
||||||
|
lastdifftime = lastdifftime * '.'
|
||||||
|
#the 60 seconds thing
|
||||||
|
# print(lastdifftime+"\n")
|
||||||
|
fullscore = initialtime+fullscore+lastdifftime
|
||||||
# Defining splitting point
|
# Defining splitting point
|
||||||
n = 60
|
n = 60
|
||||||
# Using list comprehension
|
# Using list comprehension
|
||||||
out = [(fullscore[i:i+n]) for i in range(0, len(fullscore), n)]
|
out = [(fullscore[i:i+n]) for i in range(0, len(fullscore), n)]
|
||||||
#joining the strings with linebreaks
|
#joining the strings with linebreaks
|
||||||
tadam = '\n'.join(out)
|
tadam = '\n'.join(out)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# have a message in file if no nav has been recorded so it's less dull than error page
|
# have a message in file if no nav has been recorded so it's less dull than error page
|
||||||
if tadam is None:
|
if tadam is None:
|
||||||
tadam = "This score is Null"
|
tadam = "This score is Null"
|
||||||
|
|
||||||
|
# print("verylastnow : "+str(clickongetfilefime)+"\n")
|
||||||
|
|
||||||
|
|
||||||
print(tadam)
|
print(tadam)
|
||||||
|
|
||||||
return Response(tadam,
|
return Response(tadam,
|
||||||
|
@ -4,16 +4,17 @@ import re
|
|||||||
|
|
||||||
with open('wordlist.json', 'r') as f:
|
with open('wordlist.json', 'r') as f:
|
||||||
wordlist_dict = json.load(f)
|
wordlist_dict = json.load(f)
|
||||||
|
#goes through every single file ending in html
|
||||||
|
#
|
||||||
path = "static/files/"
|
path = "static/files/"
|
||||||
for path, subdirs, files in os.walk(path):
|
for path, subdirs, files in os.walk(path):
|
||||||
for name in files:
|
for name in files:
|
||||||
if name.endswith('html'):
|
if name.endswith('html'):
|
||||||
file = os.path.join(path, name)
|
file = os.path.join(path, name)
|
||||||
with open(file, 'r+') as f:
|
with open(file, 'r+', encoding="utf-8") as f:
|
||||||
textfile = f.read()
|
textfile = f.read()
|
||||||
for word in wordlist_dict:
|
for word in wordlist_dict:
|
||||||
# word = re.escape(word)
|
word = re.escape(word)
|
||||||
textfile = re.sub(r"(?<!<)(?<!</)(?<!ge\?)\b(%s)\b" %word, r"<a href='/diverge?search=\1'>\1</a>", textfile)
|
textfile = re.sub(r"(?<!<)(?<!</)(?<!ge\?)\b(%s)\b" %word, r"<a href='/diverge?search=\1'>\1</a>", textfile)
|
||||||
f.truncate(0)
|
f.truncate(0)
|
||||||
f.write(textfile)
|
f.write(textfile)
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
</nav></strong>
|
</nav></strong>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
<div>
|
||||||
|
{{ functionsession }}
|
||||||
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
Loading…
Reference in New Issue
Block a user