{% assign activities_count = 0 %}
{% for course_section in course.sections %}
  {% for course_activity in course_section.activities %}
    {% assign activities_count = activities_count | plus: 1 %}
  {% endfor %}
{% endfor %} 

<div class="np-course-details">
    <div class="np-course-detail" id='hideable'>                 
        <strong>{{ activities_count }}</strong>
        <span class="np-details-label">
          {% if activities_count == 1 %}Activity{% else %}Activities{% endif %}
        </span>
    </div>
    <div class="np-course-detail">
      {% unless course.properties.course_length contains 'NULL' %}
          <strong>{{course.properties.course_length}}</strong>
          <span class="np-details-label">
         Duration
        </span>
      {% endunless %}
    </div>
</div>

<style>
  .course-detail-rating {
    align-self: flex-end;
  }
</style>