Commit b71d358

speasley <s@stephenpeasley.com>
2016-07-28 03:14:53
Show N/A when no exercise record exists
1 parent a90308c
Changed files (3)
app
views
config
locales
db
app/views/profiles/show.html.erb
@@ -31,7 +31,11 @@
       <tbody>
         <% @program.each_exercise do |exercise| %>
           <tr>
-            <td> <strong><%= exercise.name %></strong></td><td><%= @user.personal_record_for(exercise) %> lbs</td>
+            <% if @user.personal_record_for(exercise) %>
+              <td><strong><%= exercise.name %></strong></td><td><%= "#{@user.personal_record_for(exercise)} lbs" %></td>
+            <% else %>
+              <td><strong><%= exercise.name %></strong></td><td><%= t('.not_available') %></td>
+            <% end %>
           </tr>
         <% end %>
       </tbody>
config/locales/en.yml
@@ -92,7 +92,8 @@ en:
       lead: Search for your regular gym.
     show:
       exercise_header: Exercise
-      maximum_achieved: Maximum Achieved
+      maximum_achieved: Personal Record
+      not_available: N/A
       no_workouts_completed: 0 workouts completed
       personal_records: Personal Records
       workouts_completed: "%{count} workouts completed since %{first_session}."
db/schema.rb
@@ -62,7 +62,7 @@ ActiveRecord::Schema.define(version: 20160720022923) do
 
   create_table "profiles", id: :uuid, default: -> { "uuid_generate_v4()" }, force: :cascade do |t|
     t.uuid     "user_id",                          null: false
-    t.integer  "gender",           default: 0,     null: false
+    t.integer  "gender",           default: 0
     t.integer  "social_tolerance"
     t.datetime "created_at",                       null: false
     t.datetime "updated_at",                       null: false