This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def update_children_ages(): | |
| today = date.today() | |
| kids = Kid.query.all() | |
| for kid in kids: | |
| if kid.date_of_birth: | |
| # Calculate age based on DOB | |
| age = today.year - kid.date_of_birth.year - ((today.month, today.day) < (kid.date_of_birth.month, kid.date_of_birth.day)) | |
| kid.age = age | |
| db.session.commit() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @app.route('/backup') | |
| def backup(): | |
| # Get current timestamp to avoid overwriting | |
| timestamp = datetime.now().strftime('%Y-%m-%d_%H-%M-%S') | |
| backup_folder = os.path.join(BACKUP_DIR, f'backup_{timestamp}') | |
| print(timestamp, backup_folder) | |
| print(BACKUP_DIR) | |
| # Create the backup directory |