Anonymous avatar Anonymous committed 54c3e52

first commit

Comments (0)

Files changed (9)

+syntax: glob
+
+*.coverage
+*.egg-info
+*.log
+*.pyc
+*.db
+*.swp
+*.swo
+*.zip
+*.orig
+*.cfg
+*.tox
+
+
+*~
+
+settings.py
+flask
+werkzeug
+jinja2
+
+dist
+docs/output
+
+_uploads
+
+.git
+.gitignore
+Google App Engine project for keeping food diary when following the Food Opimising programme.
+
+Features include:
+
+- self-entered database of food types, including green days, red days and healthy options
+
+- daily limit of sins and current weight
+
+- keep track of food over the day
+from google.appengine.ext.webapp.util import run_wsgi_app
+
+from foodoptimizr import app
+
+run_wsgi_app(app)
+application: foodoptimizr
+version: 1
+runtime: python
+api_version: 1
+
+handlers:
+    - url: .*
+    script: app.py
+
+Item
+
+- how many sins -> green day (0+)
+- how many sins -> red day (0+)
+- healthy extra A 
+- healthy extra B -> green day
+- healthy extra B -> red day
+
+28g cheese
+- healthy extra A = 1
+- healthy extra B = 0
+- green day sins = 4.5
+- red day sins = 4.5
+
+Search
+- select item
+- select qty
+- red/green day
+
+qty
+if health extra (A or B) subtract 1
+multiply * sins
+
+1 - 1 = 0 * 4.5 = 0
+
+2 - 1 = 1 * 4.5 = 4.5
+
+
+15 sins a day limit
+
+name
+current limit
+current weight
+last weight entered
+daily limit timestamp
+
+current_limit = 0
+daily_limit = 15
+healthy extras A = 2
+healthy extras B = 2
+
+daily_limit = 15 per day + current_limit
+
+daily_limit_set = timestamp
+
+current_limit = 15
+
+current_limit = 5
+
+daily_limit_set since 12am ? 
+yes : do nothing
+no : set daily limit timestamp & add 15 to current limit
+
+
+
+
+

foodoptimizr/__init__.py

+import settings
+
+from flask import Flask, g, render_template, request
+from google.appengine.api import users
+
+from .views import main
+
+app = Flask(__name__)
+app.config_from_object(settings)
+app.register_module(main)
+
+@app.before_request
+def authenticate():
+    g.user = users.get_current_user()
+    
+    if not g.user:
+        login_url = users.create_login_url(request.path)
+        return render_template("login.html", login_url=login_url)
+
+
+
+
+
+

foodoptimizr/templates/index.html

+Welcome to the Food Optimizr application !

foodoptimizr/templates/login.html

+Please login with your Google username/email and password !

foodoptimizr/views.py

+from flask import Module, render_template
+
+main = Module('main')
+
+@main.route("/")
+def index():
+    return render_template("index.html")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.