Add TimeSelector and ScheduleModal components with tests
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m45s
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m45s
- Implemented TimeSelector component for selecting time with AM/PM toggle and minute/hour increment/decrement functionality. - Created ScheduleModal component for scheduling chores with options for specific days or intervals. - Added utility functions for scheduling logic in scheduleUtils.ts. - Developed comprehensive tests for TimeSelector and scheduleUtils functions to ensure correct behavior.
This commit is contained in:
27
backend/db/task_extensions.py
Normal file
27
backend/db/task_extensions.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from db.db import task_extensions_db
|
||||
from models.task_extension import TaskExtension
|
||||
from tinydb import Query
|
||||
|
||||
|
||||
def get_extension(child_id: str, task_id: str, date: str) -> TaskExtension | None:
|
||||
q = Query()
|
||||
result = task_extensions_db.search(
|
||||
(q.child_id == child_id) & (q.task_id == task_id) & (q.date == date)
|
||||
)
|
||||
if not result:
|
||||
return None
|
||||
return TaskExtension.from_dict(result[0])
|
||||
|
||||
|
||||
def add_extension(extension: TaskExtension) -> None:
|
||||
task_extensions_db.insert(extension.to_dict())
|
||||
|
||||
|
||||
def delete_extensions_for_child(child_id: str) -> None:
|
||||
q = Query()
|
||||
task_extensions_db.remove(q.child_id == child_id)
|
||||
|
||||
|
||||
def delete_extensions_for_task(task_id: str) -> None:
|
||||
q = Query()
|
||||
task_extensions_db.remove(q.task_id == task_id)
|
||||
Reference in New Issue
Block a user