Commit 412f360

mo khan <mo@mokhan.ca>
2016-05-14 14:46:18
display the import address on profile page.
1 parent c5213f1
Changed files (4)
app
config
locales
app/models/training_history.rb
@@ -7,6 +7,14 @@ class TrainingHistory
     @exercise = exercise
   end
 
+  def personal_record
+    user.
+      exercise_sessions.
+      joins(:exercise).
+      where(exercises: { name: exercise.name }).
+      maximum(:target_weight)
+  end
+
   def to_line_chart
     user.
       exercise_sessions.
app/models/user.rb
@@ -27,6 +27,10 @@ class User < ActiveRecord::Base
     username
   end
 
+  def import_address
+    "#{id}@stronglifters.com"
+  end
+
   def add_to_inbox(email)
     email.attachments.each do |attachment|
       BackupFile.new(self, attachment).process_later(Program.stronglifts)
@@ -34,10 +38,7 @@ class User < ActiveRecord::Base
   end
 
   def personal_record_for(exercise)
-    exercise_sessions.
-      joins(:exercise).
-      where(exercises: { name: exercise.name }).
-      maximum(:target_weight)
+    history_for(exercise).personal_record
   end
 
   def history_for(exercise)
app/views/profiles/show.html.erb
@@ -9,6 +9,8 @@
     <% else %>
       <p><%= t('.no_workouts_completed') %></p>
     <% end %>
+    <p><%= Profile.human_attribute_name(:time_zone) %> <%= @user.time_zone %></p>
+    <p><%= mail_to(@user.import_address, User.human_attribute_name(:import_address)) %></p>
   </div>
 
   <div class="small-12 medium-8 columns small-text-center medium-text-left">
config/locales/en.yml
@@ -34,6 +34,8 @@ en:
         other: Other
         transgender: Transgender
         social_tolerance: Social Tolerance
+      user:
+        import_address: Send-to-Stronglifters e-mail address
   time:
     formats:
       short: "%a, %d %b %Y"