def run(): current_time, date = checkmetools.getTimeDate() data_path = checkmetools.createPath() with open(data_path, "r") as data_json: working_time = json.load(data_json) working_time = working_time[0] print 'You worked from ' + working_time['start_time'] + ' to ' + working_time['end_time'] print 'That means ' + checkmetools.sec2hour(working_time['total_workspan']) print 'Not counting pauses: ' + checkmetools.sec2hour(working_time['total_timespan'])
def run(): current_time, date = checkmetools.getTimeDate() data_path = checkmetools.createPath() with open(data_path, "r+") as data_json: working_time = json.load(data_json) data_json.seek(0) # file rewrite working_time = addPause(working_time, current_time) json.dump(working_time, data_json, indent=2) data_json.truncate() # file rewrite
def run(): current_time, date = checkmetools.getTimeDate() data_path = checkmetools.createPath() with open(data_path, "r") as data_json: working_time = json.load(data_json) working_time = working_time[0] print 'You worked from ' + working_time[ 'start_time'] + ' to ' + working_time['end_time'] print 'That means ' + checkmetools.sec2hour( working_time['total_workspan']) print 'Not counting pauses: ' + checkmetools.sec2hour( working_time['total_timespan'])
def run(): working_time = checkmetools.initDataObj() save_path = checkmetools.createPath() with open(save_path, "w") as save_to_file: json.dump(working_time, save_to_file, indent=2)