bug fixing

This commit is contained in:
fram3d 2023-10-03 22:52:40 +02:00
parent 4d0869ddf7
commit ff088a6a24
Signed by: fram3d
GPG Key ID: 938920E709EEA32A
4 changed files with 23 additions and 45 deletions

View File

@ -1,6 +1,6 @@
from flask import render_template, request, redirect from flask import render_template, request, redirect
from freeriders import app, db from freeriders import app, db
from freeriders.models import Ticket from freeriders.models import Tickets
from datetime import datetime from datetime import datetime
import time import time
@ -8,7 +8,8 @@ import time
def sms(): def sms():
if request.method == 'GET': if request.method == 'GET':
try: try:
lastticket = Ticket.query.order_by(Ticket.timestamp.desc()).first() lastticket = Tickets.query.order_by(Tickets.timestamp.desc()).first().ticket
lastticket = "{:010d}".format(lastticket)
date = datetime.now() date = datetime.now()
datenow = f'{"{:02d}".format(date.day)}.{"{:02d}".format(date.month)}.{date.year}' datenow = f'{"{:02d}".format(date.day)}.{"{:02d}".format(date.month)}.{date.year}'
timenow = f'{"{:02d}".format(date.hour)}:{"{:02d}".format(date.minute)}:{date.second}' timenow = f'{"{:02d}".format(date.hour)}:{"{:02d}".format(date.minute)}:{date.second}'
@ -27,7 +28,7 @@ def submit():
ticket_input = request.form['ticket'] ticket_input = request.form['ticket']
if ticket_input.isdigit() and len(ticket_input) == 10: if ticket_input.isdigit() and len(ticket_input) == 10:
ticket = Ticket(ticket = int(ticket_input), timestamp = timenow) ticket = Tickets(ticket = int(ticket_input), timestamp = timenow)
else: else:
return 'Ticket format is wrong. Only 10 digits allowed.' return 'Ticket format is wrong. Only 10 digits allowed.'

View File

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/styles/style.css">
<link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
<title>Ticket tracking</title>
</head>
<body>
<main>
</main>
</body>
</html>

View File

@ -4,7 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Karta</title> <title>Karta</title>
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="/static/style.css">
</head> </head>
<body> <body>
<header> <header>
@ -26,33 +26,6 @@
za ovu kartu prema JKP Naplata prevozne za ovu kartu prema JKP Naplata prevozne
usluge Beograd. Sacuvajte ovu poruku. usluge Beograd. Sacuvajte ovu poruku.
</section> </section>
<section class='request'>
A90
</section>
<section class='ticket'>
U Beogradu, za broj telefona ste kupili
VREMENSKU KARTU OD 90 MINUTA U ZONI A po
ceni od 50 din + osnovna cena poruke,
koja vazi do 03.10.2023, 09:42:54.
Karta broj: 0000343232.
Placanjem operateru izmirujete dugovanja
za ovu kartu prema JKP Naplata prevozne
usluge Beograd. Sacuvajte ovu poruku.
</section>
<section class='date'>08:23</section>
<section class='request'>
A90
</section>
<section class='ticket'>
U Beogradu, za broj telefona ste kupili
VREMENSKU KARTU OD 90 MINUTA U ZONI A po
ceni od 50 din + osnovna cena poruke,
koja vazi do 03.10.2023, 09:42:54.
Karta broj: 0000343232.
Placanjem operateru izmirujete dugovanja
za ovu kartu prema JKP Naplata prevozne
usluge Beograd. Sacuvajte ovu poruku.
</section>
</main> </main>
<footer> <footer>
<div class="textbox"></div> <div class="textbox"></div>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Submit</title>
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<main>
<form action="/submit" method="POST">
<label for="ticket">ticket</label>
<input type="text" name="ticket" id="ticket" placeholder="1234567890" required>
<button> Submit </button>
</form>
</main>
</body>
</html>