Skip to content

Commit

Permalink
added timeout and sierra functions to flask
Browse files Browse the repository at this point in the history
  • Loading branch information
Niki Ulmanen committed Apr 29, 2019
1 parent 4dc44ed commit b18396e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
10 changes: 9 additions & 1 deletion OodiUI/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ def start_screen():

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

@app.route('/flag_reset', methods=['POST', 'GET'])
def flag_reset():
print("ajax call received, resetting flag")
### sierra function here ###
sierra.ui_not_in_use()
return "OK"


@app.route('/main', methods=['POST', 'GET'])
def search_screen():
Expand Down
19 changes: 19 additions & 0 deletions OodiUI/static/resetflag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
$(document).ready(function(){
function backToStart() {
$.ajax({
url: '/flag_reset',
cache: false,
headers: {
"cache-control": "no-cache"
},
success: function(data) {
window.location.assign("/");
},
error: function(error) {
console.log(error);
}
});
console.log("flag reset");
}
setTimeout(backToStart, 300000);
});
2 changes: 1 addition & 1 deletion OodiUI/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ html {
align-content: center;
font-size: 70pt;
color: rgb(42, 52, 60);
left: 42.5%;
left: 40%;
top: 10pt;
}

Expand Down
3 changes: 3 additions & 0 deletions OodiUI/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ <h1 class="search-category" id="search-header2">Look for a book category</h1>
<!--<a href="/guidance_category?category=Historia&id=90000" value="Historia" name="categoryname" id="history-btn" class="w3-btn w3-round-large"><div id="history">Historia</div>
</a>-->


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="{{ url_for('static', filename='resetflag.js') }}"></script>
</body>
{% endblock %}
{% block head %}
Expand Down

0 comments on commit b18396e

Please sign in to comment.