Made kuk app great again

Marek Baczynski 4 years ago
parent 26ab5705ad
commit 6087c35ee6

@ -0,0 +1 @@

@ -0,0 +1,42 @@
import random
import operator
import json
from flask import Flask, Response, redirect, url_for, request, session, abort, render_template
from flask_login import LoginManager, UserMixin, login_required, login_user, logout_user, current_user
from sqlalchemy.sql import select, text
import datetime
app = Flask(__name__)
DEBUG = True,
SECRET_KEY = 'secret_xxx',
SESSION_TYPE = 'memcached'
db_engine = {}
db_metadata = {}
meals = {}
def getLeaderboard():
leaders = []
leaders.append({'name':'marek', 'score':'34'})
leaders.append({'name':'sven', 'score':'16'})
return {}
def getUpcomingMeals():
meals = []
meals.append({'id':1, 'kuk':'davide', 'eaters':['marek','sven','wille'], 'flavor_text':'Pizza', 'date':'Tuesday 21st of November', 'selection_deadline':'23 hours 14 minutes', 'status':0})
meals.append({'id':2, 'kuk':'marek', 'eaters':['davide','sven','david', 'wille'], 'flavor_text':'Grzybowa', 'date':'Friday 23rd of November', 'selection_deadline':'3 Days 23 hours', 'status':0})
return {}
def index():
return render_template('index-new.html', leaderboard=getLeaderboard(), upcomingMeals=getUpcomingMeals(), current_user_name='Wille')
if __name__ == '__main__':
with open('admin.json') as f:
postgres_credentials = json.load(f)
db_engine, db_metadata = connect(postgres_credentials['username'], postgres_credentials['password'], 'kuk_app')
meals = sqlalchemy.Table('meals', db_metadata)'')

@ -0,0 +1,55 @@
<!DOCTYPE html>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
<script src="{{ url_for('static', filename='script.js') }}"></script>
<link href="" rel="stylesheet">
<script src=""></script>
<style type="text/css">
html {
background-image: url({{url_for('static', filename='burger.jpg')}});
background-position: left top;
background-repeat: no-repeat;
background-size: 100% auto;
background-color: #aeaeac;
<div class="leaderboard">
<h1 style="text-align: center">Leaderboard</h1>
<div class="leaderboard-contiainer">
{% for person in leaderboard %}
<div class="lb-entry">
<img src="{{url_for('static', filename=person['name'] + '.png')}}">
<span class="name">{{ person['name'] }}</span>
<span class="score">{{ person['score'] }}</span>
{% endfor %}
<div class="next-meal">
<h1 style="padding-left: 40pt">Next Meal</h1>
<div class="cook-entry">
<div class="eater-entry">
<div class="eater-entry">
<div class="user-info">
<div class="user-card">
<img src="{{url_for('static', filename=current_user_name + '.png')}}">
<div class="logout-button" onclick="location.href='/logout';"><span>LOGOUT</span></div>