Commit e0125ecb authored by djamel's avatar djamel

correction syntaxique

parent 60e70693
......@@ -181,10 +181,10 @@ public class Read_QR_Code extends ActionBarActivity implements View.OnClickListe
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
try {
if (response.getBoolean("valid")) {
display(getString(R.string.ebillet_true + response.getInt
("avaliable")), true);
display(getString(R.string.ebillet_true) + String.valueOf(
response.getInt("available")), true);
}
else if (response.getInt("avaliable") < 0) {
else if (response.getInt("available") < 0) {
display(getString(R.string.ebillet_sizeOff), false);
}
else {
......
......@@ -83,6 +83,6 @@ Réception :
```json
{
"valid": true, // true ou false selon si valide ou non
"avaliable": 7 // Nombre de places restantes sur le billet
"available": 7 // Nombre de places restantes sur le billet
}
```
CREATE Table ticket (
id INTEGER PRIMARY KEY AUTOINCREMENT,
verifKey TEXT UNIQUE NOT NULL,
avaliablePlaces INTEGER NOT NULL
availablePlaces INTEGER NOT NULL
);
......@@ -38,34 +38,34 @@ def Validate(db):
def NewEntry(db, data):
avaliable = data['nb'] - data['qt']
available = data['nb'] - data['qt']
response = {
"avaliable": avaliable,
"available": available,
"valid": True
}
db.execute('INSERT into ticket(verifKey, avaliablePlaces) values (?, ?)',
(data['verif'], avaliable))
db.execute('INSERT into ticket(verifKey, availablePlaces) values (?, ?)',
(data['verif'], available))
return dict(response)
def UpdateEntry(db, data, obj):
avaliableP = obj['avaliablePlaces'] - data['qt']
availableP = obj['availablePlaces'] - data['qt']
if avaliableP >= 0:
avaliable = True
if availableP >= 0:
available = True
else:
avaliableP = obj['avaliablePlaces']
avaliable = False
availableP = obj['availablePlaces']
available = False
response = {
"avaliable": avaliableP,
"valid": avaliable
"available": availableP,
"valid": available
}
db.execute('UPDATE ticket SET avaliablePlaces=:av WHERE id=:id',
{"av": avaliableP, "id": obj['id']})
db.execute('UPDATE ticket SET availablePlaces=:av WHERE id=:id',
{"av": availableP, "id": obj['id']})
return dict(response)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment