Skip to content

Commit

Permalink
feat(earnings): filter by specific organisation, all organizations br…
Browse files Browse the repository at this point in the history
…eaks loading
  • Loading branch information
kasmediautamu committed Jul 10, 2022
1 parent c8859da commit 2f39caa
Show file tree
Hide file tree
Showing 13 changed files with 14,300 additions and 13,247 deletions.
276 changes: 2 additions & 274 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions src/components/Captures/CaptureTooltip.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React from 'react';
import OptimizedImage from '../OptimizedImage';
import {
Box
} from '@material-ui/core';
import { Box } from '@material-ui/core';
const CaptureTooltip = ({ capture, toggleDrawer }) => {
return (
<Box>
Expand Down
10 changes: 5 additions & 5 deletions src/components/Filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ function Filter(props) {
const [captureId, setCaptureId] = useState(filter?.captureId || '');
const [growerId, setGrowerId] = useState(filter?.planterId || '');
const [deviceIdentifier, setDeviceIdentifier] = useState(
filter?.deviceIdentifier || '',
filter?.deviceIdentifier || ''
);
const [growerIdentifier, setGrowerIdentifier] = useState(
filter?.planterIdentifier || '',
filter?.planterIdentifier || ''
);
const [status, setStatus] = useState(filter?.status);
const [approved, setApproved] = useState(filter?.approved);
const [active, setActive] = useState(filter?.active);
const [dateStart, setDateStart] = useState(
filter?.dateStart || dateStartDefault,
filter?.dateStart || dateStartDefault
);
const [dateEnd, setDateEnd] = useState(filter?.dateEnd || dateEndDefault);
const [tokenId, setTokenId] = useState(filter?.tokenId || filterOptionAll);
Expand Down Expand Up @@ -217,15 +217,15 @@ function Filter(props) {
: e.target.value === verificationStates.AWAITING ||
e.target.value === verificationStates.REJECTED
? false
: true,
: true
);
setActive(
e.target.value === filterOptionAll
? undefined
: e.target.value === verificationStates.AWAITING ||
e.target.value === verificationStates.APPROVED
? true
: false,
: false
);
}}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Home/Home.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Home', () => {
<BrowserRouter>
<Home />
</BrowserRouter>,
container,
container
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/IconLogo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Link } from 'react-router-dom';
import logo from './images/logo.svg'
import logo from './images/logo.svg';

/*
* Just a logo icon
Expand Down
19 changes: 16 additions & 3 deletions src/components/common/CustomTableFilter/CustomTableFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,22 @@ function CustomTableFilter(props) {
...localFilter,
};

setFilter(filtersToSubmit);
setIsFilterOpen(false);
updateSelectedFilter(filtersToSubmit);
if (filtersToSubmit.organization_id === ALL_ORGANIZATIONS) {
const modifiedFiltersToSubmit = {
...filtersToSubmit,
organization_id: '',
sub_organization: '',
};
setFilter(modifiedFiltersToSubmit);
setIsFilterOpen(false);
updateSelectedFilter({
modifiedFiltersToSubmit,
});
} else {
setFilter(filtersToSubmit);
setIsFilterOpen(false);
updateSelectedFilter(filtersToSubmit);
}
};

const handleOnFilterFormReset = (e) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/reportingCards/ReportingCard7.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function component(props) {
'catchments',
'catchments',
(data) => data.average,
rows,
rows
);

return (
Expand Down
8 changes: 4 additions & 4 deletions src/components/tests/growers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('growers', () => {
</GrowerProvider>
</AppProvider>
</BrowserRouter>
</ThemeProvider>,
</ThemeProvider>
);

await act(() => api.getGrowers());
Expand All @@ -56,13 +56,13 @@ describe('growers', () => {

it('renders grower page', () => {
expect(
screen.getByText(/testFirstName testLastName/i),
screen.getByText(/testFirstName testLastName/i)
).toBeInTheDocument();
expect(
screen.getByText(/testFirstName2 testLastName2/i),
screen.getByText(/testFirstName2 testLastName2/i)
).toBeInTheDocument();
expect(
screen.getByText(/testFirstName3 testLastName3/i),
screen.getByText(/testFirstName3 testLastName3/i)
).toBeInTheDocument();

const ids = screen.getAllByText(/ID:/i);
Expand Down
2 changes: 1 addition & 1 deletion src/components/tests/species.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('species management', () => {
<SpeciesView />
</SpeciesProvider>
</AppProvider>
</BrowserRouter>,
</BrowserRouter>
);
await act(() => api.getSpecies());
});
Expand Down
4 changes: 2 additions & 2 deletions src/context/CapturesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ export function CapturesProvider(props) {
})
.catch((err) => {
setIsLoading(false);
console.error(`ERROR: FAILED TO GET SELECTED TREE ${err}`)
});
console.error(`ERROR: FAILED TO GET SELECTED TREE ${err}`);
});
};

const updateFilter = async (filter) => {
Expand Down
2 changes: 1 addition & 1 deletion src/models/FilterGrower.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe.skip('FilterGrower, with initial filter values', () => {
id: 1,
lastName: { ilike: 'ln' },
personId: 1,
}),
})
);
});
});
8 changes: 4 additions & 4 deletions src/registerServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const isLocalhost = Boolean(
window.location.hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/,
),
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
);

export default function register() {
Expand All @@ -41,7 +41,7 @@ export default function register() {
navigator.serviceWorker.ready.then(() => {
console.log(
'This web app is being served cache-first by a service ' +
'worker. To learn more, visit https://goo.gl/SC7cgQ',
'worker. To learn more, visit https://goo.gl/SC7cgQ'
);
});
} else {
Expand Down Expand Up @@ -103,7 +103,7 @@ function checkValidServiceWorker(swUrl) {
})
.catch(() => {
console.log(
'No internet connection found. App is running in offline mode.',
'No internet connection found. App is running in offline mode.'
);
});
}
Expand Down
Loading

0 comments on commit 2f39caa

Please sign in to comment.