<commit_before>.card.col-md-8.col-lg-7.mx-auto.float-none.white.z-depth-1.py-2.px-2

  = bootstrap_form_for(@harvest) do |f|
    .card-header
      - if content_for? :title
        %h1.h2-responsive.text-center
          = harvest_icon
          %strong=yield :title
    .card-body
      = required_field_help_text
      - if @harvest.errors.any?
        #error_explanation
          %h2 #{pluralize(@harvest.errors.size, "error")} prohibited this harvest from being saved:"
          %ul
            - @harvest.errors.full_messages.each do |msg|
              %li= msg

      .row
        .col-12
          = f.label :crop, 'What did you harvest?', class: 'required'
          - if @planting
            = link_to @planting.crop.name, planting_path(@planting)
            from
            = link_to @planting.garden.name, garden_path(@planting.garden)
            = f.hidden_field :planting_id, value: @planting.id
          - else
            = auto_suggest @harvest, :crop, class: 'form-control', default: @crop
            - unless @planting
              %span.help-block.col-md-8
                Can't find what you're looking for?
                = link_to "Request new crops.", new_crop_path

        .col-md-4
          = f.text_field :harvested_at, value: @harvest.harvested_at ? @harvest.harvested_at.to_s(:ymd) : '',
                         class: 'add-datepicker', label: 'When?'
        .col-12
          = f.form_group :plant_part_id, label: { text: "Harvested Plant Part" } do
            .row
              - PlantPart.all.order(:name).pluck(:id, :name).each do |id, name|
                .col-4.col-md-3= f.radio_button :plant_part_id, id, label: name, checked: true

      -# Some browsers (eg Firefox for Android) assume "number" means
      -# "integer" unless you specify step="any":
      -# http://blog.isotoma.com/2012/03/html5-input-typenumber-and-decimalsfloats-in-chrome/
      .row
        .col-md-4
          = f.number_field :quantity, class: 'input-small form-control', step: 'any', label: 'How many?'
        .col-md-8
          = f.select(:unit, Harvest::UNITS_VALUES, { include_blank: false }, class: 'input-medium form-control')
      .row
        .col-md-4
          = f.number_field :weight_quantity, class: 'input-small form-control', step: 'any', label: 'Weighing (in total)'
        .col-md-8
          = f.select(:weight_unit, Harvest::WEIGHT_UNITS_VALUES, { include_blank: false }, class: 'form-control')
      = f.text_area :description, rows: 6, label: 'Notes'

    .card-footer
      .text-right= f.submit 'Save'
<commit_msg>fix plant part selection bug on editing harvests<commit_after>.card.col-md-8.col-lg-7.mx-auto.float-none.white.z-depth-1.py-2.px-2

  = bootstrap_form_for(@harvest) do |f|
    .card-header
      - if content_for? :title
        %h1.h2-responsive.text-center
          = harvest_icon
          %strong=yield :title
    .card-body
      = required_field_help_text
      - if @harvest.errors.any?
        #error_explanation
          %h2 #{pluralize(@harvest.errors.size, "error")} prohibited this harvest from being saved:"
          %ul
            - @harvest.errors.full_messages.each do |msg|
              %li= msg

      .row
        .col-12
          = f.label :crop, 'What did you harvest?', class: 'required'
          - if @planting
            = link_to @planting.crop.name, planting_path(@planting)
            from
            = link_to @planting.garden.name, garden_path(@planting.garden)
            = f.hidden_field :planting_id, value: @planting.id
          - else
            = auto_suggest @harvest, :crop, class: 'form-control', default: @crop
            - unless @planting
              %span.help-block.col-md-8
                Can't find what you're looking for?
                = link_to "Request new crops.", new_crop_path

        .col-md-4
          = f.text_field :harvested_at, value: @harvest.harvested_at ? @harvest.harvested_at.to_s(:ymd) : '',
                         class: 'add-datepicker', label: 'When?'
        .col-12
          = f.form_group :plant_part_id, label: { text: "Harvested Plant Part" } do
            .row
              - PlantPart.all.order(:name).pluck(:id, :name).each do |id, name|
                .col-4.col-md-3= f.radio_button :plant_part_id, id, label: name, checked: (id == @planting.plant_part_id)

      -# Some browsers (eg Firefox for Android) assume "number" means
      -# "integer" unless you specify step="any":
      -# http://blog.isotoma.com/2012/03/html5-input-typenumber-and-decimalsfloats-in-chrome/
      .row
        .col-md-4
          = f.number_field :quantity, class: 'input-small form-control', step: 'any', label: 'How many?'
        .col-md-8
          = f.select(:unit, Harvest::UNITS_VALUES, { include_blank: false }, class: 'input-medium form-control')
      .row
        .col-md-4
          = f.number_field :weight_quantity, class: 'input-small form-control', step: 'any', label: 'Weighing (in total)'
        .col-md-8
          = f.select(:weight_unit, Harvest::WEIGHT_UNITS_VALUES, { include_blank: false }, class: 'form-control')
      = f.text_area :description, rows: 6, label: 'Notes'

    .card-footer
      .text-right= f.submit 'Save'

{'fraction_non_alphanumeric': 0.13561275451402227, 'fraction_numerical': 0.010756819054936612, 'mean_word_length': 2.090207715133531, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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': '5880314', 'n_tokens_mistral': 1774, 'n_tokens_neox': 1704, 'n_words': 358}