예제 #1
0
        args["rank"] = str(i + 1)
        args["endpointVersion"] = fw.endpointVersion
        temp = ("%.2f" % args["percentage"])
        args["percentage"] = temp
        args["webRootPath"] = fw.webRootPath
        most_popular_rows += popular_row_template.safe_substitute(args)
    render_args["unsafe_tableHead"] = popular_table_head
    render_args["unsafe_table"] = most_popular_rows
    render_args["tableTitle"] = "Items which are bought the most"

elif filter == "leastpopular":
    least_popular = database.get_least_popular_items()
    least_popular_rows = ""
    for i in range(len(least_popular)):
        args = copy.copy(least_popular[i])
        args["rank"] = str(i + 1)
        args["endpointVersion"] = fw.endpointVersion
        temp = ("%.2f" % args["percentage"])
        args["percentage"] = temp
        args["webRootPath"] = fw.webRootPath
        least_popular_rows += popular_row_template.safe_substitute(args)
    render_args["unsafe_tableHead"] = popular_table_head
    render_args["unsafe_table"] = least_popular_rows
    render_args["tableTitle"] = "Items which are bought the least"

fw.render("views/items/general", render_args)

fw.render_footer(["navbar.js"])

database.close_db()
예제 #2
0
rootPath = os.path.dirname(os.path.abspath(__file__))
while os.path.basename(rootPath) != "analyzer":
	rootPath = os.path.dirname(rootPath)

sys.path.append(rootPath + "/models")
sys.path.append(rootPath + "/framework")

# Items landing page

import fw
import database

database.open_db()

fw.write_header()
fw.render_header("Clear Cache - Administration", ["admin.css", "fontello.css"])

database.clear_cache()

database.close_db()

print('''
<div class="container">
<a href="%s/controllers/admin/index.py"><span class="icon-left-open"></span>Back to administration</a>
<h2>League Analyzer Administration</h2>
<h4>Cache cleared</h4>
</div>
''' % fw.webRootPath)

fw.render_footer()