Skip to content

Instantly share code, notes, and snippets.

@antulik
Created January 16, 2014 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antulik/8454423 to your computer and use it in GitHub Desktop.
Save antulik/8454423 to your computer and use it in GitHub Desktop.
class ProfilesController < ApplicationController
def index
@tracking_profiles = current_user.tracking_profiles
end
end
module TrackingProfileDecorator
def filtered_hourly_stats
hourly_stats = self.hourly_stats.select do |s|
date_range.begin < s.time && s.time < date_range.end
end
self.attributes.
merge(self.profile.attributes).
merge('stats' => Stat.merge(hourly_stats)).
merge('hourly_stats' => hourly_stats)
end
end
- for profile in @tracking_profiles
= render 'profile', profile: profile.filtered_hourly_stats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment