added defaults for now.

reworked tasks and pending rewards
This commit is contained in:
2025-12-15 15:08:27 -05:00
parent c375c34ed2
commit 3b3d14e454
7 changed files with 105 additions and 4 deletions

View File

@@ -82,6 +82,42 @@ def populate_default_data():
"rewards": rewards
}
def createDefaultTasks():
"""Create default tasks if none exist."""
if len(task_db.all()) == 0:
default_tasks = [
Task(name="Take out trash", points=2, is_good=True, image_id="trash-can"),
Task(name="Make your bed", points=2, is_good=True, image_id="make-the-bed"),
Task(name="Sweep and clean kitchen", points=2, is_good=True, image_id="vacuum"),
Task(name="Do homework early", points=2, is_good=True, image_id="homework"),
Task(name="Be good for the day", points=2, is_good=True, image_id="good"),
Task(name="Clean your mess", points=2, is_good=True, image_id="broom"),
Task(name="Fighting", points=2, is_good=False, image_id="fighting"),
Task(name="Yelling at parents", points=2, is_good=False, image_id="yelling"),
Task(name="Lying", points=2, is_good=False, image_id="lying"),
Task(name="Not doing what told", points=2, is_good=False, image_id="ignore"),
Task(name="Not flushing toilet", points=2, is_good=False, image_id="toilet"),
]
for task in default_tasks:
task_db.insert(task.to_dict())
def createDefaultRewards():
"""Create default rewards if none exist."""
if len(reward_db.all()) == 0:
default_rewards = [
Reward(name="Choose meal", description="Choose dinner or lunch", cost=3, image_id="meal"),
Reward(name="$1", description="Money is always nice", cost=8, image_id='money'),
Reward(name="$5", description="Even more money", cost=12, image_id='money'),
Reward(name="Tablet 1 hour", description="Play your games", cost=5, image_id='tablet'),
Reward(name="Computer with dad", description="Let's play a game together", cost=5, image_id='games-with-dad'),
Reward(name="Computer 1 hour", description="Minecraft or Terraria?", cost=5, image_id='computer-game'),
Reward(name="TV 1 hour", description="Too much is bad for you.", cost=5, image_id='tv'),
Reward(name="Candy from store", description="Yum!", cost=5, image_id='candy'),
]
for reward in default_rewards:
reward_db.insert(reward.to_dict())
def initializeImages():
"""Initialize the image database with default images if empty."""
if len(image_db.all()) == 0:
@@ -91,6 +127,7 @@ def initializeImages():
('boy03', IMAGE_TYPE_PROFILE, '.png', True),
('boy04', IMAGE_TYPE_PROFILE, '.png', True),
('broom', IMAGE_TYPE_ICON, '.png', True),
('candy', IMAGE_TYPE_ICON, '.png', True),
('computer-game', IMAGE_TYPE_ICON, '.png', True),
('fighting', IMAGE_TYPE_ICON, '.png', True),
('games-with-dad', IMAGE_TYPE_ICON, '.png', True),