-
-
Notifications
You must be signed in to change notification settings - Fork 21
Description
π§© Overview
This issue focuses on showing dynamic status icons (ββ complete, β partial, β― incomplete) to indicate the completion state of the Contact Info section in the Host Profile. The backend evaluates the user's submitted data and returns a status that the frontend uses to render the correct icon.
More Info
This form is part of the Host Profile intake. Users can select a preferred contact method ("Email" or "Text") and optionally fill out a phone number.
The UI displays a status icon based on backend logic:
- ββ Complete: All required fields are valid based on context (e.g., email chosen, phone not needed)
- β Partial: At least one field is filled, but not enough to count as complete
- β― Incomplete: No relevant data provided
Example: If the user chooses "Email" as their preferred method but does not provide a phone number, the status should still show ββ because phone is not required in that context.
π Scope of Work
- Make
phone_numberoptional in schema and DB - Evaluate contact info completion based on conditional rules
- Return correct status (
complete,partial, orincomplete) - Status should drive icon logic on the frontend
- Prevent duplicate
contact_infoentries (update existing if sameuser_id)
π§ Engineering Tasks
Steps to Implement:
-
Make
phone_numberoptional inContactInfoCreateschema -
Update Alembic migration to make
phone_numbernullable in DB -
Modify
crud.pyto update existing contact info -
Update
determine_status()inroutes.py:- ββ If
preferred_method == "Email"βphone_numbernot required for complete - ββ If
preferred_method == "Text"βphone_numberis required for complete - β One of the fields present but not enough to meet full rules β partial
- β― Neither field provided β incomplete
- ββ If
β Acceptance Criteria
- Submitting contact info with only email (preferred_method=email) is valid
- Submitting contact info with phone (preferred_method=phone) requires phone_number with 10+ digits
- Backend replaces existing entry if user already has a contact_info row
- Backend
/completion-statusreturns correct status based on inputs - Frontend shows ββ if contact info is "complete", β if partial, β― if incomplete
- Status icons are clearly visible and emphasized in UI
π Dependencies
- Frontend must implement logic to map
completion-statusto appropriate status icons
π¦ Technical Notes
- Backend: FastAPI, SQLAlchemy, Pydantic
- Used
Optional[str]forphone_numberin Pydantic schema - Status is computed dynamically using
determine_status()in route - Backend logic ensures only one row per user in
contact_infotable - Frontend updates icon based on backend status: ββ / β / β―
- POST
/contact-infoacts as upsert - GET
/completion-status/{user_id}returns{ "Contact Information": "complete" | "partial" | "incomplete" }
π§ͺ Testing Strategy
All validation can be covered by manual testing:
-
β Submit form with:
- Preferred method: email only β ββ complete
- Preferred method: phone + valid number β ββ complete
- Preferred method: phone + short/invalid number β β partial
- No input at all β β― incomplete
-
β Observe status icons update correctly in UI
-
β Reload form and ensure saved data is preserved
-
β Resubmit form to test replacement (edit + save again)
-
β Check backend DB only contains one row per user
π© Risks / Considerations
- Risk: If backend logic doesn't perfectly match frontend icon mapping, users could be misled
- Consideration: Validation rules must remain synchronized between frontend and backend
π§΅ Related Issues
- Dev: Form Validation Feature for Host IntakeΒ #720
- Dev: Connect Host Contact Information Form to DatabaseΒ #919
Action Items
- Update issue with current Engineering Issue Template format
- Come up with a solution
- Discuss with Dev Lead & Dev PM
- Share proposal with Product and Design
π Resources
Attachments/Screenshots (If Applicable):
- N/A
Metadata
Metadata
Assignees
Labels
Type
Projects
Status