Skip to content

Commit

Permalink
Merge pull request #2467 from ophrescue/feature/training-dates
Browse files Browse the repository at this point in the history
add training completed dates
  • Loading branch information
markottaviani authored Dec 30, 2024
2 parents 2d7e907 + 84ab3b3 commit eace023
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ def user_params
:graphic_design,
:active,
:dog_handling_training_complete,
:dog_training_completed_dt,
:cat_handling_training_complete,
:cat_training_completed_dt,
badge_ids: [],
agreement_attributes: [
:attachment,
Expand Down
12 changes: 12 additions & 0 deletions app/views/users/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -425,21 +425,33 @@
<%= f.check_box :dog_handling_training_complete, class: "form-check-input", id: "dog_handling_training_complete" %>
<label class="form-check-label" for="dog_handling_training_complete">Dog handling training complete</label>
</div>
<div class="form-group row">
<%= f.label :dog_training_completed_dt, "Dog Training Completed Date", class: 'col-form-label col-form-label-sm col-4' %>
<%= f.text_field :dog_training_completed_dt, class: 'form-control form-control-sm col-6' %>
<div class="form-text text-muted col-6 offset-4 small">yyyy-mm-dd</div>
</div>
<div class="form-check">
<%= f.check_box :cat_handling_training_complete, class: "form-check-input", id: "cat_handling_training_complete" %>
<label class="form-check-label" for="cat_handling_training_complete">Cat handling training complete</label>
</div>
<div class="form-group row">
<%= f.label :cat_training_completed_dt, "Cat Training Completed Date", class: 'col-form-label col-form-label-sm col-4' %>
<%= f.text_field :cat_training_completed_dt, class: 'form-control form-control-sm col-6' %>
<div class="form-text text-muted col-6 offset-4 small">yyyy-mm-dd</div>
</div>
<% else %>
<% if @user.dog_handling_training_complete? %>
<p><span class="badge badge-info">Dog Handling Training Complete</span></p>
<% else %>
<p><span class="badge badge-danger">Dog Handling Training Incomplete</span></p>
<% end %>
<p><%= @user.dog_training_completed_dt.strftime('%m/%d/%Y') if @user.dog_training_completed_dt %></p>
<% if @user.cat_handling_training_complete? %>
<p><span class="badge badge-info">Cat Handling Training Complete</span></p>
<% else %>
<p><span class="badge badge-danger">Cat Handling Training Incomplete</span></p>
<% end %>
<p><%= @user.cat_training_completed_dt.strftime('%m/%d/%Y') if @user.cat_training_completed_dt %></p>
<% end %>

<% if is_admin? %>
Expand Down
10 changes: 10 additions & 0 deletions app/views/users/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@
<% else %>
<p><span class="badge badge-danger">Cat Handling Training Incomplete</span></p>
<% end %>
<table class="table table-striped table-bordered table-sm">
<tr>
<td>Dog Handling Training Completed Date</td>
<td><%= @user.dog_training_completed_dt.strftime('%m/%d/%Y') if @user.dog_training_completed_dt %></td>
</tr>
<tr>
<td>Cat Handling Training Completed Date</td>
<td><%= @user.cat_training_completed_dt.strftime('%m/%d/%Y') if @user.cat_training_completed_dt %></td>
</tr>
</table>
<table class="table table-striped table-bordered table-sm">
<tr>
<td>Address</td>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddTrainingCompletedDatesToUsers < ActiveRecord::Migration[6.1]
def change
add_column :users, :dog_training_completed_dt, :date
add_column :users, :cat_training_completed_dt, :date
end
end
4 changes: 3 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2024_10_26_170549) do
ActiveRecord::Schema.define(version: 2024_12_30_193326) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -633,6 +633,8 @@
t.boolean "can_foster_dogs", default: false
t.boolean "is_clerical", default: false, null: false
t.boolean "foster_friend", default: false, null: false
t.date "dog_training_completed_dt"
t.date "cat_training_completed_dt"
t.index ["agreement_id"], name: "index_users_on_agreement_id"
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["latitude", "longitude"], name: "index_users_on_latitude_and_longitude"
Expand Down

0 comments on commit eace023

Please sign in to comment.