1.1.2
This commit is contained in:
+1
-1
@@ -23,7 +23,7 @@ def main(userid, db):
|
|||||||
{"$push": {"pagamenti": month.strftime('%Y-%m-%d %H:%M:%S')}}
|
{"$push": {"pagamenti": month.strftime('%Y-%m-%d %H:%M:%S')}}
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
collection.find_one_and_update(
|
collection.update_one(
|
||||||
{"_id": ObjectId(userid)},
|
{"_id": ObjectId(userid)},
|
||||||
{"$pull": {"pagamenti": month.strftime('%Y-%m-%d %H:%M:%S')}}
|
{"$pull": {"pagamenti": month.strftime('%Y-%m-%d %H:%M:%S')}}
|
||||||
)
|
)
|
||||||
|
|||||||
+19
-19
@@ -15,34 +15,34 @@ collection = db.livelli
|
|||||||
|
|
||||||
# for row in jsonfile:
|
# for row in jsonfile:
|
||||||
# print(row)
|
# print(row)
|
||||||
collection.insert_one({"id":"3","nome":"Advanced"})
|
# collection.insert_one({"id":"3","nome":"Advanced"})
|
||||||
collection.insert_one({"id":"2","nome":"Improver"})
|
# collection.insert_one({"id":"2","nome":"Improver"})
|
||||||
collection.insert_one({"id":"1","nome":"Beginners"})
|
# 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 from a known Monday.
|
||||||
# start_date = datetime(2023,10,1)
|
start_date = datetime(2023,10,1)
|
||||||
|
|
||||||
# while start_date.weekday() != 0: # 0 represents Monday in weekday()
|
while start_date.weekday() != 0: # 0 represents Monday in weekday()
|
||||||
# start_date -= timedelta(days=1)
|
start_date -= timedelta(days=1)
|
||||||
|
|
||||||
|
|
||||||
# for i in range(36): # We need 10 weeks to get 20 days (2 days per week)
|
for i in range(36): # We need 10 weeks to get 20 days (2 days per week)
|
||||||
# monday = start_date + timedelta(weeks=i)
|
monday = start_date + timedelta(weeks=i)
|
||||||
# wednesday1 = monday + timedelta(days=2) # Wednesday is two days after Monday
|
wednesday1 = monday + timedelta(days=2) # Wednesday is two days after Monday
|
||||||
# monday = monday.replace(hour=19, minute=30)
|
monday = monday.replace(hour=19, minute=30)
|
||||||
# wednesday1= wednesday1.replace(hour=19, minute=30)
|
wednesday1= wednesday1.replace(hour=19, minute=30)
|
||||||
# wednesday2 = wednesday1
|
wednesday2 = wednesday1
|
||||||
# wednesday2 = wednesday2.replace(hour=20, minute=30)
|
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": 1, "livello":1, "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":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": 0, "livello":2, "data":wednesday2.strftime('%Y-%m-%d %H:%M:%S')})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user