Sort signoff output by modified date
This commit is contained in:
parent
6670059170
commit
dfa73cbee4
1 changed files with 5 additions and 2 deletions
7
dump.py
7
dump.py
|
|
@ -2,7 +2,7 @@ import things
|
||||||
import argparse
|
import argparse
|
||||||
import re
|
import re
|
||||||
import random
|
import random
|
||||||
import sys
|
from datetime import datetime
|
||||||
|
|
||||||
with open('./emojis.txt', 'r') as emoji_file:
|
with open('./emojis.txt', 'r') as emoji_file:
|
||||||
EMOJIS = [l.strip() for l in emoji_file.readlines()]
|
EMOJIS = [l.strip() for l in emoji_file.readlines()]
|
||||||
|
|
@ -140,11 +140,14 @@ def generate_signoff_message(target_tag):
|
||||||
structured_tasks = tasks_to_heirarchy({ 'title': 'Stopping now', 'notes': '', 'status': '' }, reportable)
|
structured_tasks = tasks_to_heirarchy({ 'title': 'Stopping now', 'notes': '', 'status': '' }, reportable)
|
||||||
return format_tasks(structured_tasks, 0)
|
return format_tasks(structured_tasks, 0)
|
||||||
|
|
||||||
|
def by_modified_timestamp(val):
|
||||||
|
return datetime.fromisoformat(val['modified'])
|
||||||
|
|
||||||
def generate_today_message(target_tag):
|
def generate_today_message(target_tag):
|
||||||
format_tasks = make_recursive_formatter(TodayFormatter())
|
format_tasks = make_recursive_formatter(TodayFormatter())
|
||||||
reportable = list(filter(lambda t: has_tag(t, target_tag), things.today()))
|
reportable = list(filter(lambda t: has_tag(t, target_tag), things.today()))
|
||||||
|
|
||||||
for task in reportable:
|
for task in sorted(reportable, key=by_modified_timestamp):
|
||||||
sanitize_mentions(task)
|
sanitize_mentions(task)
|
||||||
|
|
||||||
top_level_comment = ' '.join(map(lambda e: f':{e}:', random.choices(EMOJIS, k=3)))
|
top_level_comment = ' '.join(map(lambda e: f':{e}:', random.choices(EMOJIS, k=3)))
|
||||||
|
|
|
||||||
Reference in a new issue