nromanen / crash_course_2024

5 stars 0 forks source link

No trimming in the search results #39

Open ArgasDTiger opened 6 months ago

ArgasDTiger commented 6 months ago

Bug description The clubs on the search page appear to be sorted correctly, with clubs having Ukrainian names listed first, followed by those with English names. But as we move to the second page of the search, we find out that alphabetical sort is still applied, but after clubs with English names we meet clubs with Ukrainian names again, though we've already encountered this kind of clubs. The issue arises due to a space at the beginning of the first club's name, because in the ASCII table space comes before letters.

Preconditions Opened website http://speak-ukrainian.eastus2.cloudapp.azure.com/dev/

Steps to reproduce Steps to reproduce the behavior:

  1. Click on 'Розширений пошук'
  2. Select 'Сортувати: за алфавітом'
  3. Scroll down to the pagination panel
  4. Click '2'

Actual result Initially, club with the space before Ukrainian name is displayed, followed by clubs with English names, and then again clubs with Ukrainian names. It creates vision like there is no sorting applied to the search results.

Expected result In the search result all the club names should be trimmed, so there is no "sorting by space" and we get clubs with English names first, followed by clubs with Ukrainian names.

Screenshots Page 1: зображення Page 2: зображення

Desktop:

Smartphone:

nromanen commented 6 months ago

Те, що знайшли помилку - це супер. Але якщо проаналізувати всі сторінки, то проблема тільки в першому гуртку, всі інші сортуються вірно, оскільки коди латинських букв менші за коди кирилиці. Тоді починаємо копати. Якщо подивитися в dev tools -> networking, то при діях, що описані в дефекті, відпрацьовує метод get http://speak-ukrainian.eastus2.cloudapp.azure.com/dev/api/clubs/search/advanced?name=&cityName=%D0%9A%D0%B8%D1%97%D0%B2&sort=name,asc&page=0. Якщо подивитися у відповідь, то маємо такий початок: { "content": [ { "id": 149, "ageFrom": 4, "ageTo": 16, "name": " Центр дитячо-юнацької творчості",

Бачимо, що в назві перед буквою Ц стоїть пробіл, код якого (32) відповідно більший за коди букв, тому формально це не баг, але проблема є, спробуйте описати її :)

ArgasDTiger commented 6 months ago

Зрозумів, дякую, в тому числі і за запис! Наскільки я розумію, то відсутність обрізання результатів вже можна вважати багом, так?