<commit_before><% days = month.days.order(:value).reverse_order %>
<% if days.last.wday == 0 %>
  <% 6.times{days.push(nil)} %>
<% elsif days.last.wday > 1 %>
  <% (days.last.wday - 1).times{days.push(nil)} %>
<% end %>
<% days = days.reverse %>
<% 6.times{days.push(nil)} %>

<% cache ['month calendar headline', month] do %>
  <div class="row">
    <div class="col-xs-8">
      <h3><%= I18n.t("date.month_names")[month.value] %></h3>
    </div>
    <div class="col-xs-4">
      <h3 class="text-muted"><%= month.year %></h3>
    </div>
  </div>
<% end %>

<table class="table table-condensed">
  <% cache ['month calendar weekdays row', month] do %>
    <thead>
      <tr>
        <% [1,2,3,4,5,6,0].each do |weekday| %>
          <% if WEEKEND_WDAYS.include?(weekday) %>
            <th class="active"><%= I18n.t("date.abbr_day_names")[weekday] %>.</th>    
          <% else %>
            <th><%= I18n.t("date.abbr_day_names")[weekday] %>.</th>    
          <% end %>
        <% end %>
      </tr>
    </thead>
  <% end %>
  <tbody>
    <% days.each_slice(7).to_a.each do |week| %>
      <% if week.uniq != [nil] %>
        <tr>
          <% week.each do |day| %>
            <% if day.nil? %>
              <% css_class = nil %>
            <% else %>
              <% if @inverse_days.include?(day) %>
                <% css_class = 'success' %>
              <% else %>
                <% css_class = nil %>
              <% end %>
              <% if WEEKEND_WDAYS.include?(day.wday) || day.slots.where(vacation_type_id: VacationType.where(public_holiday: true)).any? %>
                <% css_class = 'active' %>
              <% end %>
            <% end %>

            <% if css_class %>
              <td class="text-right <%= css_class %>"><%= day %></td>
            <% else %>
              <td class="text-right"><%= day %></td>
            <% end %>
          <% end %>
        </tr>
      <% end %>
    <% end %>
  </tbody>
</table>

<% this_months_public_holiday_days = month.days.where(id: @public_holiday_days.pluck(:id)).order(:value) %>

<% bundesweite_days = [] %>
<% this_months_public_holiday_days.each do |day| %>
  <% if Slot.where(slotable_type: 'FederalState').where(day_id: day.id).where(vacation_type_id: VacationType.where(public_holiday: true).pluck(:id)).count == 16 %>
    <% bundesweite_days << day %>
  <% end %>
<% end %>

<% if bundesweite_days.any? %>
  <dl>
    <dt>
      <% if bundesweite_days.count == 1 %>
        Bundesweiter Feiertag:
      <% else %>
        Bundesweite Feiertage:
      <% end %>       
    </dt>
    <dd>
      <% output_array = [] %>
      <% bundesweite_days.each do |day| %>
        <% output_array << "#{Slot.where(slotable_type: 'FederalState').where(day_id: day.id).where(vacation_type_id: VacationType.where(public_holiday: true).pluck(:id)).first.vacation_type.name} (#{(I18n.l day.value, format: :short).strip})" %>
      <% end %>
      <%= output_array.join(', ') %>
    </dd>
  </dl>
<% end %><commit_msg>Embed public holidays in <small><commit_after><% days = month.days.order(:value).reverse_order %>
<% if days.last.wday == 0 %>
  <% 6.times{days.push(nil)} %>
<% elsif days.last.wday > 1 %>
  <% (days.last.wday - 1).times{days.push(nil)} %>
<% end %>
<% days = days.reverse %>
<% 6.times{days.push(nil)} %>

<% cache ['month calendar headline', month] do %>
  <div class="row">
    <div class="col-xs-8">
      <h3><%= I18n.t("date.month_names")[month.value] %></h3>
    </div>
    <div class="col-xs-4">
      <h3 class="text-muted"><%= month.year %></h3>
    </div>
  </div>
<% end %>

<table class="table table-condensed">
  <% cache ['month calendar weekdays row', month] do %>
    <thead>
      <tr>
        <% [1,2,3,4,5,6,0].each do |weekday| %>
          <% if WEEKEND_WDAYS.include?(weekday) %>
            <th class="active"><%= I18n.t("date.abbr_day_names")[weekday] %>.</th>    
          <% else %>
            <th><%= I18n.t("date.abbr_day_names")[weekday] %>.</th>    
          <% end %>
        <% end %>
      </tr>
    </thead>
  <% end %>
  <tbody>
    <% days.each_slice(7).to_a.each do |week| %>
      <% if week.uniq != [nil] %>
        <tr>
          <% week.each do |day| %>
            <% if day.nil? %>
              <% css_class = nil %>
            <% else %>
              <% if @inverse_days.include?(day) %>
                <% css_class = 'success' %>
              <% else %>
                <% css_class = nil %>
              <% end %>
              <% if WEEKEND_WDAYS.include?(day.wday) || day.slots.where(vacation_type_id: VacationType.where(public_holiday: true)).any? %>
                <% css_class = 'active' %>
              <% end %>
            <% end %>

            <% if css_class %>
              <td class="text-right <%= css_class %>"><%= day %></td>
            <% else %>
              <td class="text-right"><%= day %></td>
            <% end %>
          <% end %>
        </tr>
      <% end %>
    <% end %>
  </tbody>
</table>

<% this_months_public_holiday_days = month.days.where(id: @public_holiday_days.pluck(:id)).order(:value) %>

<% bundesweite_days = [] %>
<% this_months_public_holiday_days.each do |day| %>
  <% if Slot.where(slotable_type: 'FederalState').where(day_id: day.id).where(vacation_type_id: VacationType.where(public_holiday: true).pluck(:id)).count == 16 %>
    <% bundesweite_days << day %>
  <% end %>
<% end %>

<% if bundesweite_days.any? %>
  <small>
    <dl>
      <dt>
        <% if bundesweite_days.count == 1 %>
          Bundesweiter Feiertag:
        <% else %>
          Bundesweite Feiertage:
        <% end %>       
      </dt>
      <dd>
        <% output_array = [] %>
        <% bundesweite_days.each do |day| %>
          <% output_array << "#{Slot.where(slotable_type: 'FederalState').where(day_id: day.id).where(vacation_type_id: VacationType.where(public_holiday: true).pluck(:id)).first.vacation_type.name} (#{(I18n.l day.value, format: :short).strip})" %>
        <% end %>
        <%= output_array.join(', ') %>
      </dd>
    </dl>
  </small>
<% end %>
{'fraction_non_alphanumeric': 0.20956003969566656, 'fraction_numerical': 0.00992391663910023, 'mean_word_length': 2.156054279749478, 'pattern_counts': {'":': 0, '<': 206, '<?xml version=': 0, '>': 200, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5550472', 'n_tokens_mistral': 2418, 'n_tokens_neox': 2125, 'n_words': 352}