def test_can_read_and_parse_data_from_a_log_file(self): hourslist = hours_input.readfromlog(r"Tests\TestLog.log") assert len(hourslist) == 2 assert hourslist[0].date == datetime.date(2012, 06, 12) assert hourslist[0].start == datetime.time(9, 01) assert hourslist[0].end == datetime.time(17, 10) assert hourslist[1].date == datetime.date(2012, 06, 13) assert hourslist[1].start == datetime.time(8, 13) assert hourslist[1].end == datetime.time(16, 14)
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 read_hours(): logFile = os.environ['USERPROFILE'] + r"\Documents\Timesheet.log" return hours_input.readfromlog(logFile)
# 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)