Merge pull request #147 from ZeusWPI/first-party-and-no-test-notis
First party and no test notis
This commit is contained in:
commit
0daea7d270
12 changed files with 73 additions and 32 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -2,6 +2,9 @@
|
|||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Static type checker cache
|
||||
.mypy_cache/
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ Finally run the webserver with
|
|||
### Adding dependencies/libraries
|
||||
|
||||
1. Add new dependency to the `requirements.in` file
|
||||
2. Run `pip-compile` to freeze the dependency into the `requirements.txt` file together with it's own deps
|
||||
2. Run `pip-compile` to freeze the dependency into the `requirements.txt` file together with its own deps
|
||||
3. Run `pip-sync` to download frozen deps
|
||||
|
||||
### Updating dependencies
|
||||
|
|
24
app/database/add_testlocation.py
Normal file
24
app/database/add_testlocation.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
from app import db
|
||||
from models import Location, Product
|
||||
|
||||
STUFFS = [
|
||||
("Broodje zever", 540),
|
||||
("Broodje aap", 0),
|
||||
("Broodje goud", 500000),
|
||||
]
|
||||
|
||||
|
||||
def add() -> None:
|
||||
testlocation = Location()
|
||||
testlocation.configure(
|
||||
"Testlocation",
|
||||
"Please ignore!",
|
||||
"0469 69 69 69",
|
||||
"http://localhost:8000/",
|
||||
)
|
||||
db.session.add(testlocation)
|
||||
|
||||
for stuff in STUFFS:
|
||||
entry = Product()
|
||||
entry.configure(testlocation, *stuff)
|
||||
db.session.add(entry)
|
|
@ -3,18 +3,20 @@ import add_fitchen
|
|||
import add_oceans_garden
|
||||
import add_primadonna
|
||||
import add_simpizza
|
||||
import add_testlocation
|
||||
from app import db, create_app
|
||||
|
||||
entry_sets = {
|
||||
"Admins": add_admins.add,
|
||||
"Testlocation": add_testlocation.add,
|
||||
"Ocean's Garden": add_oceans_garden.add,
|
||||
"SimPizza": add_simpizza.add,
|
||||
"Primadonna": add_primadonna.add,
|
||||
"Fitchen": add_fitchen.add,
|
||||
}
|
||||
|
||||
yes = ["yes", "y", "Y"]
|
||||
no = ["no", "n", "N"]
|
||||
yes = ["yes", "y"]
|
||||
no = ["no", "n"]
|
||||
|
||||
|
||||
# Commit all the things
|
||||
|
@ -25,7 +27,7 @@ def commit() -> None:
|
|||
|
||||
def check_if_overwrite() -> bool:
|
||||
answer = input("Do you want to overwrite the previous database? (y/N) ")
|
||||
return answer in yes
|
||||
return answer.lower() in yes
|
||||
|
||||
|
||||
def add_all() -> None:
|
||||
|
@ -37,11 +39,13 @@ def add_all() -> None:
|
|||
def recreate_from_scratch() -> None:
|
||||
confirmation = "Are you very very sure? (Will delete previous entries!) (y/N) "
|
||||
check = "I acknowledge any repercussions!"
|
||||
if input(confirmation) in yes and input("Type: '{}' ".format(check)) == check:
|
||||
if input(confirmation).lower() in yes and input("Type: '{}' ".format(check)).lower() == check:
|
||||
print("Resetting the database!")
|
||||
db.drop_all()
|
||||
db.create_all()
|
||||
add_to_current()
|
||||
else:
|
||||
print("You cancelled.")
|
||||
|
||||
|
||||
def add_to_current() -> None:
|
||||
|
@ -52,15 +56,15 @@ def add_to_current() -> None:
|
|||
["{}({}), ".format(loc, i) for i, loc in enumerate(available)]
|
||||
).rstrip(", ")
|
||||
|
||||
while input("Do you still want to add something? (Y/n) ") not in no:
|
||||
while input("Do you still want to add something? (Y/n) ").lower() not in no:
|
||||
print(
|
||||
"What do you want to add? (Use numbers, or A for all, or C for cancel) "
|
||||
)
|
||||
answer = input("Available: {} : ".format(add_numbers()))
|
||||
if answer == "A":
|
||||
if answer.lower() == "a":
|
||||
add_all()
|
||||
available = []
|
||||
elif answer == "C":
|
||||
elif answer.lower() == "c":
|
||||
pass
|
||||
elif answer.isnumeric() and answer in [str(x) for x in range(len(available))]:
|
||||
answer_index = int(answer)
|
||||
|
|
|
@ -1,27 +1,36 @@
|
|||
import json
|
||||
import typing
|
||||
from datetime import datetime
|
||||
from threading import Thread
|
||||
|
||||
import requests
|
||||
from flask import current_app as app
|
||||
from flask import url_for
|
||||
from models.order import Order
|
||||
|
||||
|
||||
def post_order_to_webhook(order_item) -> None:
|
||||
message = ""
|
||||
def webhook_text(order_item: Order) -> typing.Optional[str]:
|
||||
if "Testlocation" in order_item.location.name:
|
||||
return None
|
||||
|
||||
if order_item.courrier is not None:
|
||||
message = "<!channel|@channel> {3} is going to {1}, order <{0}|here>! Deadline in {2} minutes!".format(
|
||||
return "<!channel|@channel> {3} is going to {1}, order <{0}|here>! Deadline in {2} minutes!".format(
|
||||
url_for("order_bp.order", id=order_item.id, _external=True),
|
||||
order_item.location.name,
|
||||
remaining_minutes(order_item.stoptime),
|
||||
order_item.courrier.username.title(),
|
||||
)
|
||||
else:
|
||||
message = "<!channel|@channel> New order for {}. Deadline in {} minutes. <{}|Open here.>".format(
|
||||
|
||||
return "<!channel|@channel> New order for {}. Deadline in {} minutes. <{}|Open here.>".format(
|
||||
order_item.location.name,
|
||||
remaining_minutes(order_item.stoptime),
|
||||
url_for("order_bp.order", id=order_item.id, _external=True),
|
||||
)
|
||||
|
||||
|
||||
def post_order_to_webhook(order_item: Order) -> None:
|
||||
message = webhook_text(order_item)
|
||||
if message:
|
||||
webhookthread = WebhookSenderThread(message, app.config["SLACK_WEBHOOK"])
|
||||
webhookthread.start()
|
||||
|
||||
|
|
1
app/static/css/bootstrap.css
vendored
1
app/static/css/bootstrap.css
vendored
|
@ -1,4 +1,3 @@
|
|||
@import url("//fonts.googleapis.com/css?family=Roboto:300,400,500,700");
|
||||
/*!
|
||||
* bootswatch v3.3.4+1
|
||||
* Homepage: http://bootswatch.com
|
||||
|
|
1
app/static/css/bootstrap.min.css
vendored
1
app/static/css/bootstrap.min.css
vendored
|
@ -1,4 +1,3 @@
|
|||
@import url("//fonts.googleapis.com/css?family=Roboto:300,400,500,700");/*!
|
||||
* bootswatch v3.3.4+1
|
||||
* Homepage: http://bootswatch.com
|
||||
* Copyright 2012-2015 Thomas Park
|
||||
|
|
1
app/static/css/select2.min.css
vendored
Normal file
1
app/static/css/select2.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
2
app/static/js/select2.min.js
vendored
Normal file
2
app/static/js/select2.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -142,13 +142,13 @@
|
|||
|
||||
{% block styles %}
|
||||
{{ super() }}
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/select2.min.css') }}" />
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/select2-bootstrap.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/print.css') }}">
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
{{ super() }}
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js"></script>
|
||||
<script src="{{ url_for('static', filename='js/select2.min.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
var select = $('.select').select2({
|
||||
'sorter': function(results) {
|
||||
|
|
|
@ -59,13 +59,13 @@
|
|||
|
||||
{% block styles -%}
|
||||
{{ super() }}
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/css/select2.min.css" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap-datetimepicker.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/select2-bootstrap.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/select2.min.css') }}" />
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap-datetimepicker.min.css') }}" />
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/select2-bootstrap.min.css') }}" />
|
||||
{%- endblock %}
|
||||
{% block scripts -%}
|
||||
{{ super() }}
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/js/select2.min.js"></script>
|
||||
<script src="{{ url_for('static', filename='js/select2.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/moment.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/bootstrap-datetimepicker.min.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -74,13 +74,13 @@
|
|||
|
||||
{% block styles -%}
|
||||
{{ super() }}
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/css/select2.min.css" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap-datetimepicker.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/select2-bootstrap.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/select2.min.css') }}" />
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap-datetimepicker.min.css') }}" />
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/select2-bootstrap.min.css') }}" />
|
||||
{%- endblock %}
|
||||
{% block scripts -%}
|
||||
{{ super() }}
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/js/select2.min.js"></script>
|
||||
<script src="{{ url_for('static', filename='js/select2.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/moment.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/bootstrap-datetimepicker.min.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
|
|
Loading…
Reference in a new issue