def generate_estimated_hours(logfile): # logfile variable loaded from executing host hours = hours_input.readfromlog(logfile) hours = hours_feed.calculate_estimated_hours(datetime.datetime.today(), hours) hours = hours_estimator.get_estimated_hours(hours) # TODO: Seperate this view processing from the estimated hours model later. # Sort by date hours = sorted(hours, cmp=lambda lhs, rhs: lhs.date > rhs.date) weeks = hours_aggregation.group_hours_by_week(hours) # Print for weekindex in range(len(weeks)): print "Week %s" % weeks[weekindex][0].date.isocalendar()[1] for day in weeks[weekindex]: print day return weeks
def generate_estimated_hours(logfile): # logfile variable loaded from executing host hours = hours_input.readfromlog(logfile) hours = hours_feed.calculate_estimated_hours(datetime.datetime.today(), hours) hours = hours_estimator.get_estimated_hours(hours) # TODO: Seperate this view processing from the estimated hours model later. # Sort by date hours = sorted(hours, cmp=lambda lhs, rhs: lhs.date > rhs.date) weeks = hours_aggregation.group_hours_by_week(hours) #Print for weekindex in range(len(weeks)): print "Week %s" % weeks[weekindex][0].date.isocalendar()[1] for day in weeks[weekindex]: print day return weeks
def should_write_to_report(): print "Fill in spreadsheet? (Y/N)" fill = sys.stdin.read(1).lower() if (fill == 'y'): return True else: print "No report written." return False def write_hours_to_report(hours): xls_file = "C:\Users\carmitage\Documents\AdminDocs\Origin Timesheet 2013 - Copy.xlsx" writer = reportoutput.build_ipy_writer(xls_file) for estimated_hours in hours: print "Written: %s" % estimated_hours writer.write(estimated_hours) if __name__ == '__main__': raw_hours = read_hours() hours_grouped_by_day = hours_feed.calculate_estimated_hours( datetime.datetime.today(), raw_hours) print_hours(hours_grouped_by_day) if should_write_to_report(): estimated_hours = hours_estimator.get_estimated_hours( hours_grouped_by_day) write_hours_to_report(estimated_hours) print sys.argv
print 'Estimation: %s' % estimate for hours in day: print '\t %s %s' % (hours.start, hours.end) def should_write_to_report(): print "Fill in spreadsheet? (Y/N)" fill = sys.stdin.read(1).lower() if(fill == 'y'): return True else: print "No report written." return False def write_hours_to_report(hours): xls_file = "C:\Users\carmitage\Documents\AdminDocs\Origin Timesheet 2013 - Copy.xlsx" writer = reportoutput.build_ipy_writer(xls_file) for estimated_hours in hours: print "Written: %s" % estimated_hours writer.write(estimated_hours) if __name__ == '__main__': raw_hours = read_hours() hours_grouped_by_day = hours_feed.calculate_estimated_hours(datetime.datetime.today(), raw_hours) print_hours(hours_grouped_by_day) if should_write_to_report(): estimated_hours = hours_estimator.get_estimated_hours(hours_grouped_by_day) write_hours_to_report(estimated_hours) print sys.argv
# Script for MVC WebApp import System from System import Environment import datetime import sys sys.path.append(r"C:\Users\carmitage\Dropbox\hg\Timesheet-Moose\MoosePy") sys.path.append(r"C:\Python27\Lib") from workinghours import hours_feed from workinghours import hours_input from workinghours import hours_estimator logfile = Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments) + r"\Timesheet.log" hours = hours_input.readfromlog(logfile) #hours = reversed(hours) hours = hours_feed.calculate_estimated_hours(datetime.datetime.today(), hours) hours = hours_estimator.get_estimated_hours(hours)
# Script for MVC WebApp import System from System import Environment import datetime import sys sys.path.append(r"C:\Users\carmitage\Dropbox\hg\Timesheet-Moose\MoosePy") sys.path.append(r"C:\Python27\Lib") from workinghours import hours_feed from workinghours import hours_input from workinghours import hours_estimator logfile = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + r"\Timesheet.log" hours = hours_input.readfromlog(logfile) #hours = reversed(hours) hours = hours_feed.calculate_estimated_hours(datetime.datetime.today(), hours) hours = hours_estimator.get_estimated_hours(hours)