8 changed files with 32 additions and 60 deletions
@ -1,6 +1,11 @@
|
||||
# TO-DO |
||||
- pagina aggiungi/modifica utente |
||||
- scelta sede-livello |
||||
- login e autenticazione user-password |
||||
- ? Tasti indietro |
||||
- aggiungre campi email e data tesseramento al db (ce li siamo dimenticati) |
||||
- ~~pagina aggiungi/modifica utente~~ |
||||
- ~~scelta sede-livello~~ |
||||
- ~~login e autenticazione user-password~~ |
||||
- ~~? Tasti indietro~~ |
||||
- aggiungre campi ~~email~~ e data tesseramento al db (ce li siamo dimenticati) |
||||
- ~~retrdatare current_time al costruttore~~ |
||||
- route backup |
||||
- gestione account login (?) |
||||
- gestione eventi,sedi,livelli |
||||
- refactor main.py |
||||
@ -1,22 +0,0 @@
|
||||
import csv |
||||
import json |
||||
|
||||
csvfile = open('allievi.csv', 'r') |
||||
jsonfile = open('file.json', 'w') |
||||
|
||||
reader = csv.reader(csvfile) |
||||
next(reader, None) # skip the headers |
||||
|
||||
for row in reader: |
||||
data = {} |
||||
data['nome'] = row[1] |
||||
data['cognome'] = row[2] |
||||
data['livello'] = int(row[0].split()[1]) # assuming 'Beginner 1' should become 1 |
||||
data['sede'] = 0 # static value |
||||
data['telefono'] = row[3] |
||||
data['instagram'] = '@' + row[1] # assuming Instagram handle is @<name> |
||||
data['email'] = row[4] if row[4] else "" # default email if not provided |
||||
data['pagamenti'] = [] |
||||
data['presenze'] = [] |
||||
json.dump(data, jsonfile) |
||||
jsonfile.write('\n') |
||||
@ -1,25 +0,0 @@
|
||||
from tinydb import TinyDB, Query |
||||
|
||||
from tinydb.operations import add |
||||
|
||||
# Initialize the database |
||||
db = TinyDB('db.json') |
||||
|
||||
# Access the 'users' table |
||||
users = db.table('users') |
||||
|
||||
# Insert a new user |
||||
user_id = users.insert({'nome': 'Jim', 'cognome': 'Doe', 'livello': 2, |
||||
'sede': 1, 'telefono': '1234567890', 'instagram': '@johndoe', |
||||
'pagamenti': ['2023-01-01T00:00:00', '2022-02-01T00:00:00'], 'presenze': []}) |
||||
|
||||
print(user_id) |
||||
|
||||
# Define the user query |
||||
User = Query() |
||||
|
||||
# Update the 'presenze' field for the newly inserted user |
||||
users.update(add('presenze', [{'Country':'USA'}])) |
||||
# Print all users |
||||
res = users.all() |
||||
print(res) |
||||
Binary file not shown.
Loading…
Reference in new issue