This commit is contained in:
2025-12-08 16:08:19 -05:00
parent fa9fabcd9f
commit 5b83fa12ca
14 changed files with 195 additions and 22 deletions

View File

@@ -82,5 +82,28 @@ def populate_default_data():
"rewards": rewards
}
def initializeImages():
"""Initialize the image database with default images if empty."""
if len(image_db.all()) == 0:
image_defs = [
('computer-game', IMAGE_TYPE_ICON, '.png', True),
('ice-cream', IMAGE_TYPE_ICON, '.png', True),
('meal', IMAGE_TYPE_ICON, '.png', True),
('playground', IMAGE_TYPE_ICON, '.png', True),
('tablet', IMAGE_TYPE_ICON, '.png', True),
('boy01', IMAGE_TYPE_PROFILE, '.png', True),
('girl01', IMAGE_TYPE_PROFILE, '.png', True),
('girl02', IMAGE_TYPE_PROFILE, '.png', True),
('boy02', IMAGE_TYPE_PROFILE, '.png', True),
('boy03', IMAGE_TYPE_PROFILE, '.png', True),
('girl03', IMAGE_TYPE_PROFILE, '.png', True),
('boy04', IMAGE_TYPE_PROFILE, '.png', True),
('girl04', IMAGE_TYPE_PROFILE, '.png', True),
]
for _id, _type, ext, perm in image_defs:
img = Image(type=_type, extension=ext, permanent=perm)
img.id = _id
image_db.insert(img.to_dict())
if __name__ == "__main__":
result = populate_default_data()