Created
February 24, 2012 09:54
-
-
Save iMagesh/1899866 to your computer and use it in GitHub Desktop.
Weekly report task to managers about the project timeline
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| task :weekly_report => [:environment] do | |
| @start_date=Date.today.beginning_of_week | |
| start_date=@start_date.to_date | |
| @end_date=6.days.since(@start_date) | |
| end_date=@end_date.to_date | |
| @project=Project.find_all_by_isactive(true) | |
| @proj=[] | |
| @project.each do |project| | |
| @proj << {:name => project.projectname,:billable => project.timeentries.sum(:hours_taken, :conditions=>['DATE(task_date)>=? and DATE(task_date)<=? and status=?',start_date,end_date, "Billable"]),:nonbillable => project.timeentries.sum(:hours_taken, :conditions=>['DATE(task_date)>=? and DATE(task_date)<=? and status=?',start_date,end_date, "NonBillable"]) ,:hours =>project.timeentries.sum(:hours_taken, :conditions=>['DATE(task_date)>=? and DATE(task_date)<=?',start_date,end_date])} | |
| end | |
| UserNotifier.deliver_weekly_report_project(@proj) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment