Skip to content

Commit

Permalink
Added method implementation and waiting screens for result upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Niki Ulmanen committed Apr 26, 2019
1 parent dac4d4c commit 4dc44ed
Show file tree
Hide file tree
Showing 12 changed files with 343 additions and 152 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ venv
__pycache__/
direction.txt
home.txt
emotions.js
32 changes: 18 additions & 14 deletions OodiUI/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
import time
from pathlib import Path
import sqlite3
from flask_caching import Cache
import asyncio


def create_app(test_config=None):
cache = Cache(config={'CACHE_TYPE': 'simple'})
app = Flask(__name__, instance_relative_config=True)
cache.init_app(app)

if test_config is None:
app.config.from_pyfile('config.py', silent=True)
Expand All @@ -24,21 +29,16 @@ def start_screen():

return render_template('start.html')

def start_emotions():
### korvaa sierran metodi halutulla metodilla alla ###
return sierra.search_shelved_books("kalastus")

@app.route('/main', methods=['POST', 'GET'])
def search_screen():
#config = Path("OodiUI/static/direction.txt")
#if config.is_file():
# os.remove("OodiUI/static/direction.txt")
#config2 = Path("OodiUI/static/home.txt")
#if config2.is_file():
# os.remove("OodiUI/static/home.txt")
#if request.method == 'POST':
#searchterm = request.form['searchfield']
#error = None
#send searchterm forward to the sierra api?
#if result == "":
# error = 'Kirjoita hakukenttään avainsana.'
#flash(error)
first = request.args.get('first');
if first == "True":
start_emotions()

return render_template('base.html')

@app.route('/term_result', methods=['POST', 'GET'])
Expand All @@ -54,7 +54,11 @@ def start():

@app.route('/term_result/guidance_term', methods=['POST', 'GET'])
def guidance_term():
bookname = request.args.get('title')[:40]+"..." #get the booktitle
b_name = request.args.get('title') #get the booktitle
if len(b_name) > 40:
bookname = b_name[:40]+"..."
else:
bookname = b_name
book_id = request.args.get('id') #get the id of the book
print(bookname)
print(book_id)
Expand Down
Binary file added OodiUI/static/images/.DS_Store
Binary file not shown.
Binary file added OodiUI/static/images/ajax-loader.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4dc44ed

Please sign in to comment.