Add routine management features for child and parent views
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 3m8s
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 3m8s
- Implemented routine child-mode flow tests to ensure proper functionality of routine assignment and task completion. - Created notification tests for parent view to verify routine completion notifications for children. - Developed ChildRoutineOverlay component for displaying routine tasks and handling user interactions. - Added RoutineApproveDialog component for approving or rejecting completed routines. - Created unit tests for ChildRoutineOverlay and RoutineEditView components to ensure correct behavior and rendering. - Enhanced RoutineEditView with proper handling of task addition and form submission. Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import os
|
||||
|
||||
from flask import Flask
|
||||
from api.child_api import child_api
|
||||
import api.child_api as child_api_module
|
||||
from api.auth_api import auth_api
|
||||
from db.db import child_db, reward_db, task_db, users_db, chore_schedules_db, task_extensions_db, pending_confirmations_db
|
||||
from tinydb import Query
|
||||
@@ -585,6 +586,39 @@ def test_list_child_tasks_clears_stale_approved_and_pending(client):
|
||||
assert tasks2[TASK_GOOD_ID]['approved_at'] is None
|
||||
|
||||
|
||||
def test_list_child_tasks_local_day_keeps_approved_across_utc_rollover(client, monkeypatch):
|
||||
"""Approved chore should remain completed when UTC date differs but user-local day matches.
|
||||
|
||||
Example: 2026-05-11T22:30:00Z is 2026-05-12 local day in Pacific/Kiritimati (UTC+14).
|
||||
"""
|
||||
_setup_sched_child_and_tasks(task_db, child_db)
|
||||
|
||||
# Force deterministic local-day basis for this endpoint call.
|
||||
monkeypatch.setattr(
|
||||
child_api_module,
|
||||
'_get_user_today_local',
|
||||
lambda user_id: ('2026-05-12', 'Pacific/Kiritimati'),
|
||||
)
|
||||
|
||||
pending_confirmations_db.insert({
|
||||
'id': 'pend_local_day_approved',
|
||||
'child_id': CHILD_SCHED_ID,
|
||||
'entity_id': TASK_GOOD_ID,
|
||||
'entity_type': 'chore',
|
||||
'user_id': 'testuserid',
|
||||
'status': 'approved',
|
||||
'approved_at': '2026-05-11T22:30:00+00:00',
|
||||
'created_at': 1778538600,
|
||||
'updated_at': 1778538600,
|
||||
})
|
||||
|
||||
resp = client.get(f'/child/{CHILD_SCHED_ID}/list-tasks')
|
||||
assert resp.status_code == 200
|
||||
tasks = {t['id']: t for t in resp.get_json()['tasks']}
|
||||
assert tasks[TASK_GOOD_ID]['pending_status'] == 'approved'
|
||||
assert tasks[TASK_GOOD_ID]['approved_at'] == '2026-05-11T22:30:00+00:00'
|
||||
|
||||
|
||||
def test_confirm_chore_allows_when_previous_pending_is_stale(client):
|
||||
"""A stale pending chore record from a prior day must not block confirm-chore."""
|
||||
old_ts = (datetime.now(timezone.utc) - timedelta(days=2)).timestamp()
|
||||
|
||||
Reference in New Issue
Block a user