<commit_before># admin.py

from flask import Flask, json, redirect, render_template, request, url_for
import dbmanager
from ptmodels import PtLog, PtUser

# Creates a new Flask server application
app = Flask(__name__)

# The dashboard
@app.route("/")
@app.route("/home")
@app.route("/index")
@app.route("/default")
def home():
	pt_users_raw = dbmanager.get_users()
	pt_users = []
	for user_raw in pt_users_raw:
		id = user_raw[0]
		username = user_raw[1]
		registered_on = user_raw[2]
		goal_period = user_raw[3]
		wc_status = "Current" if (user_raw[4] and user_raw[5]) else "Expired"
		fb_status = "Current" if user_raw[6] else "Expired"
		logs_raw = dbmanager.get_logs(id)
		last_progress = logs_raw[len(logs_raw) - 1][3]
		user = PtUser(id, username, registered_on, goal_period, wc_status, wc_status)
		user.wc_daily_progress = last_progress
	return render_template("home.html", pt_users=pt_users)
	
@app.route("/manage")
def manage():
	'''
	pt_users = [
		PtUser("Norbert", "01-27-2018 08:30:00", "Current", "Current"),
		PtUser("DaraS", "01-27-2018 08:40:00", "Current", "Expired")
	]
	'''
	return render_template("manage.html", pt_users=pt_users)
	
@app.route("/stats")
def stats():
	dbm = dbmanager.DbManager()
	pt_stats = dbm.load_logs()
	return render_template("stats.html", pt_stats=pt_stats)
	
@app.route("/docs")
def docs():
	return render_template("docs.html")
	
if __name__ == "__main__":
	app.run(debug=True)<commit_msg>Little ordering error<commit_after># admin.py

from flask import Flask, json, redirect, render_template, request, url_for
import dbmanager
from ptmodels import PtLog, PtUser

# Creates a new Flask server application
app = Flask(__name__)

# The dashboard
@app.route("/")
@app.route("/home")
@app.route("/index")
@app.route("/default")
def home():
	pt_users_raw = dbmanager.get_users()
	pt_users = []
	for user_raw in pt_users_raw:
		id = user_raw[0]
		username = user_raw[1]
		registered_on = user_raw[2]
		goal_period = user_raw[3]
		wc_status = "Current" if (user_raw[4] and user_raw[5]) else "Expired"
		fb_status = "Current" if user_raw[6] else "Expired"
		user = PtUser(id, username, registered_on, goal_period, wc_status, wc_status)
		logs_raw = dbmanager.get_logs(id)
		last_progress = logs_raw[len(logs_raw) - 1][3]
		user.wc_daily_progress = last_progress
		pt_users.append(user)
	return render_template("home.html", pt_users=pt_users)
	
@app.route("/manage")
def manage():
	'''
	pt_users = [
		PtUser("Norbert", "01-27-2018 08:30:00", "Current", "Current"),
		PtUser("DaraS", "01-27-2018 08:40:00", "Current", "Expired")
	]
	'''
	return render_template("manage.html", pt_users=pt_users)
	
@app.route("/stats")
def stats():
	dbm = dbmanager.DbManager()
	pt_stats = dbm.load_logs()
	return render_template("stats.html", pt_stats=pt_stats)
	
@app.route("/docs")
def docs():
	return render_template("docs.html")
	
if __name__ == "__main__":
	app.run(debug=True)
{'fraction_non_alphanumeric': 0.15541006202618884, 'fraction_numerical': 0.025499655410062026, 'mean_word_length': 5.523595505617978, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6134051', 'n_tokens_mistral': 1177, 'n_tokens_neox': 1081, 'n_words': 234}