<tr class="nested-fields"
    style="<%= 'display: none;' if f.object.marked_for_destruction? %>"
    id="<%= f.object.student_id %>">
  <td>
    <% if f.object.persisted? %>
      <%= f.hidden_field :id %>
      <%= f.hidden_field :_destroy %>
    <% end %>

    <% present(f.object) do |recovery_diary_record_student| %>
      <%= f.input :student_id, as: :hidden %>
      <span class="<%= recovery_diary_record_student.student_name_class %>">
        <%= recovery_diary_record_student.student_name %>
      </span>
    <% end %>
  </td>

  <td>
    <span class="current-average" data-inputmask="'digits': <%= decimal_places %>">
      <% # FIXME: Need to find a better solution to format the scores based on the configuration. :( %>
      <%= StudentRecoveryAverageCalculator.new(
            f.object.student,
            @school_term_recovery_diary_record.recovery_diary_record.classroom,
            @school_term_recovery_diary_record.recovery_diary_record.discipline,
            @school_term_recovery_diary_record.step
          ).recovery_average&.to_d&.truncate(decimal_places) %>
    </span>
  </td>

  <td>
    <%= f.input :score, label: false, error: false,
        input_html: decimal_input_mask(decimal_places),
        readonly: (!f.object.active && !f.object.active.nil?) || f.object.exempted_from_discipline %>
    <%= format_error_message(f.error(:score, class: 'error').to_s).html_safe %>
  </td>
</tr>
