40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
# This generates database file
|
|
|
|
from pysondb import db
|
|
import os
|
|
|
|
care_db_file_name = "care_status.json"
|
|
care_transactions_file_name = "care_transactions.json"
|
|
|
|
|
|
# Clear out database files
|
|
def remove_file(file_name):
|
|
if os.path.exists(file_name):
|
|
os.remove(file_name)
|
|
|
|
|
|
remove_file(care_db_file_name)
|
|
remove_file(care_transactions_file_name)
|
|
|
|
|
|
# Recreate database files
|
|
status_db = db.getDb(care_db_file_name)
|
|
transactions_db = db.getDb(care_transactions_file_name)
|
|
|
|
|
|
#We need to create a database where the first column is the animal name, and the subsequent columns are whether the food was prepped, they were fed, house was cleaned, and whether they had leftovers
|
|
|
|
columns_to_add = ["got_prepped", "was_fed", "has_cleaned", "has_leftovers"]
|
|
animal_names = ["Gordie", "Ozzy", "Cuddles", "Kya", "Scooter", "Juju", "Wanda"]
|
|
|
|
|
|
# Go row by row, and add information
|
|
for animal in animal_names:
|
|
row_to_add = {'name': animal}
|
|
for column in columns_to_add:
|
|
row_to_add[column] = False #Set the "prepped/fed/cleaned/leftovers to false
|
|
|
|
status_db.add(row_to_add)
|
|
|
|
|