title: Count events per day with resources Fullcalendar
body: <p>I am trying to count the events per day on fullcalendar but I am getting the wrong output. what I am trying to do is group and count the event per day and group by resources. but the output is just grouping it and assigning it on the 1st resource group</p>
  
  <p><a href="https://jsbin.com/vakowum/2/edit?js,output" rel="nofollow noreferrer">This</a> is my fiddle</p>
  
  <pre><code>eventRender: function(event, element) {
      flagEvent(event, element);
      if (event.end &amp;&amp; event.start.format('YYYY-MM-DD') !== event.end.format('YYYY-MM-DD')) {
        while (event.end &gt; event.start) {
          event.start.add(1, 'day');
          console.log('flag', event.start.format('YYYY-MM-DD'))
          flagEvent(event, element);
        }
      }
    },
    eventAfterAllRender: function(view) {
      $('#calendar .fc-day.fc-widget-content').each(function(i) {
        var date = $(this).data('date'),
          count = $('#calendar a.fc-event.event-on-' + date).length;
        if (count &gt; 0) {
          $(this).html('&lt;div class="fc-event-count"&gt;' + (count) + '&lt;div&gt;');
        } else {
          $(this).html('&lt;div class="fc-event-count"&gt;&lt;div&gt;');
        }
      });
  
    },
  </code></pre>
  
  <p>This should be the output base on the given data:</p>
  
  <p><a href="https://i.stack.imgur.com/OpIub.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OpIub.png" alt="enter image description here"></a></p>