def current_month_task_analysis():
"""
current month task analysis
"""
now = datetime.datetime.now()
no_of_days_current_month = calendar.monthrange(now.year, now.month)[1]
total_tasks = 0
total_incomplete_tasks = 0
list_of_files = list_of_tasks_files()
for some_file in range(0, len(list_of_files)):
list_of_files[some_file] = os.path.join(DIARY_CONFIG_FOLDER_PATH, list_of_files[some_file])
for some_file in list_of_files:
with open(some_file) as fp:
contents = yaml.load(fp)
for entry in contents['entries']:
total_tasks += 1
total_incomplete_tasks += (1 if entry['status'] == 0 else 0)
percent_incomplete_task = total_incomplete_tasks * 100 / total_tasks
percent_complete_task = 100 - percent_incomplete_task
entry_frequency = total_tasks * 100 / no_of_days_current_month
chalk.red('Percentage of incomplete task : ' + str(percent_incomplete_task))
chalk.green('Percentage of complete task : ' + str(percent_complete_task))
chalk.blue("Frequency of adding task (Task/Day) : " + str(entry_frequency))
评论列表
文章目录