update sync chicken counting realtime mirrored from weight sync, remove panel iot cron
This commit is contained in:
1 parent
83a41fbbcb
commit
a6d4ddac65
9 files changed
+40
-17
No files matched your search
@@ -68,6 +68,12 @@ const DataManagementPage: React.FC<{ onSettings: () => void }> = ({ onSettings }
|
||||
}
|
||||
setError(null);
|
||||
try {
|
||||
try {
|
||||
await api.countings.sync({ cycle_id: cycleId });
|
||||
} catch {
|
||||
// Best-effort edge sync: don't fail page load if edge vision API is temporarily unreachable
|
||||
}
|
||||
|
||||
const [k, c, m, freshCycle] = await Promise.all([
|
||||
api.kpis.list({ cycle_id: cycleId }),
|
||||
api.countings.list({ cycle_id: cycleId }),
|
||||
|
||||
@@ -116,6 +116,15 @@ describe('DataManagementPage', () => {
|
||||
expect(screen.getAllByText('0.0%').length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('automatically calls chicken counting sync on load', async () => {
|
||||
render(<DataManagementPage onSettings={() => undefined} />);
|
||||
|
||||
await screen.findByRole('heading', { name: 'Hitung Ayam' });
|
||||
await waitFor(() => {
|
||||
expect(api.countings.sync).toHaveBeenCalledWith({ cycle_id: 1 });
|
||||
});
|
||||
});
|
||||
|
||||
it('calls chicken counting sync when Sync is clicked', async () => {
|
||||
render(<DataManagementPage onSettings={() => undefined} />);
|
||||
|
||||
|
||||
Reference in new issue
Block a user