Skip to content

Commit

Permalink
Merge branch 'develop' into 839-implement-the---who-we-are-page
Browse files Browse the repository at this point in the history
  • Loading branch information
YanZhylavy committed Nov 25, 2024
2 parents c3fa37d + 4be84db commit 9ecd3e7
Show file tree
Hide file tree
Showing 147 changed files with 3,548 additions and 3,498 deletions.
10 changes: 8 additions & 2 deletions BackEnd/forum/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@


class ForumPagination(PageNumberPagination):
page_size = 6
page_size = 16
page_size_query_param = "page_size"
max_page_size = 18
max_page_size = 64

def get_page_number(self, request, paginator):
page_number = super().get_page_number(request, paginator)
if int(page_number) > paginator.num_pages:
page_number = paginator.num_pages or 1
return page_number

def get_paginated_response(self, data):
return Response(
Expand Down
36 changes: 9 additions & 27 deletions BackEnd/profiles/tests/test_new_members.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,6 @@ def setUp(self) -> None:
self.company_dnipro.created_at = utc_datetime(2023, 12, 2)
self.company_dnipro.save()

self.company_kharkiv = ProfileStartupFactory(
name="Kharkiv",
person=self.kharkiv_user,
completeness=1,
)
self.company_kharkiv.created_at = utc_datetime(2023, 12, 3)
self.company_kharkiv.save()

self.company_chernigiv = ProfileStartupFactory(
name="Chernigiv",
person=self.chernigiv_user,
completeness=1,
)
self.company_chernigiv.created_at = utc_datetime(2023, 12, 4)
self.company_chernigiv.save()

self.company_kirovohrad = ProfileCompanyFactory(
name="Kirovohrad",
person=self.kirovohrad_user,
Expand All @@ -163,17 +147,17 @@ def setUp(self) -> None:

def test_get_less_companies(self):
response = self.client.get(
path="/api/profiles/?ordering=-completeness,-created_at"
path="/api/profiles/?ordering=-completeness,-created_at&page_size=4"
)
names_from_response = [
prof["name"] for prof in response.data["results"]
]
self.assertEqual(
["Kirovohrad", "Dnipro", "Kyiv", "Chernigiv", "Kharkiv"],
["Kirovohrad", "Dnipro", "Kyiv"],
names_from_response,
)
self.assertEqual(200, response.status_code)
self.assertEqual(5, response.data["total_items"])
self.assertEqual(3, response.data["total_items"])
self.assertEqual(1, response.data["current"])
self.assertEqual(1, response.data["total_pages"])
self.assertEqual(None, response.data["next"])
Expand All @@ -187,7 +171,7 @@ def test_get_enough_companies(self):
self.company_synelnicovo.created_at = utc_datetime(2023, 12, 7)
self.company_synelnicovo.save()
response = self.client.get(
path="/api/profiles/?ordering=-completeness,-created_at"
path="/api/profiles/?ordering=-completeness,-created_at&page_size=4"
)
self.assertEqual(200, response.status_code)
names_from_response = [
Expand All @@ -200,12 +184,10 @@ def test_get_enough_companies(self):
"Kirovohrad",
"Dnipro",
"Kyiv",
"Chernigiv",
"Kharkiv",
],
names_from_response,
)
self.assertEqual(6, response.data["total_items"])
self.assertEqual(4, response.data["total_items"])
self.assertEqual(1, response.data["current"])
self.assertEqual(1, response.data["total_pages"])
self.assertEqual(None, response.data["next"])
Expand All @@ -228,20 +210,20 @@ def test_get_more_companies(self):
self.company_odesa.save()

response = self.client.get(
path="/api/profiles/?ordering=-completeness,-created_at"
path="/api/profiles/?ordering=-completeness,-created_at&page_size=4"
)
names_from_response = [
prof["name"] for prof in response.data["results"]
]
self.assertEqual(
["Odesa", "Mykolaiv", "Kirovohrad", "Dnipro", "Kyiv", "Chernigiv"],
["Odesa", "Mykolaiv", "Kirovohrad", "Dnipro"],
names_from_response,
)
self.assertEqual(200, response.status_code)
self.assertEqual(7, response.data["total_items"])
self.assertEqual(5, response.data["total_items"])
self.assertEqual(1, response.data["current"])
self.assertEqual(2, response.data["total_pages"])
self.assertEqual(
"http://testserver/api/profiles/?ordering=-completeness%2C-created_at&page=2",
"http://testserver/api/profiles/?ordering=-completeness%2C-created_at&page=2&page_size=4",
response.data["next"],
)
2 changes: 1 addition & 1 deletion BackEnd/profiles/tests/test_ordering.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ def test_get_list_of_profiles_completeness_order_asc(self):
self.assertEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual(
[
"Winery",
"Bakery",
"Winery",
"Delivery company",
"Catering service",
"Retail company",
Expand Down
1 change: 0 additions & 1 deletion FrontEnd/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified FrontEnd/public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrontEnd/public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrontEnd/public/favicon.ico
Binary file not shown.
Binary file removed FrontEnd/public/forum-logo.ico
Binary file not shown.
Binary file added FrontEnd/public/img/cookies.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FrontEnd/public/img/main-baner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions FrontEnd/public/svg/arrow-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions FrontEnd/public/svg/arrow-up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9ecd3e7

Please sign in to comment.