<commit_before><h1>Everyone Loves Getting Rewarded. :)</h1>

<% @rewards.each do |reward| %>
  <a href="/rewards/<%= reward.id %>" title="Edit Reward">
    <div>
      Description: <%= reward.description %>
    </div>

    <div>
      <%= image_tag reward.image_url %>
    </div>

    <div>
      Price: <%= reward.amount_cost %>
    </div>
  </a>
    <% if user_is_child? %>
      <div>
        <%= button_to "Purchase!", "/update_reward_status/#{reward.id}", method: :patch, params: { status: "pending"} %>
      </div>
    <% else %>
      <div>
        <% if reward.status == "pending" %>
          <%= button_to "Approve", "/update_reward_status/#{reward.id}", method: :patch, params: { status: "bought" } %>
          <%= button_to "Cancel order", "/update_reward_status/#{reward.id}", method: :patch, params: { status: "not bought"} %>
        <% end %>
      </div>
    <% end %>
<% end %><commit_msg>make purchasing available for child only if their bank amount is greater or equal to price of reward<commit_after><h1>Everyone Loves Getting Rewarded. :)</h1>

<% @rewards.each do |reward| %>
  <a href="/rewards/<%= reward.id %>" title="Edit Reward">
    <div>
      Description: <%= reward.description %>
    </div>

    <div>
      <%= image_tag reward.image_url %>
    </div>

    <div>
      Price: <%= reward.amount_cost %>
    </div>
  </a>
    <% if user_is_child? %>
      <% if reward.child.total_balance >= reward.amount_cost %>
      <div>
        <%= button_to "Purchase!", "/update_reward_status/#{reward.id}", method: :patch, params: { status: "pending"} %>
      </div>
      <% else %>
      <div>
        <%= button_to "Purchase!" %>
      </div>
      <% end %>
    <% else %>
      <div>
        <% if reward.status == "pending" %>
          <%= button_to "Approve", "/update_reward_status/#{reward.id}", method: :patch, params: { status: "bought" } %>
          <%= button_to "Cancel order", "/update_reward_status/#{reward.id}", method: :patch, params: { status: "not bought"} %>
        <% end %>
      </div>
    <% end %>
<% end %>
{'fraction_non_alphanumeric': 0.2005813953488372, 'fraction_numerical': 0.001937984496124031, 'mean_word_length': 2.5726643598615917, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 66, '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': '7637074', 'n_tokens_mistral': 761, 'n_tokens_neox': 687, 'n_words': 156}