Skip to content

feat: Add health evolution tracking for animals#32

Draft
google-labs-jules[bot] wants to merge 3 commits into
mainfrom
feat/health-tracking
Draft

feat: Add health evolution tracking for animals#32
google-labs-jules[bot] wants to merge 3 commits into
mainfrom
feat/health-tracking

Conversation

@google-labs-jules

Copy link
Copy Markdown

This change adds a new feature to track the health evolution of an animal. This allows users to record health observations with a date, such as "diarrhea".

The implementation is complete, but the tests for this new feature are currently failing. I was in the process of fixing them.

… an animal. This allows users to record health observations with a date, such as "diarrhea".

The following changes were made:
- **Data Model:**
  - Added a `HealthLog` interface to `src/models/types.ts`.
  - Updated `AppState` and `BackupFile` interfaces to include `healthLogs`.
- **State Management:**
  - Updated the Zustand store in `src/state/store.ts` to manage `healthLogs`.
  - Added `addHealthLog`, `updateHealthLog`, and `deleteHealthLog` actions.
  - Ensured that deleting an animal also deletes its associated health logs.
- **UI Components:**
  - Created a new `HealthLogModal.tsx` component for adding/editing health observations.
  - Configured lazy loading for the new modal in `src/components/LazyComponents.tsx`.
- **Animal Detail Page:**
  - Modified `src/pages/Animals/AnimalDetailPage.tsx` to display the health log history in the "Health" tab.
  - Added a button to open the new modal.
- **Testing:**
  - Added a new test file `src/test/healthlog.test.ts` with unit tests for the new store actions.

**Current Status:**
The implementation of the feature is complete. However, the newly created tests in `src/test/healthlog.test.ts` are currently failing. I have identified the issue: the store actions are being called incorrectly in the test file. I was in the process of fixing these tests when I was asked to finish my work. The fix involves changing `useAppStore` to `useAppStore.getState()` when destructuring actions in the tests. I have already fixed some of the tests but not all of them.
@hankerspace

Copy link
Copy Markdown
Owner

@copilot fix tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant