{% assign similar_count = 0 | plus: 0 %}
{% assign categories_names = course.categories | map: "name" %}
{% assign property = "" %}
<div class="courses-list container-fluid ">
  <div class="courses-list-title">
    SIMILAR COURSES
  </div>
  <div class="courses-list-list row">
    {% for checked_course in courses.in_catalog %}
      {% if checked_course.id != course.id %}
        {% for category in checked_course.categories %}
          {% if categories_names contains category.name %}
            {% capture course_path %}{% route course, id: checked_course.id %}{% endcapture %}
            <a class="list-course col" href="{{ course_path }}">
                <img class="list-course-image" src="{{ checked_course.image_url }}">
                <div class="list-course-name">
                    {{ checked_course.name }}
                </div>
            </a>
            {% assign similar_count = similar_count | plus: 1 %}
            {% break %}
          {% endif %}
        {% endfor %}
      {% endif %}
      {% if similar_count == 5 %} {% break %} {% endif %}
    {% endfor %}
  </div>
  <a class="courses-list-more" href="/app/catalog">
    More courses <i class="fa-solid fa-angle-right"></i>
  </a>
</div>

