the debris name

This commit is contained in:
zeroth 2019-12-18 15:14:37 +00:00
parent 06a7644efd
commit 6a723a6cf1

View File

@ -15,8 +15,9 @@ path = "/static/files/"
# librarians = ["Alana", "Gentian", "Laurie", "Matias", "Scott", "Stacy", "Max", "Clara_B", "Michelle", "Clara_J_B", "Karen", "Lumsden_Primary_School", "Aaron", "Leo", "Maria", "Laura", "Honey", "Tender_Center", "wdka", "Naomi", "Cristina", "Julie", "ssw", "cyberspace", "Hannah", "Katarina", "Anastasia", "Kimmy", "Marie","Katherine", "Allison", "Mariana", "Viki", "Alice", "Eric", "hks", "cbk", "Sophie", "Antonio", "Jeremiah", "Angela", "Renee", "Marta", "Katherine", "Anna", "Auryn", "Ashley", "Anne", "Denise", "Eva", "Jonnah", "Kitty", "Masha", "Mia", "Cian", "Senke", "Maud", "Jinnie", "Rubin", "Julia", "Alana", "Gentian", "Laurie", "Matias","Scott", "Stacy"]
librarians = []
files_without_folders = []
with open('realjson.json', 'r', encoding='utf8') as filesandnames:
with open('mergedjson.json', 'r', encoding='utf8') as filesandnames:
filetoname_dict = json.load(filesandnames)
#get full list librarians from json (printed later through global variable)
@ -30,17 +31,21 @@ with open('realjson.json', 'r', encoding='utf8') as filesandnames:
#go from librarian name to file
for file in filetoname_dict:
if librarianselected in file["librarian"]:
thedebris = file["debris"]
print(str(librarianselected)+" contributed with the following debris : "+str(thedebris))
print("---------------------------------------------------")
# if librarianselected in file["librarian"]:
thedebris = file["debrisname"]
#apply regex to the debris
thedebris = os.path.basename(thedebris)
files_without_folders.append(str(thedebris))
# print(str(librarianselected)+" contributed with the following debris : "+str(thedebris))
#this value we should get from template
fileselected = filetoname_dict[1]["debris"]
fileselected = filetoname_dict[1]["debrisname"]
#go from file name to librarian name
for file in filetoname_dict:
if fileselected in file["debris"]:
if fileselected in file["debrisname"]:
thelibrarian = file["librarian"]
print("librarians for "+ str(fileselected)+" are: " + str(thelibrarian))
print("---------------------------------------------------")
@ -49,7 +54,7 @@ print(librarians)
@app.route("/")
def home():
return render_template('layout.html', filetoname_dict=filetoname_dict, librarians=librarians)
return render_template('layout.html', filetoname_dict=filetoname_dict, librarians=librarians, files_without_folders = files_without_folders)
@app.route('/about/')
def about():