Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/subscriptions/routes/promocodes_mub.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ async def list_promocodes(
limit: Annotated[int, Query(ge=1, le=100)] = 100,
) -> Sequence[Promocode]:
return await Promocode.find_paginated_by_kwargs(
offset, limit, Promocode.created_at.desc()
offset,
limit,
Promocode.created_at.desc(),
Promocode.id.desc(),
)


Expand Down
5 changes: 4 additions & 1 deletion tests/autocomplete/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,13 @@ def generate_subject_name(
faker: Faker,
prefix: str,
suffix: str,
unique_letter: str,
) -> str:
random_part: str = faker.bothify(
"?" * faker.random_int(min=0, max=90),
letters=quarter_of_ascii_letters_any_case(3),
)
return prefix + random_part + suffix
return prefix + random_part + unique_letter + suffix


@pytest.fixture()
Expand All @@ -125,6 +126,7 @@ async def subjects(
odd_subject_name_suffix: str,
) -> AsyncIterator[list[Subject]]:
subjects: list[Subject] = []
unique_letters = quarter_of_ascii_letters_any_case(3)
async with active_session():
for i in range(SUBJECT_LIST_SIZE):
subjects.append(
Expand All @@ -137,6 +139,7 @@ async def subjects(
if i % 2 == 0
else odd_subject_name_suffix
),
unique_letter=unique_letters[i],
),
tutor_id=None if i % 2 == 0 else tutor_user_id,
)
Expand Down
5 changes: 4 additions & 1 deletion tests/subscriptions/functional/test_promocodes_list_mub.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ async def promocodes(
for i in range(PROMOCODES_LIST_SIZE)
]

promocodes.sort(key=lambda promocode: promocode.created_at, reverse=True)
promocodes.sort(
key=lambda promocode: (promocode.created_at, promocode.id),
reverse=True,
)

yield promocodes

Expand Down
Loading