Browse Source

1.1.2

master
enne2 2 years ago
parent
commit
e881e75823
  1. 2
      pages/user.py
  2. 38
      tinymongoz.py

2
pages/user.py

@ -23,7 +23,7 @@ def main(userid, db):
{"$push": {"pagamenti": month.strftime('%Y-%m-%d %H:%M:%S')}}
)
else:
collection.find_one_and_update(
collection.update_one(
{"_id": ObjectId(userid)},
{"$pull": {"pagamenti": month.strftime('%Y-%m-%d %H:%M:%S')}}
)

38
tinymongoz.py

@ -15,34 +15,34 @@ collection = db.livelli
# for row in jsonfile:
# print(row)
collection.insert_one({"id":"3","nome":"Advanced"})
collection.insert_one({"id":"2","nome":"Improver"})
collection.insert_one({"id":"1","nome":"Beginners"})
# collection.insert_one({"id":"3","nome":"Advanced"})
# collection.insert_one({"id":"2","nome":"Improver"})
# collection.insert_one({"id":"1","nome":"Beginners"})
# collection = db.lezioni
collection = db.lezioni
# # collection.insert_one({'})
# collection.insert_one({'})
# # Start from a known Monday.
# start_date = datetime(2023,10,1)
# Start from a known Monday.
start_date = datetime(2023,10,1)
# while start_date.weekday() != 0: # 0 represents Monday in weekday()
# start_date -= timedelta(days=1)
while start_date.weekday() != 0: # 0 represents Monday in weekday()
start_date -= timedelta(days=1)
# for i in range(36): # We need 10 weeks to get 20 days (2 days per week)
# monday = start_date + timedelta(weeks=i)
# wednesday1 = monday + timedelta(days=2) # Wednesday is two days after Monday
# monday = monday.replace(hour=19, minute=30)
# wednesday1= wednesday1.replace(hour=19, minute=30)
# wednesday2 = wednesday1
# wednesday2 = wednesday2.replace(hour=20, minute=30)
for i in range(36): # We need 10 weeks to get 20 days (2 days per week)
monday = start_date + timedelta(weeks=i)
wednesday1 = monday + timedelta(days=2) # Wednesday is two days after Monday
monday = monday.replace(hour=19, minute=30)
wednesday1= wednesday1.replace(hour=19, minute=30)
wednesday2 = wednesday1
wednesday2 = wednesday2.replace(hour=20, minute=30)
# collection.insert_one({"sede": 1, "livello":0, "data":monday.strftime('%Y-%m-%d %H:%M:%S')})
# collection.insert_one({"sede": 0, "livello":0, "data":wednesday1.strftime('%Y-%m-%d %H:%M:%S')})
# collection.insert_one({"sede": 0, "livello":1, "data":wednesday2.strftime('%Y-%m-%d %H:%M:%S')})
collection.insert_one({"sede": 1, "livello":1, "data":monday.strftime('%Y-%m-%d %H:%M:%S')})
collection.insert_one({"sede": 0, "livello":1, "data":wednesday1.strftime('%Y-%m-%d %H:%M:%S')})
collection.insert_one({"sede": 0, "livello":2, "data":wednesday2.strftime('%Y-%m-%d %H:%M:%S')})

Loading…
Cancel
Save