Displaying 2 results from an estimated 2 matches for "week_id".
2013 Jan 24
12
group by + sum
Hi.. I need some support...
table:
week_id, user_id, project_id, hours
ex. =>
33, 2, 1, 10
34, 2,1,15
33, 2, 2, 20
35, 3, 1,20
etc.
Want to display a sum of hours per week_id per user_id
I have:
@hours = HourUser.includes(:user).group_by { |h| h.week_id }
@hours.keys.sort.each do |hour|
@hours[hour].collect(&:stunden).sum
Hours...
2006 Jan 11
4
Help with Non-model classes
...they have put in, or plan to put in to those assignments
each week.
Because this is effectively a weekly calendar, I created the idea of
a week as a range of dates. In my original version, I had a weeks
table in my database and the start and end dates of all my time
sensitive objects were week_id. In the second rendition, I still had
my weeks table but everything date sensitive used a date, rather than
an ID. This means that I don''t have to have a Week model, only a
simple class.
My problem is that I''m not 100% sure where to put the class, how to
include it in my...