From 2617ab41fb664b90f0c0fb7e27b47d88f7226985 Mon Sep 17 00:00:00 2001 From: Lvyshnevska Date: Fri, 5 Apr 2024 12:46:04 +0200 Subject: [PATCH 1/2] ordering fixed --- FrontEnd/src/components/SearchPage/Search.jsx | 2 +- FrontEnd/src/components/landing-page/companies/Companies.jsx | 2 +- FrontEnd/src/components/profileList/ProfileListPage.jsx | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/FrontEnd/src/components/SearchPage/Search.jsx b/FrontEnd/src/components/SearchPage/Search.jsx index 0da0a79b1..e8d41ef97 100644 --- a/FrontEnd/src/components/SearchPage/Search.jsx +++ b/FrontEnd/src/components/SearchPage/Search.jsx @@ -28,7 +28,7 @@ export function Search({ isAuthorized }) { }; const { data: companylist, error } = useSWR( - `${servedAddress}/api/search/?name=${searchTerm}`, + `${servedAddress}/api/search/?name=${searchTerm}&ordering=name`, fetcher ); diff --git a/FrontEnd/src/components/landing-page/companies/Companies.jsx b/FrontEnd/src/components/landing-page/companies/Companies.jsx index 2b1a7db53..5fad295c0 100644 --- a/FrontEnd/src/components/landing-page/companies/Companies.jsx +++ b/FrontEnd/src/components/landing-page/companies/Companies.jsx @@ -17,7 +17,7 @@ const MainCompanies = ({ isAuthorized }) => { }; const { data: companylist } = useSWR( - `${baseUrl}/api/profiles/?new_members=-completeness,-created_at`, + `${baseUrl}/api/profiles/?ordering=-completeness,-created_at`, fetcher ); diff --git a/FrontEnd/src/components/profileList/ProfileListPage.jsx b/FrontEnd/src/components/profileList/ProfileListPage.jsx index 48f604fd3..504584a4d 100644 --- a/FrontEnd/src/components/profileList/ProfileListPage.jsx +++ b/FrontEnd/src/components/profileList/ProfileListPage.jsx @@ -33,13 +33,13 @@ export default function ProfileListPage({ isAuthorized }) { setCurrentPage(1); }, [filter]); - const urlForAll = `${process.env.REACT_APP_BASE_API_URL}/api/profiles/?${profileFilter}&page=${currentPage}`; + const urlForAll = `${process.env.REACT_APP_BASE_API_URL}/api/profiles/?${profileFilter}&ordering=name&page=${currentPage}`; const urlForSaved = `${ process.env.REACT_APP_BASE_API_URL }/api/profiles/?${profileFilter}${ filterSaved ? '&is_saved=True' : '' - }&page=${currentPage}`; + }&ordering=-saved_at&page=${currentPage}`; async function fetcher(url) { return axios.get(url) From 5282e89e5b5ae9601776969f56ed5a6cfcdd7ba8 Mon Sep 17 00:00:00 2001 From: Lvyshnevska Date: Fri, 5 Apr 2024 12:46:34 +0200 Subject: [PATCH 2/2] test updated --- FrontEnd/src/tests/MainCompanies.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FrontEnd/src/tests/MainCompanies.test.js b/FrontEnd/src/tests/MainCompanies.test.js index 70b15c33f..9ab06bc3f 100644 --- a/FrontEnd/src/tests/MainCompanies.test.js +++ b/FrontEnd/src/tests/MainCompanies.test.js @@ -100,7 +100,7 @@ describe('MainCompanies component unit tests', () => { ); expect(axios.get).toHaveBeenCalledWith( - 'http://localhost:8000/api/profiles/?new_members=-completeness,-created_at' + 'http://localhost:8000/api/profiles/?ordering=-completeness,-created_at' ); const divElement = screen.getByText(/Нові учасники/i, { exact: false }); const onenameElement = screen.getByText(/saleonline/i, {