Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.